001: package hero.entity;
002:
003: import hero.interfaces.BnNodeLocal;
004: import hero.interfaces.Constants;
005:
006: public class TraditionalAutomaticNodeState extends NodeState implements
007: java.io.Serializable {
008:
009: private static int[][] nodeTransition = {
010: { Constants.Nd.BAD_TRANSITION, // START, INITIAL
011: Constants.Nd.TERMINATED, // START, READY
012: Constants.Nd.BAD_TRANSITION, // START, DEAD
013: Constants.Nd.BAD_TRANSITION, // START, ANTICIPABLE
014: Constants.Nd.BAD_TRANSITION, // START, EXPIRED
015: Constants.Nd.BAD_TRANSITION, // START, ANTICIPATING
016: Constants.Nd.BAD_TRANSITION, // START, EXECUTING
017: Constants.Nd.BAD_TRANSITION, // START, EXECUTED
018: Constants.Nd.BAD_TRANSITION, // START, INERROR
019: Constants.Nd.BAD_TRANSITION, // START, FINISHED
020: Constants.Nd.BAD_TRANSITION, // START, TERMINATED
021: Constants.Nd.BAD_TRANSITION, // START, CHECKEDOUT
022: Constants.Nd.BAD_TRANSITION, // START, ANT_SUSPENDED
023: Constants.Nd.BAD_TRANSITION, // START, EXEC_SUSPENDED
024: }, { Constants.Nd.BAD_TRANSITION, // TERMINATE, INITIAL
025: Constants.Nd.BAD_TRANSITION, // TERMINATE, READY
026: Constants.Nd.BAD_TRANSITION, // TERMINATE, DEAD
027: Constants.Nd.BAD_TRANSITION, // TERMINATE, ANTICIPABLE
028: Constants.Nd.BAD_TRANSITION, // TERMINATE, EXPIRED
029: Constants.Nd.BAD_TRANSITION, // TERMINATE, ANTICIPATING
030: Constants.Nd.TERMINATED, // TERMINATE, EXECUTING
031: Constants.Nd.BAD_TRANSITION, // TERMINATE, EXECUTED
032: Constants.Nd.BAD_TRANSITION, // TERMINATE, INERROR
033: Constants.Nd.BAD_TRANSITION, // TERMINATE, FINISHED
034: Constants.Nd.BAD_TRANSITION, // TERMINATE, TERMINATED
035: Constants.Nd.BAD_TRANSITION, // TERMINATE, CHECKEDOUT
036: Constants.Nd.BAD_TRANSITION, // TERMINATE, ANT_SUSPENDED
037: Constants.Nd.BAD_TRANSITION, // TERMINATE, EXEC_SUSPENDED
038: }, { Constants.Nd.BAD_TRANSITION, // SUSPEND, INITIAL
039: Constants.Nd.BAD_TRANSITION, // SUSPEND, READY
040: Constants.Nd.BAD_TRANSITION, // SUSPEND, DEAD
041: Constants.Nd.BAD_TRANSITION, // SUSPEND, ANTICIPABLE
042: Constants.Nd.BAD_TRANSITION, // SUSPEND, EXPIRED
043: Constants.Nd.BAD_TRANSITION, // SUSPEND, ANTICIPATING
044: Constants.Nd.BAD_TRANSITION, // SUSPEND, EXECUTING
045: Constants.Nd.BAD_TRANSITION, // SUSPEND, EXECUTED
046: Constants.Nd.BAD_TRANSITION, // SUSPEND, INERROR
047: Constants.Nd.BAD_TRANSITION, // SUSPEND, FINISHED
048: Constants.Nd.BAD_TRANSITION, // SUSPEND, TERMINATED
049: Constants.Nd.BAD_TRANSITION, // SUSPEND, CHECKEDOUT
050: Constants.Nd.BAD_TRANSITION, // SUSPEND, ANT_SUSPENDED
051: Constants.Nd.BAD_TRANSITION, // SUSPEND, EXEC_SUSPENDED
052: }, { Constants.Nd.BAD_TRANSITION, // RESUME, INITIAL
053: Constants.Nd.BAD_TRANSITION, // RESUME, READY
054: Constants.Nd.BAD_TRANSITION, // RESUME, DEAD
055: Constants.Nd.BAD_TRANSITION, // RESUME, ANTICIPABLE
056: Constants.Nd.BAD_TRANSITION, // RESUME, EXPIRED
057: Constants.Nd.BAD_TRANSITION, // RESUME, ANTICIPATING
058: Constants.Nd.BAD_TRANSITION, // RESUME, EXECUTING
059: Constants.Nd.BAD_TRANSITION, // RESUME, EXECUTED
060: Constants.Nd.BAD_TRANSITION, // RESUME, INERROR
061: Constants.Nd.BAD_TRANSITION, // RESUME, FINISHED
062: Constants.Nd.BAD_TRANSITION, // RESUME, TERMINATED
063: Constants.Nd.BAD_TRANSITION, // RESUME, CHECKEDOUT
064: Constants.Nd.ANTICIPATING, // RESUME, ANT_SUSPENDED
065: Constants.Nd.EXECUTING, // RESUME, EXEC_SUSPENDED
066: }, { Constants.Nd.INITIAL, // EDGEINITIAL, INITIAL
067: Constants.Nd.INITIAL, // EDGEINITIAL, READY
068: Constants.Nd.BAD_TRANSITION, // EDGEINITIAL, DEAD
069: Constants.Nd.INITIAL, // EDGEINITIAL, ANTICIPABLE
070: Constants.Nd.BAD_TRANSITION, // EDGEINITIAL, EXPIRED
071: Constants.Nd.BAD_TRANSITION, // EDGEINITIAL, ANTICIPATING
072: Constants.Nd.BAD_TRANSITION, // EDGEINITIAL, EXECUTING
073: Constants.Nd.BAD_TRANSITION, // EDGEINITIAL, EXECUTED
074: Constants.Nd.BAD_TRANSITION, // EDGEINITIAL, INERROR
075: Constants.Nd.BAD_TRANSITION, // EDGEINITIAL, FINISHED
076: Constants.Nd.BAD_TRANSITION, // EDGEINITIAL, TERMINATED
077: Constants.Nd.BAD_TRANSITION, // EDGEINITIAL, CHECKEDOUT
078: Constants.Nd.BAD_TRANSITION, // EDGEINITIAL, ANT_SUSPENDED
079: Constants.Nd.BAD_TRANSITION, // EDGEINITIAL, EXEC_SUSPENDED
080: }, { Constants.Nd.INITIAL, // ANTACTIVE, INITIAL
081: Constants.Nd.INITIAL, // ANTACTIVE, READY
082: Constants.Nd.BAD_TRANSITION, // ANTACTIVE, DEAD
083: Constants.Nd.INITIAL, // ANTACTIVE, ANTICIPABLE
084: Constants.Nd.BAD_TRANSITION, // ANTACTIVE, EXPIRED
085: Constants.Nd.INITIAL, // ANTACTIVE, ANTICIPATING
086: Constants.Nd.BAD_TRANSITION, // ANTACTIVE, EXECUTING
087: Constants.Nd.BAD_TRANSITION, // ANTACTIVE, EXECUTED
088: Constants.Nd.BAD_TRANSITION, // ANTACTIVE, INERROR
089: Constants.Nd.BAD_TRANSITION, // ANTACTIVE, FINISHED
090: Constants.Nd.TERMINATED, // ANTACTIVE, TERMINATED
091: Constants.Nd.BAD_TRANSITION, // ANTACTIVE, CHECKEDOUT
092: Constants.Nd.INITIAL, // ANTACTIVE, ANT_SUSPENDED
093: Constants.Nd.INITIAL, // ANTACTIVE, EXEC_SUSPENDED
094: }, { Constants.Nd.TERMINATED, // ACTIVE, INITIAL
095: Constants.Nd.TERMINATED, // ACTIVE, READY
096: Constants.Nd.BAD_TRANSITION, // ACTIVE, DEAD
097: Constants.Nd.READY, // ACTIVE, ANTICIPABLE
098: Constants.Nd.BAD_TRANSITION, // ACTIVE, EXPIRED
099: Constants.Nd.BAD_TRANSITION, // ACTIVE, ANTICIPATING
100: Constants.Nd.TERMINATED, // ACTIVE, EXECUTING
101: Constants.Nd.BAD_TRANSITION, // ACTIVE, EXECUTED
102: Constants.Nd.BAD_TRANSITION, // ACTIVE, INERROR
103: Constants.Nd.BAD_TRANSITION, // ACTIVE, FINISHED
104: Constants.Nd.TERMINATED, // ACTIVE, TERMINATED
105: Constants.Nd.BAD_TRANSITION, // ACTIVE, CHECKEDOUT
106: Constants.Nd.EXEC_SUSPENDED, // ACTIVE, ANT_SUSPENDED
107: Constants.Nd.EXEC_SUSPENDED, // ACTIVE, EXEC_SUSPENDED
108: }, { Constants.Nd.DEAD, // CANCEL, INITIAL
109: Constants.Nd.DEAD, // CANCEL, READY
110: Constants.Nd.DEAD, // CANCEL, DEAD
111: Constants.Nd.DEAD, // CANCEL, ANTICIPABLE
112: Constants.Nd.BAD_TRANSITION, // CANCEL, EXPIRED
113: Constants.Nd.BAD_TRANSITION, // CANCEL, ANTICIPATING
114: Constants.Nd.DEAD, // CANCEL, EXECUTING
115: Constants.Nd.BAD_TRANSITION, // CANCEL, EXECUTED
116: Constants.Nd.BAD_TRANSITION, // CANCEL, INERROR
117: Constants.Nd.BAD_TRANSITION, // CANCEL, FINISHED
118: Constants.Nd.BAD_TRANSITION, // CANCEL, TERMINATED
119: Constants.Nd.BAD_TRANSITION, // CANCEL, CHECKEDOUT
120: Constants.Nd.DEAD, // CANCEL, ANT_SUSPENDED
121: Constants.Nd.DEAD, // CANCEL, EXEC_SUSPENDED
122: } };
123:
124: public TraditionalAutomaticNodeState() {
125: }
126:
127: public int computeState(BnNodeLocal node, int operation) {
128: return nodeTransition[operation][node.getState()];
129: }
130:
131: }
|