use of org.yakindu.sct.model.sgraph.Scope in project statecharts by Yakindu.
the class StextTestFactory method getOrCreateSimpleScope.
public static SimpleScope getOrCreateSimpleScope(State state) {
for (Scope scope : state.getScopes()) {
if (scope instanceof SimpleScope) {
return (SimpleScope) scope;
}
}
SimpleScope scope = StextFactory.eINSTANCE.createSimpleScope();
state.getScopes().add(scope);
return scope;
}
use of org.yakindu.sct.model.sgraph.Scope in project statecharts by Yakindu.
the class StextTestFactory method _createLocalReaction.
public static LocalReaction _createLocalReaction(Statechart parent, EventSpec triggerEvent) {
LocalReaction reaction = _createLocalReaction(triggerEvent);
Scope scope = getOrCreateInternalScope(parent);
scope.getReactions().add(reaction);
return reaction;
}
use of org.yakindu.sct.model.sgraph.Scope in project statecharts by Yakindu.
the class RenameRefactoringTest method testRenameMultiStatement.
@Test
public void testRenameMultiStatement() {
Statechart initial = models.loadStatechartFromResource(RENAMING + "beforeMultiStatement.sct");
Statechart expected = models.loadStatechartFromResource(RENAMING + "AfterMultiStatement.sct");
// get element to rename
InterfaceScope someInterface = null;
EList<Scope> scopes = initial.getScopes();
for (Scope scope : scopes) {
if (scope instanceof InterfaceScope) {
someInterface = (InterfaceScope) scope;
}
}
testRenaming(initial, expected, someInterface.getVariables().get(0), "y");
}
use of org.yakindu.sct.model.sgraph.Scope in project statecharts by Yakindu.
the class RenameRefactoringTest method testRenameEvent.
@Test
public void testRenameEvent() {
Statechart initial = models.loadStatechartFromResource(RENAMING + INITIAL_STATECHART);
Statechart expected = models.loadStatechartFromResource(RENAMING + "AfterRenamingEvent.sct");
// get element to rename
Event someEvent1 = null;
EList<Scope> scopes = initial.getScopes();
for (Scope scope : scopes) {
if (scope instanceof InterfaceScope) {
InterfaceScope iScope = (InterfaceScope) scope;
for (Event event : iScope.getEvents()) {
if (event.getName().equals("someEvent1")) {
someEvent1 = event;
}
}
}
}
testRenaming(initial, expected, someEvent1, "someNewEventName");
}
use of org.yakindu.sct.model.sgraph.Scope in project statecharts by Yakindu.
the class STextJavaValidatorTest method checkVariableDefinition.
/**
* @see STextJavaValidator#checkVariableDefinition(org.yakindu.sct.model.stext.stext.VariableDefinition)
*/
@Test
public void checkVariableDefinition() {
Scope context = (Scope) parseExpression("interface if : var i : void", InterfaceScope.class.getSimpleName());
AssertableDiagnostics validationResult = tester.validate(context);
validationResult.assertErrorContains(STextTypeInferrer.VARIABLE_VOID_TYPE);
}
Aggregations