use of org.yakindu.sct.model.sgraph.Choice in project statecharts by Yakindu.
the class SGraphNameProvider method qualifiedName.
public QualifiedName qualifiedName(Choice ele) {
// first get order number of choice node
List<Vertex> choiceList = new ArrayList<Vertex>();
choiceList.addAll(Collections2.filter(((Region) ele.eContainer()).getVertices(), new Predicate<Vertex>() {
public boolean apply(Vertex input) {
return input instanceof Choice;
}
}));
int index = choiceList.indexOf(ele);
QualifiedName qualifiedNameFromConverter = QualifiedName.create(_CHOICE_NAME + index);
return getParentQualifiedName(ele, qualifiedNameFromConverter);
}
use of org.yakindu.sct.model.sgraph.Choice in project statecharts by Yakindu.
the class SGraphJavaValidationTest method vertexNotReachable_AcceptThroughSubchoice.
/**
* A transition to a sub choice is considered implies reachability.
*/
@Test
public void vertexNotReachable_AcceptThroughSubchoice() {
prepareStateTest();
State stateA = factory.createState();
Region subRegion = factory.createRegion();
state.getRegions().add(subRegion);
State stateC = factory.createState();
subRegion.getVertices().add(stateC);
Choice choice = factory.createChoice();
subRegion.getVertices().add(choice);
Transition t1 = factory.createTransition();
t1.setSource(stateA);
t1.setTarget(choice);
Transition t2 = factory.createTransition();
t2.setSource(choice);
t2.setTarget(stateC);
validate(state);
assertNoIssues(diagnostics);
}
use of org.yakindu.sct.model.sgraph.Choice in project statecharts by Yakindu.
the class SGraphJavaValidationTest method vertexNotReachable_FailOnExternalPseudoPath.
/**
* If an incoming transitions is part of an external transition path that
* only consists of pseudo states and only has state predecessors within the
* state then the state is not reachable and the validation must fail with
* an error.
*/
@Test
public void vertexNotReachable_FailOnExternalPseudoPath() {
prepareStateTest();
Choice choice = factory.createChoice();
region.getVertices().add(choice);
createTransition(state, choice);
createTransition(choice, state);
validate(state);
assertIssue(diagnostics, ISSUE_NODE_NOT_REACHABLE);
}
use of org.yakindu.sct.model.sgraph.Choice in project statecharts by Yakindu.
the class SGraphJavaValidationTest method vertexNotReachable_FailOnExternalPseudoPathToSubstate.
/**
* If an incoming transitions is part of an external transition path to an
* internal state that only consists of pseudo states and only has state
* predecessors within the state then the state is not reachable and the
* validation must fail with an error.
*/
@Test
public void vertexNotReachable_FailOnExternalPseudoPathToSubstate() {
prepareStateTest();
Region subRegion = factory.createRegion();
state.getRegions().add(subRegion);
State stateA = factory.createState();
subRegion.getVertices().add(stateA);
Choice choice = factory.createChoice();
region.getVertices().add(choice);
createTransition(stateA, choice);
createTransition(choice, stateA);
validate(state);
assertIssue(diagnostics, ISSUE_NODE_NOT_REACHABLE);
}
use of org.yakindu.sct.model.sgraph.Choice in project statecharts by Yakindu.
the class SGraphJavaValidationTest method choiceWithoutOutgoingTransition.
/**
* A choice must have at least one outgoing transition
*/
@Test
public void choiceWithoutOutgoingTransition() {
statechart = factory.createStatechart();
Region region = factory.createRegion();
statechart.getRegions().add(region);
Choice choice = factory.createChoice();
region.getVertices().add(choice);
State state = factory.createState();
region.getVertices().add(state);
createTransition(state, choice);
assertFalse(validator.validate(choice, diagnostics, new HashMap<Object, Object>()));
assertIssueCount(diagnostics, 1);
assertError(diagnostics, ISSUE_CHOICE_WITHOUT_OUTGOING_TRANSITION);
}
Aggregations