
io.ciera.tool.sql.ooaofooa.activity.impl.ForkJoinNodeImpl Maven / Gradle / Ivy
package io.ciera.tool.sql.ooaofooa.activity.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.ooaofooa.activity.ControlNode;
import io.ciera.tool.sql.ooaofooa.activity.ForkJoinNode;
import io.ciera.tool.sql.ooaofooa.activity.impl.ControlNodeImpl;
public class ForkJoinNodeImpl extends ModelInstance implements ForkJoinNode {
public static final String KEY_LETTERS = "A_FJ";
public static final ForkJoinNode EMPTY_FORKJOINNODE = new EmptyForkJoinNode();
private Sql context;
// constructors
private ForkJoinNodeImpl( Sql context ) {
this.context = context;
ref_Id = UniqueId.random();
m_Descrip = "";
m_GuardCondition = "";
R1106_is_a_ControlNode_inst = ControlNodeImpl.EMPTY_CONTROLNODE;
}
private ForkJoinNodeImpl( Sql context, UniqueId instanceId, UniqueId ref_Id, String m_Descrip, String m_GuardCondition ) {
super(instanceId);
this.context = context;
this.ref_Id = ref_Id;
this.m_Descrip = m_Descrip;
this.m_GuardCondition = m_GuardCondition;
R1106_is_a_ControlNode_inst = ControlNodeImpl.EMPTY_CONTROLNODE;
}
public static ForkJoinNode create( Sql context ) throws XtumlException {
ForkJoinNode newForkJoinNode = new ForkJoinNodeImpl( context );
if ( context.addInstance( newForkJoinNode ) ) {
newForkJoinNode.getRunContext().addChange(new InstanceCreatedDelta(newForkJoinNode, KEY_LETTERS));
return newForkJoinNode;
}
else throw new InstancePopulationException( "Instance already exists within this population." );
}
public static ForkJoinNode create( Sql context, UniqueId ref_Id, String m_Descrip, String m_GuardCondition ) throws XtumlException {
return create(context, UniqueId.random(), ref_Id, m_Descrip, m_GuardCondition);
}
public static ForkJoinNode create( Sql context, UniqueId instanceId, UniqueId ref_Id, String m_Descrip, String m_GuardCondition ) throws XtumlException {
ForkJoinNode newForkJoinNode = new ForkJoinNodeImpl( context, instanceId, ref_Id, m_Descrip, m_GuardCondition );
if ( context.addInstance( newForkJoinNode ) ) {
return newForkJoinNode;
}
else throw new InstancePopulationException( "Instance already exists within this population." );
}
// attributes
private UniqueId ref_Id;
@Override
public void setId(UniqueId ref_Id) throws XtumlException {
checkLiving();
if (ref_Id.inequality( this.ref_Id)) {
final UniqueId oldValue = this.ref_Id;
this.ref_Id = ref_Id;
getRunContext().addChange(new AttributeChangedDelta(this, KEY_LETTERS, "ref_Id", oldValue, this.ref_Id));
}
}
@Override
public UniqueId getId() throws XtumlException {
checkLiving();
return ref_Id;
}
private String m_Descrip;
@Override
public void setDescrip(String m_Descrip) throws XtumlException {
checkLiving();
if (StringUtil.inequality(m_Descrip, this.m_Descrip)) {
final String oldValue = this.m_Descrip;
this.m_Descrip = m_Descrip;
getRunContext().addChange(new AttributeChangedDelta(this, KEY_LETTERS, "m_Descrip", oldValue, this.m_Descrip));
}
}
@Override
public String getDescrip() throws XtumlException {
checkLiving();
return m_Descrip;
}
private String m_GuardCondition;
@Override
public void setGuardCondition(String m_GuardCondition) throws XtumlException {
checkLiving();
if (StringUtil.inequality(m_GuardCondition, this.m_GuardCondition)) {
final String oldValue = this.m_GuardCondition;
this.m_GuardCondition = m_GuardCondition;
getRunContext().addChange(new AttributeChangedDelta(this, KEY_LETTERS, "m_GuardCondition", oldValue, this.m_GuardCondition));
}
}
@Override
public String getGuardCondition() throws XtumlException {
checkLiving();
return m_GuardCondition;
}
// instance identifiers
@Override
public IInstanceIdentifier getId1() {
try {
return new InstanceIdentifier(getId());
}
catch ( XtumlException e ) {
getRunContext().getLog().error(e);
System.exit(1);
return null;
}
}
// operations
// static operations
// events
// selections
private ControlNode R1106_is_a_ControlNode_inst;
@Override
public void setR1106_is_a_ControlNode( ControlNode inst ) {
R1106_is_a_ControlNode_inst = inst;
}
@Override
public ControlNode R1106_is_a_ControlNode() throws XtumlException {
return R1106_is_a_ControlNode_inst;
}
@Override
public IRunContext getRunContext() {
return context().getRunContext();
}
@Override
public Sql context() {
return context;
}
@Override
public String getKeyLetters() {
return KEY_LETTERS;
}
@Override
public ForkJoinNode self() {
return this;
}
@Override
public ForkJoinNode 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_FORKJOINNODE;
}
}
class EmptyForkJoinNode extends ModelInstance implements ForkJoinNode {
// attributes
public void setId( UniqueId ref_Id ) throws XtumlException {
throw new EmptyInstanceException( "Cannot set attribute of empty instance." );
}
public UniqueId getId() throws XtumlException {
throw new EmptyInstanceException( "Cannot get attribute of empty instance." );
}
public void setDescrip( String m_Descrip ) throws XtumlException {
throw new EmptyInstanceException( "Cannot set attribute of empty instance." );
}
public String getDescrip() throws XtumlException {
throw new EmptyInstanceException( "Cannot get attribute of empty instance." );
}
public void setGuardCondition( String m_GuardCondition ) throws XtumlException {
throw new EmptyInstanceException( "Cannot set attribute of empty instance." );
}
public String getGuardCondition() throws XtumlException {
throw new EmptyInstanceException( "Cannot get attribute of empty instance." );
}
// operations
// selections
@Override
public ControlNode R1106_is_a_ControlNode() {
return ControlNodeImpl.EMPTY_CONTROLNODE;
}
@Override
public String getKeyLetters() {
return ForkJoinNodeImpl.KEY_LETTERS;
}
@Override
public ForkJoinNode self() {
return this;
}
@Override
public boolean isEmpty() {
return true;
}
@Override
public ForkJoinNode oneWhere(IWhere condition) throws XtumlException {
if (null == condition) throw new XtumlException("Null condition passed to selection.");
return ForkJoinNodeImpl.EMPTY_FORKJOINNODE;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy