001: package hero.entity;
002:
003: /*
004: * 02/11/2002 - 17:31:40
005: *
006: * AutomaticNodeState.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: import hero.interfaces.BnNodeLocal;
026: import hero.interfaces.Constants;
027:
028: public class AutomaticNodeState extends NodeState implements
029: java.io.Serializable {
030:
031: private static int[][] nodeTransition = {
032: { Constants.Nd.BAD_TRANSITION, // START, INITIAL
033: Constants.Nd.TERMINATED, // START, READY
034: Constants.Nd.BAD_TRANSITION, // START, DEAD
035: Constants.Nd.BAD_TRANSITION, // START, ANTICIPABLE
036: Constants.Nd.BAD_TRANSITION, // START, EXPIRED
037: Constants.Nd.BAD_TRANSITION, // START, ANTICIPATING
038: Constants.Nd.BAD_TRANSITION, // START, EXECUTING
039: Constants.Nd.BAD_TRANSITION, // START, EXECUTED
040: Constants.Nd.BAD_TRANSITION, // START, INERROR
041: Constants.Nd.BAD_TRANSITION, // START, FINISHED
042: Constants.Nd.BAD_TRANSITION, // START, TERMINATED
043: Constants.Nd.BAD_TRANSITION, // START, CHECKEDOUT
044: Constants.Nd.BAD_TRANSITION, // START, ANT_SUSPENDED
045: Constants.Nd.BAD_TRANSITION, // START, EXEC_SUSPENDED
046: }, { Constants.Nd.BAD_TRANSITION, // TERMINATE, INITIAL
047: Constants.Nd.BAD_TRANSITION, // TERMINATE, READY
048: Constants.Nd.BAD_TRANSITION, // TERMINATE, DEAD
049: Constants.Nd.BAD_TRANSITION, // TERMINATE, ANTICIPABLE
050: Constants.Nd.BAD_TRANSITION, // TERMINATE, EXPIRED
051: Constants.Nd.BAD_TRANSITION, // TERMINATE, ANTICIPATING
052: Constants.Nd.BAD_TRANSITION, // TERMINATE, EXECUTING
053: Constants.Nd.BAD_TRANSITION, // TERMINATE, EXECUTED
054: Constants.Nd.BAD_TRANSITION, // TERMINATE, INERROR
055: Constants.Nd.BAD_TRANSITION, // TERMINATE, FINISHED
056: Constants.Nd.BAD_TRANSITION, // TERMINATE, TERMINATED
057: Constants.Nd.BAD_TRANSITION, // TERMINATE, CHECKEDOUT
058: Constants.Nd.BAD_TRANSITION, // TERMINATE, ANT_SUSPENDED
059: Constants.Nd.BAD_TRANSITION, // TERMINATE, EXEC_SUSPENDED
060: }, { Constants.Nd.BAD_TRANSITION, // SUSPEND, INITIAL
061: Constants.Nd.BAD_TRANSITION, // SUSPEND, READY
062: Constants.Nd.BAD_TRANSITION, // SUSPEND, DEAD
063: Constants.Nd.BAD_TRANSITION, // SUSPEND, ANTICIPABLE
064: Constants.Nd.BAD_TRANSITION, // SUSPEND, EXPIRED
065: Constants.Nd.BAD_TRANSITION, // SUSPEND, ANTICIPATING
066: Constants.Nd.BAD_TRANSITION, // SUSPEND, EXECUTING
067: Constants.Nd.BAD_TRANSITION, // SUSPEND, EXECUTED
068: Constants.Nd.BAD_TRANSITION, // SUSPEND, INERROR
069: Constants.Nd.BAD_TRANSITION, // SUSPEND, FINISHED
070: Constants.Nd.BAD_TRANSITION, // SUSPEND, TERMINATED
071: Constants.Nd.BAD_TRANSITION, // SUSPEND, CHECKEDOUT
072: Constants.Nd.BAD_TRANSITION, // SUSPEND, ANT_SUSPENDED
073: Constants.Nd.BAD_TRANSITION, // SUSPEND, EXEC_SUSPENDED
074: }, { Constants.Nd.BAD_TRANSITION, // RESUME, INITIAL
075: Constants.Nd.BAD_TRANSITION, // RESUME, READY
076: Constants.Nd.BAD_TRANSITION, // RESUME, DEAD
077: Constants.Nd.BAD_TRANSITION, // RESUME, ANTICIPABLE
078: Constants.Nd.BAD_TRANSITION, // RESUME, EXPIRED
079: Constants.Nd.BAD_TRANSITION, // RESUME, ANTICIPATING
080: Constants.Nd.BAD_TRANSITION, // RESUME, EXECUTING
081: Constants.Nd.BAD_TRANSITION, // RESUME, EXECUTED
082: Constants.Nd.BAD_TRANSITION, // RESUME, INERROR
083: Constants.Nd.BAD_TRANSITION, // RESUME, FINISHED
084: Constants.Nd.BAD_TRANSITION, // RESUME, TERMINATED
085: Constants.Nd.BAD_TRANSITION, // RESUME, CHECKEDOUT
086: Constants.Nd.BAD_TRANSITION, // RESUME, ANT_SUSPENDED
087: Constants.Nd.BAD_TRANSITION, // RESUME, EXEC_SUSPENDED
088: }, { Constants.Nd.INITIAL, // EDGEINITIAL, INITIAL
089: Constants.Nd.INITIAL, // EDGEINITIAL, READY
090: Constants.Nd.BAD_TRANSITION, // EDGEINITIAL, DEAD
091: Constants.Nd.INITIAL, // EDGEINITIAL, ANTICIPABLE
092: Constants.Nd.BAD_TRANSITION, // EDGEINITIAL, EXPIRED
093: Constants.Nd.BAD_TRANSITION, // EDGEINITIAL, ANTICIPATING
094: Constants.Nd.BAD_TRANSITION, // EDGEINITIAL, EXECUTING
095: Constants.Nd.BAD_TRANSITION, // EDGEINITIAL, EXECUTED
096: Constants.Nd.BAD_TRANSITION, // EDGEINITIAL, INERROR
097: Constants.Nd.BAD_TRANSITION, // EDGEINITIAL, FINISHED
098: Constants.Nd.BAD_TRANSITION, // EDGEINITIAL, TERMINATED
099: Constants.Nd.BAD_TRANSITION, // EDGEINITIAL, CHECKEDOUT
100: Constants.Nd.BAD_TRANSITION, // EDGEINITIAL, ANT_SUSPENDED
101: Constants.Nd.BAD_TRANSITION, // EDGEINITIAL, EXEC_SUSPENDED
102: }, { Constants.Nd.ANTICIPATING, // ANTACTIVE, INITIAL
103: Constants.Nd.ANTICIPATING, // ANTACTIVE, READY
104: Constants.Nd.BAD_TRANSITION, // ANTACTIVE, DEAD
105: Constants.Nd.ANTICIPATING, // ANTACTIVE, ANTICIPABLE
106: Constants.Nd.BAD_TRANSITION, // ANTACTIVE, EXPIRED
107: Constants.Nd.ANTICIPATING, // ANTACTIVE, ANTICIPATING
108: Constants.Nd.ANTICIPATING, // ANTACTIVE, EXECUTING
109: Constants.Nd.BAD_TRANSITION, // ANTACTIVE, EXECUTED
110: Constants.Nd.BAD_TRANSITION, // ANTACTIVE, INERROR
111: Constants.Nd.BAD_TRANSITION, // ANTACTIVE, FINISHED
112: Constants.Nd.TERMINATED, // ANTACTIVE, TERMINATED
113: Constants.Nd.BAD_TRANSITION, // ANTACTIVE, CHECKEDOUT
114: Constants.Nd.BAD_TRANSITION, // ANTACTIVE, ANT_SUSPENDED
115: Constants.Nd.BAD_TRANSITION, // ANTACTIVE, EXEC_SUSPENDED
116: }, { Constants.Nd.TERMINATED, // ACTIVE, INITIAL
117: Constants.Nd.TERMINATED, // ACTIVE, READY
118: Constants.Nd.BAD_TRANSITION, // ACTIVE, DEAD
119: Constants.Nd.BAD_TRANSITION, // ACTIVE, ANTICIPABLE
120: Constants.Nd.BAD_TRANSITION, // ACTIVE, EXPIRED
121: Constants.Nd.TERMINATED, // ACTIVE, ANTICIPATING
122: Constants.Nd.TERMINATED, // ACTIVE, EXECUTING
123: Constants.Nd.BAD_TRANSITION, // ACTIVE, EXECUTED
124: Constants.Nd.BAD_TRANSITION, // ACTIVE, INERROR
125: Constants.Nd.BAD_TRANSITION, // ACTIVE, FINISHED
126: Constants.Nd.TERMINATED, // ACTIVE, TERMINATED
127: Constants.Nd.BAD_TRANSITION, // ACTIVE, CHECKEDOUT
128: Constants.Nd.BAD_TRANSITION, // ACTIVE, ANT_SUSPENDED
129: Constants.Nd.BAD_TRANSITION, // ACTIVE, EXEC_SUSPENDED
130: }, { Constants.Nd.DEAD, // CANCEL, INITIAL
131: Constants.Nd.DEAD, // CANCEL, READY
132: Constants.Nd.DEAD, // CANCEL, DEAD
133: Constants.Nd.BAD_TRANSITION, // CANCEL, ANTICIPABLE
134: Constants.Nd.BAD_TRANSITION, // CANCEL, EXPIRED
135: Constants.Nd.DEAD, // CANCEL, ANTICIPATING
136: Constants.Nd.DEAD, // CANCEL, EXECUTING
137: Constants.Nd.BAD_TRANSITION, // CANCEL, EXECUTED
138: Constants.Nd.BAD_TRANSITION, // CANCEL, INERROR
139: Constants.Nd.BAD_TRANSITION, // CANCEL, FINISHED
140: Constants.Nd.BAD_TRANSITION, // CANCEL, TERMINATED
141: Constants.Nd.BAD_TRANSITION, // CANCEL, CHECKEDOUT
142: Constants.Nd.BAD_TRANSITION, // CANCEL, ANT_SUSPENDED
143: Constants.Nd.BAD_TRANSITION, // CANCEL, EXEC_SUSPENDED
144: } };
145:
146: public AutomaticNodeState() {
147: }
148:
149: public int computeState(BnNodeLocal node, int operation) {
150: return nodeTransition[operation][node.getState()];
151: }
152:
153: }
|