001: package hero.entity;
002:
003: /*
004: * 02/11/2002 - 18:23:00
005: *
006: * ActivityNodeState.java -
007: * Copyright (C) 2002 Ecoo Team
008: * charoy@loria.fr
009: *
010: *
011: * This program is free software; you can redistribute it and/or
012: * modify it under the terms of the GNU Lesser General Public License
013: * as published by the Free Software Foundation; either version 2
014: * of the License, or (at your option) any later version.
015: *
016: * This program is distributed in the hope that it will be useful,
017: * but WITHOUT ANY WARRANTY; without even the implied warranty of
018: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
019: * GNU Lesser General Public License for more details.
020: *
021: * You should have received a copy of the GNU Lesser General Public License
022: * along with this program; if not, write to the Free Software
023: * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
024: */
025:
026: import hero.interfaces.BnNodeLocal;
027: import hero.interfaces.Constants;
028:
029: public class ActivityNodeState extends NodeState implements
030: java.io.Serializable {
031:
032: private static int[][] nodeTransition = {
033: { Constants.Nd.BAD_TRANSITION, // START, INITIAL
034: Constants.Nd.EXECUTING, // START, READY
035: Constants.Nd.BAD_TRANSITION, // START, DEAD
036: Constants.Nd.ANTICIPATING, // START, ANTICIPABLE
037: Constants.Nd.BAD_TRANSITION, // START, EXPIRED
038: Constants.Nd.BAD_TRANSITION, // START, ANTICIPATING
039: Constants.Nd.BAD_TRANSITION, // START, EXECUTING
040: Constants.Nd.BAD_TRANSITION, // START, EXECUTED
041: Constants.Nd.BAD_TRANSITION, // START, INERROR
042: Constants.Nd.BAD_TRANSITION, // START, FINISHED
043: Constants.Nd.BAD_TRANSITION, // START, TERMINATED
044: Constants.Nd.BAD_TRANSITION, // START, CHECKEDOUT
045: Constants.Nd.BAD_TRANSITION, // START, ANT_SUSPENDED
046: Constants.Nd.BAD_TRANSITION, // START, EXEC_SUSPENDED
047: }, { Constants.Nd.BAD_TRANSITION, // TERMINATE, INITIAL
048: Constants.Nd.BAD_TRANSITION, // TERMINATE, READY
049: Constants.Nd.BAD_TRANSITION, // TERMINATE, DEAD
050: Constants.Nd.BAD_TRANSITION, // TERMINATE, ANTICIPABLE
051: Constants.Nd.BAD_TRANSITION, // TERMINATE, EXPIRED
052: Constants.Nd.BAD_TRANSITION, // TERMINATE, ANTICIPATING
053: Constants.Nd.TERMINATED, // TERMINATE, EXECUTING
054: Constants.Nd.BAD_TRANSITION, // TERMINATE, EXECUTED
055: Constants.Nd.BAD_TRANSITION, // TERMINATE, INERROR
056: Constants.Nd.BAD_TRANSITION, // TERMINATE, FINISHED
057: Constants.Nd.BAD_TRANSITION, // TERMINATE, TERMINATED
058: Constants.Nd.BAD_TRANSITION, // TERMINATE, CHECKEDOUT
059: Constants.Nd.BAD_TRANSITION, // TERMINATE, ANT_SUSPENDED
060: Constants.Nd.BAD_TRANSITION, // TERMINATE, EXEC_SUSPENDED
061: }, { Constants.Nd.BAD_TRANSITION, // SUSPEND, INITIAL
062: Constants.Nd.BAD_TRANSITION, // SUSPEND, READY
063: Constants.Nd.BAD_TRANSITION, // SUSPEND, DEAD
064: Constants.Nd.BAD_TRANSITION, // SUSPEND, ANTICIPABLE
065: Constants.Nd.BAD_TRANSITION, // SUSPEND, EXPIRED
066: Constants.Nd.ANT_SUSPENDED, // SUSPEND, ANTICIPATING
067: Constants.Nd.ANT_SUSPENDED, // SUSPEND, EXECUTING
068: Constants.Nd.BAD_TRANSITION, // SUSPEND, EXECUTED
069: Constants.Nd.BAD_TRANSITION, // SUSPEND, INERROR
070: Constants.Nd.BAD_TRANSITION, // SUSPEND, FINISHED
071: Constants.Nd.BAD_TRANSITION, // SUSPEND, TERMINATED
072: Constants.Nd.BAD_TRANSITION, // SUSPEND, CHECKEDOUT
073: Constants.Nd.BAD_TRANSITION, // SUSPEND, ANT_SUSPENDED
074: Constants.Nd.BAD_TRANSITION, // SUSPEND, EXEC_SUSPENDED
075: }, { Constants.Nd.BAD_TRANSITION, // RESUME, INITIAL
076: Constants.Nd.BAD_TRANSITION, // RESUME, READY
077: Constants.Nd.BAD_TRANSITION, // RESUME, DEAD
078: Constants.Nd.BAD_TRANSITION, // RESUME, ANTICIPABLE
079: Constants.Nd.BAD_TRANSITION, // RESUME, EXPIRED
080: Constants.Nd.BAD_TRANSITION, // RESUME, ANTICIPATING
081: Constants.Nd.BAD_TRANSITION, // RESUME, EXECUTING
082: Constants.Nd.BAD_TRANSITION, // RESUME, EXECUTED
083: Constants.Nd.BAD_TRANSITION, // RESUME, INERROR
084: Constants.Nd.BAD_TRANSITION, // RESUME, FINISHED
085: Constants.Nd.BAD_TRANSITION, // RESUME, TERMINATED
086: Constants.Nd.BAD_TRANSITION, // RESUME, CHECKEDOUT
087: Constants.Nd.ANTICIPATING, // RESUME, ANT_SUSPENDED
088: Constants.Nd.EXECUTING, // RESUME, EXEC_SUSPENDED
089: }, { Constants.Nd.INITIAL, // EDGEINITIAL, INITIAL
090: Constants.Nd.INITIAL, // EDGEINITIAL, READY
091: Constants.Nd.BAD_TRANSITION, // EDGEINITIAL, DEAD
092: Constants.Nd.INITIAL, // EDGEINITIAL, ANTICIPABLE
093: Constants.Nd.BAD_TRANSITION, // EDGEINITIAL, EXPIRED
094: Constants.Nd.BAD_TRANSITION, // EDGEINITIAL, ANTICIPATING
095: Constants.Nd.BAD_TRANSITION, // EDGEINITIAL, EXECUTING
096: Constants.Nd.BAD_TRANSITION, // EDGEINITIAL, EXECUTED
097: Constants.Nd.BAD_TRANSITION, // EDGEINITIAL, INERROR
098: Constants.Nd.BAD_TRANSITION, // EDGEINITIAL, FINISHED
099: Constants.Nd.BAD_TRANSITION, // EDGEINITIAL, TERMINATED
100: Constants.Nd.BAD_TRANSITION, // EDGEINITIAL, CHECKEDOUT
101: Constants.Nd.BAD_TRANSITION, // EDGEINITIAL, ANT_SUSPENDED
102: Constants.Nd.BAD_TRANSITION, // EDGEINITIAL, EXEC_SUSPENDED
103: }, { Constants.Nd.ANTICIPABLE, // ANTACTIVE, INITIAL
104: Constants.Nd.ANTICIPABLE, // ANTACTIVE, READY
105: Constants.Nd.BAD_TRANSITION, // ANTACTIVE, DEAD
106: Constants.Nd.ANTICIPABLE, // ANTACTIVE, ANTICIPABLE
107: Constants.Nd.BAD_TRANSITION, // ANTACTIVE, EXPIRED
108: Constants.Nd.ANTICIPATING, // ANTACTIVE, ANTICIPATING
109: Constants.Nd.ANTICIPATING, // ANTACTIVE, EXECUTING
110: Constants.Nd.BAD_TRANSITION, // ANTACTIVE, EXECUTED
111: Constants.Nd.BAD_TRANSITION, // ANTACTIVE, INERROR
112: Constants.Nd.BAD_TRANSITION, // ANTACTIVE, FINISHED
113: Constants.Nd.TERMINATED, // ANTACTIVE, TERMINATED
114: Constants.Nd.BAD_TRANSITION, // ANTACTIVE, CHECKEDOUT
115: Constants.Nd.ANTICIPABLE, // ANTACTIVE, ANT_SUSPENDED
116: Constants.Nd.ANTICIPABLE, // ANTACTIVE, EXEC_SUSPENDED
117: }, { Constants.Nd.READY, // ACTIVE, INITIAL
118: Constants.Nd.READY, // ACTIVE, READY
119: Constants.Nd.BAD_TRANSITION, // ACTIVE, DEAD
120: Constants.Nd.READY, // ACTIVE, ANTICIPABLE
121: Constants.Nd.BAD_TRANSITION, // ACTIVE, EXPIRED
122: Constants.Nd.EXECUTING, // ACTIVE, ANTICIPATING
123: Constants.Nd.EXECUTING, // ACTIVE, EXECUTING
124: Constants.Nd.BAD_TRANSITION, // ACTIVE, EXECUTED
125: Constants.Nd.BAD_TRANSITION, // ACTIVE, INERROR
126: Constants.Nd.BAD_TRANSITION, // ACTIVE, FINISHED
127: Constants.Nd.TERMINATED, // ACTIVE, TERMINATED
128: Constants.Nd.BAD_TRANSITION, // ACTIVE, CHECKEDOUT
129: Constants.Nd.EXEC_SUSPENDED, // ACTIVE, ANT_SUSPENDED
130: Constants.Nd.EXEC_SUSPENDED, // ACTIVE, EXEC_SUSPENDED
131: }, { Constants.Nd.DEAD, // CANCEL, INITIAL
132: Constants.Nd.DEAD, // CANCEL, READY
133: Constants.Nd.BAD_TRANSITION, // CANCEL, DEAD
134: Constants.Nd.DEAD, // CANCEL, ANTICIPABLE
135: Constants.Nd.BAD_TRANSITION, // CANCEL, EXPIRED
136: Constants.Nd.DEAD, // CANCEL, ANTICIPATING
137: Constants.Nd.DEAD, // CANCEL, EXECUTING
138: Constants.Nd.BAD_TRANSITION, // CANCEL, EXECUTED
139: Constants.Nd.BAD_TRANSITION, // CANCEL, INERROR
140: Constants.Nd.BAD_TRANSITION, // CANCEL, FINISHED
141: Constants.Nd.BAD_TRANSITION, // CANCEL, TERMINATED
142: Constants.Nd.BAD_TRANSITION, // CANCEL, CHECKEDOUT
143: Constants.Nd.DEAD, // CANCEL, ANT_SUSPENDED
144: Constants.Nd.DEAD, // CANCEL, EXEC_SUSPENDED
145: } };
146:
147: public ActivityNodeState() {
148: }
149:
150: public int computeState(BnNodeLocal node, int operation) {
151: return nodeTransition[operation][node.getState()];
152: }
153:
154: }
|