use of org.yakindu.sct.model.sgraph.Reaction in project statecharts by Yakindu.
the class StateImpl method getLocalReactions.
/**
* <!-- begin-user-doc --> <!-- end-user-doc -->
*
* @generated NOT
*/
public EList<Reaction> getLocalReactions() {
EList<Reaction> result = new BasicInternalEList<Reaction>(Reaction.class);
EList<Scope> scopes = getScopes();
for (Scope scope : scopes) {
result.addAll(scope.getReactions());
}
return result;
}
use of org.yakindu.sct.model.sgraph.Reaction in project statecharts by Yakindu.
the class RefactoringHelper method getFirstEntryActions.
/**
* Returns the entry actions of a state. Returns null if no entry block is
* defined. If multiple entry blocks are defined, only the actions of the first
* one are returned.
*
* @param state
* @return list of actions of the first entry block defined in the specified
* state
*/
public EList<Expression> getFirstEntryActions(State state) {
EList<Reaction> localReactions = state.getLocalReactions();
for (Reaction reaction : localReactions) {
Trigger trigger = reaction.getTrigger();
if (trigger instanceof ReactionTrigger) {
ReactionTrigger reactionTrigger = (ReactionTrigger) trigger;
EList<EventSpec> triggers = reactionTrigger.getTriggers();
for (EventSpec eventSpec : triggers) {
if (eventSpec instanceof EntryEvent && reaction.getEffect() instanceof ReactionEffect) {
return ((ReactionEffect) reaction.getEffect()).getActions();
}
}
}
}
return null;
}
use of org.yakindu.sct.model.sgraph.Reaction in project statecharts by Yakindu.
the class RefactoringHelper method getFirstExitActions.
/**
* Returns the exit actions of a state. Returns null if no exit block is
* defined. If multiple exit blocks are defined, only the actions of the first
* one are returned.
*
* @param state
* @return list of actions of the first exit block defined in the specified
* state
*/
public EList<Expression> getFirstExitActions(State state) {
EList<Reaction> localReactions = state.getLocalReactions();
for (Reaction reaction : localReactions) {
Trigger trigger = reaction.getTrigger();
if (trigger instanceof ReactionTrigger) {
ReactionTrigger reactionTrigger = (ReactionTrigger) trigger;
EList<EventSpec> triggers = reactionTrigger.getTriggers();
for (EventSpec eventSpec : triggers) {
if (eventSpec instanceof ExitEvent && reaction.getEffect() instanceof ReactionEffect) {
return ((ReactionEffect) reaction.getEffect()).getActions();
}
}
}
}
return null;
}
use of org.yakindu.sct.model.sgraph.Reaction in project statecharts by Yakindu.
the class StextResource method serializeState.
protected void serializeState(State state) {
if (state.getScopes().size() != 1)
return;
Scope scope = state.getScopes().get(0);
EList<Reaction> reactions = scope.getReactions();
StringBuilder builder = new StringBuilder();
for (Reaction reaction : reactions) {
if (builder.length() > 0)
builder.append(NEW_LINE);
builder.append(serializeReaction(reaction));
}
state.setSpecification(builder.toString());
}
use of org.yakindu.sct.model.sgraph.Reaction in project statecharts by Yakindu.
the class StatechartImpl method getLocalReactions.
/**
* <!-- begin-user-doc --> <!-- end-user-doc -->
*
* @generated NOT
*/
public EList<Reaction> getLocalReactions() {
EList<Reaction> result = new BasicInternalEList<Reaction>(Reaction.class);
EList<Scope> scopes = getScopes();
for (Scope scope : scopes) {
result.addAll(scope.getReactions());
}
return result;
}
Aggregations