1 | @Override | | 1 | @Override |
2 | public boolean predicate2(Object dm, Designer dsgr) { | | 2 | public boolean predicate2(Object dm, Designer dsgr) { |
3 | if (!(Model.getFacade().isAPseudostate(dm))) { | | 3 | if (!(Model.getFacade().isACompositeState(dm))) { |
4 | return NO_PROBLEM; | | 4 | return NO_PROBLEM; |
5 | } | | 5 | } |
6 | Object k = Model.getFacade().getKind(dm); | | 6 | Object cs = /*(MCompositeState)*/ dm; |
7 | if (!Model.getFacade() | | 7 | |
8 | .equalsPseudostateKind(k, | | 8 | // if this composite state is not attached to a statemachine |
9 | Model.getPseudostateKind().getShallowHistory())) { | | 9 | // it is not the toplevel composite state. |
10 | return NO_PROBLEM; | | 10 | if (Model.getFacade().getStateMachine(cs) == null) { |
11 | } | | 11 | return NO_PROBLEM; |
12 | | | 12 | } |
13 | // container state / composite state | | 13 | Collection peers = Model.getFacade().getSubvertices(cs); |
14 | Object cs = Model.getFacade().getContainer(dm); | | 14 | int initialStateCount = 0; |
15 | if (cs == null) { | | 15 | if (peers == null) { |
16 | LOG.debug("null parent state"); | | 16 | return PROBLEM_FOUND; |
17 | return NO_PROBLEM; | | 17 | } |
18 | } | | 18 | for (Iterator iter = peers.iterator(); iter.hasNext();) { |
19 | | | 19 | Object sv = iter.next(); |
20 | int initialStateCount = 0; | | 20 | if (Model.getFacade().isAPseudostate(sv) |
21 | Collection peers = Model.getFacade().getSubvertices(cs); | | 21 | && (Model.getFacade().getKind(sv).equals( |
22 | for (Object sv : peers) { | | 22 | Model.getPseudostateKind().getInitial()))) { |
23 | if (Model.getFacade().isAPseudostate(sv) | | 23 | initialStateCount++; |
24 | && Model.getFacade().equalsPseudostateKind( | | 24 | } |
25 | Model.getFacade().getKind(sv), | | 25 | } |
26 | Model.getPseudostateKind().getShallowHistory())) { | | 26 | if (initialStateCount == 0) { |
27 | initialStateCount++; | | 27 | return PROBLEM_FOUND; |
28 | } | | 28 | } |
29 | } | | 29 | return NO_PROBLEM; |
30 | if (initialStateCount > 1) { | | 30 | } |
31 | return PROBLEM_FOUND; | | | |
32 | } | | | |
33 | return NO_PROBLEM; | | | |
34 | } | | | |