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

io.ciera.tool.templateengine.ooaofooa.body.impl.WhileStmtImpl Maven / Gradle / Ivy

There is a newer version: 2.6.3
Show newest version
package io.ciera.tool.templateengine.ooaofooa.body.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.UniqueId;
import io.ciera.tool.TemplateEngine;
import io.ciera.tool.templateengine.ooaofooa.body.ACT_SMT;
import io.ciera.tool.templateengine.ooaofooa.body.Block;
import io.ciera.tool.templateengine.ooaofooa.body.WhileStmt;
import io.ciera.tool.templateengine.ooaofooa.body.impl.ACT_SMTImpl;
import io.ciera.tool.templateengine.ooaofooa.body.impl.BlockImpl;
import io.ciera.tool.templateengine.ooaofooa.value.Value;
import io.ciera.tool.templateengine.ooaofooa.value.impl.ValueImpl;


public class WhileStmtImpl extends ModelInstance implements WhileStmt {

    public static final String KEY_LETTERS = "ACT_WHL";
    public static final WhileStmt EMPTY_WHILESTMT = new EmptyWhileStmt();

    private TemplateEngine context;

    // constructors
    private WhileStmtImpl( TemplateEngine context ) {
        this.context = context;
        ref_Statement_ID = UniqueId.random();
        ref_Value_ID = UniqueId.random();
        ref_Block_ID = UniqueId.random();
        R603_is_a_ACT_SMT_inst = ACT_SMTImpl.EMPTY_ACT_SMT;
        R608_controls_Block_inst = BlockImpl.EMPTY_BLOCK;
        R626_continue_result_Value_inst = ValueImpl.EMPTY_VALUE;
    }

    private WhileStmtImpl( TemplateEngine context, UniqueId instanceId, UniqueId ref_Statement_ID, UniqueId ref_Value_ID, UniqueId ref_Block_ID ) {
        super(instanceId);
        this.context = context;
        this.ref_Statement_ID = ref_Statement_ID;
        this.ref_Value_ID = ref_Value_ID;
        this.ref_Block_ID = ref_Block_ID;
        R603_is_a_ACT_SMT_inst = ACT_SMTImpl.EMPTY_ACT_SMT;
        R608_controls_Block_inst = BlockImpl.EMPTY_BLOCK;
        R626_continue_result_Value_inst = ValueImpl.EMPTY_VALUE;
    }

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

    public static WhileStmt create( TemplateEngine context, UniqueId instanceId, UniqueId ref_Statement_ID, UniqueId ref_Value_ID, UniqueId ref_Block_ID ) throws XtumlException {
        WhileStmt newWhileStmt = new WhileStmtImpl( context, instanceId, ref_Statement_ID, ref_Value_ID, ref_Block_ID );
        if ( context.addInstance( newWhileStmt ) ) {
            return newWhileStmt;
        }
        else throw new InstancePopulationException( "Instance already exists within this population." );
    }



    // attributes
    private UniqueId ref_Statement_ID;
    @Override
    public UniqueId getStatement_ID() throws XtumlException {
        checkLiving();
                return ref_Statement_ID;
    }
    @Override
    public void setStatement_ID( UniqueId ref_Statement_ID ) throws XtumlException {
        checkLiving();
        if ( ref_Statement_ID.inequality( this.ref_Statement_ID ) ) {
            final UniqueId oldValue = this.ref_Statement_ID;
            this.ref_Statement_ID = ref_Statement_ID;
            getRunContext().addChange(new AttributeChangedDelta(this, KEY_LETTERS, "ref_Statement_ID", oldValue, this.ref_Statement_ID));
        }
    }
    private UniqueId ref_Value_ID;
    @Override
    public void setValue_ID( UniqueId ref_Value_ID ) throws XtumlException {
        checkLiving();
        if ( ref_Value_ID.inequality( this.ref_Value_ID ) ) {
            final UniqueId oldValue = this.ref_Value_ID;
            this.ref_Value_ID = ref_Value_ID;
            getRunContext().addChange(new AttributeChangedDelta(this, KEY_LETTERS, "ref_Value_ID", oldValue, this.ref_Value_ID));
        }
    }
    @Override
    public UniqueId getValue_ID() throws XtumlException {
        checkLiving();
                return ref_Value_ID;
    }
    private UniqueId ref_Block_ID;
    @Override
    public UniqueId getBlock_ID() throws XtumlException {
        checkLiving();
                return ref_Block_ID;
    }
    @Override
    public void setBlock_ID( UniqueId ref_Block_ID ) throws XtumlException {
        checkLiving();
        if ( ref_Block_ID.inequality( this.ref_Block_ID ) ) {
            final UniqueId oldValue = this.ref_Block_ID;
            this.ref_Block_ID = ref_Block_ID;
            getRunContext().addChange(new AttributeChangedDelta(this, KEY_LETTERS, "ref_Block_ID", oldValue, this.ref_Block_ID));
        }
    }


    // instance identifiers
    @Override
    public IInstanceIdentifier getId1() {
        try {
            return new InstanceIdentifier(getStatement_ID());
        }
        catch ( XtumlException e ) {
            getRunContext().getLog().error(e);
            System.exit(1);
            return null;
        }
    }

    // operations


    // static operations


    // events


    // selections
    private ACT_SMT R603_is_a_ACT_SMT_inst;
    @Override
    public void setR603_is_a_ACT_SMT( ACT_SMT inst ) {
        R603_is_a_ACT_SMT_inst = inst;
    }
    @Override
    public ACT_SMT R603_is_a_ACT_SMT() throws XtumlException {
        return R603_is_a_ACT_SMT_inst;
    }
    private Block R608_controls_Block_inst;
    @Override
    public void setR608_controls_Block( Block inst ) {
        R608_controls_Block_inst = inst;
    }
    @Override
    public Block R608_controls_Block() throws XtumlException {
        return R608_controls_Block_inst;
    }
    private Value R626_continue_result_Value_inst;
    @Override
    public void setR626_continue_result_Value( Value inst ) {
        R626_continue_result_Value_inst = inst;
    }
    @Override
    public Value R626_continue_result_Value() throws XtumlException {
        return R626_continue_result_Value_inst;
    }


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

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

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

    @Override
    public WhileStmt value() {
        return this;
    }

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

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

}

class EmptyWhileStmt extends ModelInstance implements WhileStmt {

    // attributes
    public UniqueId getStatement_ID() throws XtumlException {
        throw new EmptyInstanceException( "Cannot get attribute of empty instance." );
    }
    public void setStatement_ID( UniqueId ref_Statement_ID ) throws XtumlException {
        throw new EmptyInstanceException( "Cannot set attribute of empty instance." );
    }
    public void setValue_ID( UniqueId ref_Value_ID ) throws XtumlException {
        throw new EmptyInstanceException( "Cannot set attribute of empty instance." );
    }
    public UniqueId getValue_ID() throws XtumlException {
        throw new EmptyInstanceException( "Cannot get attribute of empty instance." );
    }
    public UniqueId getBlock_ID() throws XtumlException {
        throw new EmptyInstanceException( "Cannot get attribute of empty instance." );
    }
    public void setBlock_ID( UniqueId ref_Block_ID ) throws XtumlException {
        throw new EmptyInstanceException( "Cannot set attribute of empty instance." );
    }


    // operations


    // selections
    @Override
    public ACT_SMT R603_is_a_ACT_SMT() {
        return ACT_SMTImpl.EMPTY_ACT_SMT;
    }
    @Override
    public Block R608_controls_Block() {
        return BlockImpl.EMPTY_BLOCK;
    }
    @Override
    public Value R626_continue_result_Value() {
        return ValueImpl.EMPTY_VALUE;
    }


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

    @Override
    public WhileStmt value() {
        return this;
    }
    
    @Override
    public WhileStmt self() {
        return this;
    }

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

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

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy