Skip to content
Snippets Groups Projects
Commit 6108f1aa authored by Johannes Mey's avatar Johannes Mey
Browse files

remove attributes in task

parent 7b3c1193
No related branches found
No related tags found
No related merge requests found
......@@ -6,53 +6,44 @@ aspect Navigation {
/** Check, whether an this element is a state */
syn boolean Element.isState() = false;
eq State.isState() = true;
/** View this element as a state */
syn State Element.asState() = null;
eq State.asState() = this;
/** Check, whether an this element is a transition */
syn boolean Element.isTransition() = false;
eq Transition.isTransition() = true;
/** View this element as a transition */
syn Transition Element.asTransition() = null;
eq Transition.asTransition() = this;
/** Get all states */
syn List<State> StateMachine.states() {
List<State> states = new ArrayList<>();
for (Element element: getElementList()) {
if (element.isState()) {
states.add(element.asState());
}
}
// TODO implement
return states;
}
/** Get all transitions */
syn List<Transition> StateMachine.transitions() {
List<Transition> transitions = new ArrayList<>();
for (Element element: getElementList()) {
if (element.isTransition()) {
transitions.add(element.asTransition());
}
}
// TODO implement
return transitions;
}
/** Get the state machine the element is contained in */
inh StateMachine Element.containingStateMachine();
eq StateMachine.getElement().containingStateMachine() = this;
// the following equation is only there to make the progam compile, it must be replaced by a reasonable alternative
eq ASTNode.getChild().containingStateMachine() = null;
/** Determine whether the State is final */
syn boolean State.isInitial() = containingStateMachine().getInitial().equals(this);
syn boolean State.isInitial() = false;
/** Determine whether the State is final */
syn boolean State.isFinal() = containingStateMachine().getFinalList().contains(this);
syn boolean State.isFinal() = false;
/** Get all successor states */
syn Collection<State> State.successors() = getOutgoingList().stream().map(Transition::getTo).collect(Collectors.toList());
syn Collection<State> State.successors() {
return new ArrayList<>();
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment