All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.ciera.tool.sql.architecture.expression.impl.UnaryOperationImpl Maven / Gradle / Ivy

There is a newer version: 2.7.3
Show newest version
package io.ciera.tool.sql.architecture.expression.impl;


import io.ciera.runtime.instanceloading.AttributeChangedDelta;
import io.ciera.runtime.instanceloading.InstanceCreatedDelta;
import io.ciera.runtime.summit.application.IRunContext;
import io.ciera.runtime.summit.classes.IInstanceIdentifier;
import io.ciera.runtime.summit.classes.InstanceIdentifier;
import io.ciera.runtime.summit.classes.ModelInstance;
import io.ciera.runtime.summit.exceptions.EmptyInstanceException;
import io.ciera.runtime.summit.exceptions.InstancePopulationException;
import io.ciera.runtime.summit.exceptions.XtumlException;
import io.ciera.runtime.summit.types.IWhere;
import io.ciera.runtime.summit.types.IXtumlType;
import io.ciera.runtime.summit.types.StringUtil;
import io.ciera.runtime.summit.types.UniqueId;
import io.ciera.tool.Sql;
import io.ciera.tool.sql.architecture.expression.Expression;
import io.ciera.tool.sql.architecture.expression.UnaryOperation;
import io.ciera.tool.sql.architecture.expression.impl.ExpressionImpl;


public class UnaryOperationImpl extends ModelInstance implements UnaryOperation {

    public static final String KEY_LETTERS = "UnaryOperation";
    public static final UnaryOperation EMPTY_UNARYOPERATION = new EmptyUnaryOperation();

    private Sql context;

    // constructors
    private UnaryOperationImpl( Sql context ) {
        this.context = context;
        ref_parent_name = "";
        ref_parent_package = "";
        ref_body_name = "";
        ref_block_number = "";
        ref_statement_number = "";
        ref_expression_number = "";
        ref_op_expression_number = "";
        m_operator = "";
        m_invocation = false;
        R776_is_a_Expression_inst = ExpressionImpl.EMPTY_EXPRESSION;
        R777_has_single_operand_Expression_inst = ExpressionImpl.EMPTY_EXPRESSION;
    }

    private UnaryOperationImpl( Sql context, UniqueId instanceId, String ref_parent_name, String ref_parent_package, String ref_body_name, String ref_block_number, String ref_statement_number, String ref_expression_number, String ref_op_expression_number, String m_operator, boolean m_invocation ) {
        super(instanceId);
        this.context = context;
        this.ref_parent_name = ref_parent_name;
        this.ref_parent_package = ref_parent_package;
        this.ref_body_name = ref_body_name;
        this.ref_block_number = ref_block_number;
        this.ref_statement_number = ref_statement_number;
        this.ref_expression_number = ref_expression_number;
        this.ref_op_expression_number = ref_op_expression_number;
        this.m_operator = m_operator;
        this.m_invocation = m_invocation;
        R776_is_a_Expression_inst = ExpressionImpl.EMPTY_EXPRESSION;
        R777_has_single_operand_Expression_inst = ExpressionImpl.EMPTY_EXPRESSION;
    }

    public static UnaryOperation create( Sql context ) throws XtumlException {
        UnaryOperation newUnaryOperation = new UnaryOperationImpl( context );
        if ( context.addInstance( newUnaryOperation ) ) {
            newUnaryOperation.getRunContext().addChange(new InstanceCreatedDelta(newUnaryOperation, KEY_LETTERS));
            return newUnaryOperation;
        }
        else throw new InstancePopulationException( "Instance already exists within this population." );
    }

    public static UnaryOperation create( Sql context, String ref_parent_name, String ref_parent_package, String ref_body_name, String ref_block_number, String ref_statement_number, String ref_expression_number, String ref_op_expression_number, String m_operator, boolean m_invocation ) throws XtumlException {
        return create(context, UniqueId.random(), ref_parent_name, ref_parent_package, ref_body_name, ref_block_number, ref_statement_number, ref_expression_number, ref_op_expression_number, m_operator, m_invocation);
    }

    public static UnaryOperation create( Sql context, UniqueId instanceId, String ref_parent_name, String ref_parent_package, String ref_body_name, String ref_block_number, String ref_statement_number, String ref_expression_number, String ref_op_expression_number, String m_operator, boolean m_invocation ) throws XtumlException {
        UnaryOperation newUnaryOperation = new UnaryOperationImpl( context, instanceId, ref_parent_name, ref_parent_package, ref_body_name, ref_block_number, ref_statement_number, ref_expression_number, ref_op_expression_number, m_operator, m_invocation );
        if ( context.addInstance( newUnaryOperation ) ) {
            return newUnaryOperation;
        }
        else throw new InstancePopulationException( "Instance already exists within this population." );
    }



    // attributes
    private String ref_parent_name;
    @Override
    public void setParent_name(String ref_parent_name) throws XtumlException {
        checkLiving();
        if (StringUtil.inequality(ref_parent_name, this.ref_parent_name)) {
            final String oldValue = this.ref_parent_name;
            this.ref_parent_name = ref_parent_name;
            getRunContext().addChange(new AttributeChangedDelta(this, KEY_LETTERS, "ref_parent_name", oldValue, this.ref_parent_name));
        }
    }
    @Override
    public String getParent_name() throws XtumlException {
        checkLiving();
        return ref_parent_name;
    }
    private String ref_parent_package;
    @Override
    public void setParent_package(String ref_parent_package) throws XtumlException {
        checkLiving();
        if (StringUtil.inequality(ref_parent_package, this.ref_parent_package)) {
            final String oldValue = this.ref_parent_package;
            this.ref_parent_package = ref_parent_package;
            getRunContext().addChange(new AttributeChangedDelta(this, KEY_LETTERS, "ref_parent_package", oldValue, this.ref_parent_package));
        }
    }
    @Override
    public String getParent_package() throws XtumlException {
        checkLiving();
        return ref_parent_package;
    }
    private String ref_body_name;
    @Override
    public String getBody_name() throws XtumlException {
        checkLiving();
        return ref_body_name;
    }
    @Override
    public void setBody_name(String ref_body_name) throws XtumlException {
        checkLiving();
        if (StringUtil.inequality(ref_body_name, this.ref_body_name)) {
            final String oldValue = this.ref_body_name;
            this.ref_body_name = ref_body_name;
            getRunContext().addChange(new AttributeChangedDelta(this, KEY_LETTERS, "ref_body_name", oldValue, this.ref_body_name));
        }
    }
    private String ref_block_number;
    @Override
    public void setBlock_number(String ref_block_number) throws XtumlException {
        checkLiving();
        if (StringUtil.inequality(ref_block_number, this.ref_block_number)) {
            final String oldValue = this.ref_block_number;
            this.ref_block_number = ref_block_number;
            getRunContext().addChange(new AttributeChangedDelta(this, KEY_LETTERS, "ref_block_number", oldValue, this.ref_block_number));
        }
    }
    @Override
    public String getBlock_number() throws XtumlException {
        checkLiving();
        return ref_block_number;
    }
    private String ref_statement_number;
    @Override
    public String getStatement_number() throws XtumlException {
        checkLiving();
        return ref_statement_number;
    }
    @Override
    public void setStatement_number(String ref_statement_number) throws XtumlException {
        checkLiving();
        if (StringUtil.inequality(ref_statement_number, this.ref_statement_number)) {
            final String oldValue = this.ref_statement_number;
            this.ref_statement_number = ref_statement_number;
            getRunContext().addChange(new AttributeChangedDelta(this, KEY_LETTERS, "ref_statement_number", oldValue, this.ref_statement_number));
        }
    }
    private String ref_expression_number;
    @Override
    public void setExpression_number(String ref_expression_number) throws XtumlException {
        checkLiving();
        if (StringUtil.inequality(ref_expression_number, this.ref_expression_number)) {
            final String oldValue = this.ref_expression_number;
            this.ref_expression_number = ref_expression_number;
            getRunContext().addChange(new AttributeChangedDelta(this, KEY_LETTERS, "ref_expression_number", oldValue, this.ref_expression_number));
        }
    }
    @Override
    public String getExpression_number() throws XtumlException {
        checkLiving();
        return ref_expression_number;
    }
    private String ref_op_expression_number;
    @Override
    public void setOp_expression_number(String ref_op_expression_number) throws XtumlException {
        checkLiving();
        if (StringUtil.inequality(ref_op_expression_number, this.ref_op_expression_number)) {
            final String oldValue = this.ref_op_expression_number;
            this.ref_op_expression_number = ref_op_expression_number;
            getRunContext().addChange(new AttributeChangedDelta(this, KEY_LETTERS, "ref_op_expression_number", oldValue, this.ref_op_expression_number));
        }
    }
    @Override
    public String getOp_expression_number() throws XtumlException {
        checkLiving();
        return ref_op_expression_number;
    }
    private String m_operator;
    @Override
    public String getOperator() throws XtumlException {
        checkLiving();
        return m_operator;
    }
    @Override
    public void setOperator(String m_operator) throws XtumlException {
        checkLiving();
        if (StringUtil.inequality(m_operator, this.m_operator)) {
            final String oldValue = this.m_operator;
            this.m_operator = m_operator;
            getRunContext().addChange(new AttributeChangedDelta(this, KEY_LETTERS, "m_operator", oldValue, this.m_operator));
        }
    }
    private boolean m_invocation;
    @Override
    public boolean getInvocation() throws XtumlException {
        checkLiving();
        return m_invocation;
    }
    @Override
    public void setInvocation(boolean m_invocation) throws XtumlException {
        checkLiving();
        if (m_invocation != this.m_invocation) {
            final boolean oldValue = this.m_invocation;
            this.m_invocation = m_invocation;
            getRunContext().addChange(new AttributeChangedDelta(this, KEY_LETTERS, "m_invocation", oldValue, this.m_invocation));
        }
    }


    // instance identifiers
    @Override
    public IInstanceIdentifier getId1() {
        try {
            return new InstanceIdentifier(getParent_name(), getParent_package(), getBody_name(), getBlock_number(), getStatement_number(), getExpression_number());
        }
        catch ( XtumlException e ) {
            getRunContext().getLog().error(e);
            System.exit(1);
            return null;
        }
    }

    // operations
    @Override
    public void render() throws XtumlException {
        context().T().push_buffer();
        Expression operand = self().R777_has_single_operand_Expression();
        operand.render();
        String operand_body = context().T().body();
        context().T().pop_buffer();
        context().T().include( "expression/t.unaryoperation.java", operand_body, self() );
    }



    // static operations


    // events


    // selections
    private Expression R776_is_a_Expression_inst;
    @Override
    public void setR776_is_a_Expression( Expression inst ) {
        R776_is_a_Expression_inst = inst;
    }
    @Override
    public Expression R776_is_a_Expression() throws XtumlException {
        return R776_is_a_Expression_inst;
    }
    private Expression R777_has_single_operand_Expression_inst;
    @Override
    public void setR777_has_single_operand_Expression( Expression inst ) {
        R777_has_single_operand_Expression_inst = inst;
    }
    @Override
    public Expression R777_has_single_operand_Expression() throws XtumlException {
        return R777_has_single_operand_Expression_inst;
    }


    @Override
    public IRunContext getRunContext() {
        return context().getRunContext();
    }

    @Override
    public Sql context() {
        return context;
    }

    @Override
    public String getKeyLetters() {
        return KEY_LETTERS;
    }

    @Override
    public UnaryOperation self() {
        return this;
    }

    @Override
    public UnaryOperation oneWhere(IWhere condition) throws XtumlException {
        if (null == condition) throw new XtumlException("Null condition passed to selection.");
        if (condition.evaluate(this)) return this;
        else return EMPTY_UNARYOPERATION;
    }

}

class EmptyUnaryOperation extends ModelInstance implements UnaryOperation {

    // attributes
    public void setParent_name( String ref_parent_name ) throws XtumlException {
        throw new EmptyInstanceException( "Cannot set attribute of empty instance." );
    }
    public String getParent_name() throws XtumlException {
        throw new EmptyInstanceException( "Cannot get attribute of empty instance." );
    }
    public void setParent_package( String ref_parent_package ) throws XtumlException {
        throw new EmptyInstanceException( "Cannot set attribute of empty instance." );
    }
    public String getParent_package() throws XtumlException {
        throw new EmptyInstanceException( "Cannot get attribute of empty instance." );
    }
    public String getBody_name() throws XtumlException {
        throw new EmptyInstanceException( "Cannot get attribute of empty instance." );
    }
    public void setBody_name( String ref_body_name ) throws XtumlException {
        throw new EmptyInstanceException( "Cannot set attribute of empty instance." );
    }
    public void setBlock_number( String ref_block_number ) throws XtumlException {
        throw new EmptyInstanceException( "Cannot set attribute of empty instance." );
    }
    public String getBlock_number() throws XtumlException {
        throw new EmptyInstanceException( "Cannot get attribute of empty instance." );
    }
    public String getStatement_number() throws XtumlException {
        throw new EmptyInstanceException( "Cannot get attribute of empty instance." );
    }
    public void setStatement_number( String ref_statement_number ) throws XtumlException {
        throw new EmptyInstanceException( "Cannot set attribute of empty instance." );
    }
    public void setExpression_number( String ref_expression_number ) throws XtumlException {
        throw new EmptyInstanceException( "Cannot set attribute of empty instance." );
    }
    public String getExpression_number() throws XtumlException {
        throw new EmptyInstanceException( "Cannot get attribute of empty instance." );
    }
    public void setOp_expression_number( String ref_op_expression_number ) throws XtumlException {
        throw new EmptyInstanceException( "Cannot set attribute of empty instance." );
    }
    public String getOp_expression_number() throws XtumlException {
        throw new EmptyInstanceException( "Cannot get attribute of empty instance." );
    }
    public String getOperator() throws XtumlException {
        throw new EmptyInstanceException( "Cannot get attribute of empty instance." );
    }
    public void setOperator( String m_operator ) throws XtumlException {
        throw new EmptyInstanceException( "Cannot set attribute of empty instance." );
    }
    public boolean getInvocation() throws XtumlException {
        throw new EmptyInstanceException( "Cannot get attribute of empty instance." );
    }
    public void setInvocation( boolean m_invocation ) throws XtumlException {
        throw new EmptyInstanceException( "Cannot set attribute of empty instance." );
    }


    // operations
    public void render() throws XtumlException {
        throw new EmptyInstanceException( "Cannot invoke operation on empty instance." );
    }


    // selections
    @Override
    public Expression R776_is_a_Expression() {
        return ExpressionImpl.EMPTY_EXPRESSION;
    }
    @Override
    public Expression R777_has_single_operand_Expression() {
        return ExpressionImpl.EMPTY_EXPRESSION;
    }


    @Override
    public String getKeyLetters() {
        return UnaryOperationImpl.KEY_LETTERS;
    }

    @Override
    public UnaryOperation self() {
        return this;
    }

    @Override
    public boolean isEmpty() {
        return true;
    }

    @Override
    public UnaryOperation oneWhere(IWhere condition) throws XtumlException {
        if (null == condition) throw new XtumlException("Null condition passed to selection.");
        return UnaryOperationImpl.EMPTY_UNARYOPERATION;
    }

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy