KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > hero > entity > AutomaticNodeState


1 package hero.entity;
2 /*
3 * 02/11/2002 - 17:31:40
4 *
5 * AutomaticNodeState.java -
6 * Copyright (C) 2002 Ecoo Team
7 * charoy@loria.fr
8 *
9 *
10 * This program is free software; you can redistribute it and/or
11 * modify it under the terms of the GNU Lesser General Public License
12 * as published by the Free Software Foundation; either version 2
13 * of the License, or (at your option) any later version.
14 *
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU Lesser General Public License for more details.
19 *
20 * You should have received a copy of the GNU Lesser General Public License
21 * along with this program; if not, write to the Free Software
22 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
23 */

24 import hero.interfaces.BnNodeLocal;
25 import hero.interfaces.Constants;
26
27 import org.apache.log4j.Category;
28
29 public class AutomaticNodeState extends NodeState implements java.io.Serializable JavaDoc {
30
31     // Utility variable
32
private static final Category log = Category.getInstance(AutomaticNodeState.class);
33
34
35     private static int[][] nodeTransition= {
36     {
37         Constants.Nd.BAD_TRANSITION, // START, INITIAL
38
Constants.Nd.TERMINATED, // START, READY
39
Constants.Nd.BAD_TRANSITION, // START, DEAD
40
Constants.Nd.BAD_TRANSITION, // START, ANTICIPABLE
41
Constants.Nd.BAD_TRANSITION, // START, EXPIRED
42
Constants.Nd.BAD_TRANSITION, // START, ANTICIPATING
43
Constants.Nd.BAD_TRANSITION, // START, EXECUTING
44
Constants.Nd.BAD_TRANSITION, // START, EXECUTED
45
Constants.Nd.BAD_TRANSITION, // START, INERROR
46
Constants.Nd.BAD_TRANSITION, // START, FINISHED
47
Constants.Nd.BAD_TRANSITION, // START, TERMINATED
48
Constants.Nd.BAD_TRANSITION, // START, CHECKEDOUT
49
Constants.Nd.BAD_TRANSITION, // START, ANT_SUSPENDED
50
Constants.Nd.BAD_TRANSITION, // START, EXEC_SUSPENDED
51
},{
52         Constants.Nd.BAD_TRANSITION, // TERMINATE, INITIAL
53
Constants.Nd.BAD_TRANSITION, // TERMINATE, READY
54
Constants.Nd.BAD_TRANSITION, // TERMINATE, DEAD
55
Constants.Nd.BAD_TRANSITION, // TERMINATE, ANTICIPABLE
56
Constants.Nd.BAD_TRANSITION, // TERMINATE, EXPIRED
57
Constants.Nd.BAD_TRANSITION, // TERMINATE, ANTICIPATING
58
Constants.Nd.BAD_TRANSITION, // TERMINATE, EXECUTING
59
Constants.Nd.BAD_TRANSITION, // TERMINATE, EXECUTED
60
Constants.Nd.BAD_TRANSITION, // TERMINATE, INERROR
61
Constants.Nd.BAD_TRANSITION, // TERMINATE, FINISHED
62
Constants.Nd.BAD_TRANSITION, // TERMINATE, TERMINATED
63
Constants.Nd.BAD_TRANSITION, // TERMINATE, CHECKEDOUT
64
Constants.Nd.BAD_TRANSITION, // TERMINATE, ANT_SUSPENDED
65
Constants.Nd.BAD_TRANSITION, // TERMINATE, EXEC_SUSPENDED
66
},{
67         Constants.Nd.BAD_TRANSITION, // SUSPEND, INITIAL
68
Constants.Nd.BAD_TRANSITION, // SUSPEND, READY
69
Constants.Nd.BAD_TRANSITION, // SUSPEND, DEAD
70
Constants.Nd.BAD_TRANSITION, // SUSPEND, ANTICIPABLE
71
Constants.Nd.BAD_TRANSITION, // SUSPEND, EXPIRED
72
Constants.Nd.BAD_TRANSITION, // SUSPEND, ANTICIPATING
73
Constants.Nd.BAD_TRANSITION, // SUSPEND, EXECUTING
74
Constants.Nd.BAD_TRANSITION, // SUSPEND, EXECUTED
75
Constants.Nd.BAD_TRANSITION, // SUSPEND, INERROR
76
Constants.Nd.BAD_TRANSITION, // SUSPEND, FINISHED
77
Constants.Nd.BAD_TRANSITION, // SUSPEND, TERMINATED
78
Constants.Nd.BAD_TRANSITION, // SUSPEND, CHECKEDOUT
79
Constants.Nd.BAD_TRANSITION, // SUSPEND, ANT_SUSPENDED
80
Constants.Nd.BAD_TRANSITION, // SUSPEND, EXEC_SUSPENDED
81
},{
82         Constants.Nd.BAD_TRANSITION, // RESUME, INITIAL
83
Constants.Nd.BAD_TRANSITION, // RESUME, READY
84
Constants.Nd.BAD_TRANSITION, // RESUME, DEAD
85
Constants.Nd.BAD_TRANSITION, // RESUME, ANTICIPABLE
86
Constants.Nd.BAD_TRANSITION, // RESUME, EXPIRED
87
Constants.Nd.BAD_TRANSITION, // RESUME, ANTICIPATING
88
Constants.Nd.BAD_TRANSITION, // RESUME, EXECUTING
89
Constants.Nd.BAD_TRANSITION, // RESUME, EXECUTED
90
Constants.Nd.BAD_TRANSITION, // RESUME, INERROR
91
Constants.Nd.BAD_TRANSITION, // RESUME, FINISHED
92
Constants.Nd.BAD_TRANSITION, // RESUME, TERMINATED
93
Constants.Nd.BAD_TRANSITION, // RESUME, CHECKEDOUT
94
Constants.Nd.BAD_TRANSITION, // RESUME, ANT_SUSPENDED
95
Constants.Nd.BAD_TRANSITION, // RESUME, EXEC_SUSPENDED
96
},{
97         Constants.Nd.INITIAL, // EDGEINITIAL, INITIAL
98
Constants.Nd.INITIAL, // EDGEINITIAL, READY
99
Constants.Nd.BAD_TRANSITION, // EDGEINITIAL, DEAD
100
Constants.Nd.INITIAL, // EDGEINITIAL, ANTICIPABLE
101
Constants.Nd.BAD_TRANSITION, // EDGEINITIAL, EXPIRED
102
Constants.Nd.BAD_TRANSITION, // EDGEINITIAL, ANTICIPATING
103
Constants.Nd.BAD_TRANSITION, // EDGEINITIAL, EXECUTING
104
Constants.Nd.BAD_TRANSITION, // EDGEINITIAL, EXECUTED
105
Constants.Nd.BAD_TRANSITION, // EDGEINITIAL, INERROR
106
Constants.Nd.BAD_TRANSITION, // EDGEINITIAL, FINISHED
107
Constants.Nd.BAD_TRANSITION, // EDGEINITIAL, TERMINATED
108
Constants.Nd.BAD_TRANSITION, // EDGEINITIAL, CHECKEDOUT
109
Constants.Nd.BAD_TRANSITION, // EDGEINITIAL, ANT_SUSPENDED
110
Constants.Nd.BAD_TRANSITION, // EDGEINITIAL, EXEC_SUSPENDED
111
},{
112         Constants.Nd.ANTICIPATING, // ANTACTIVE, INITIAL
113
Constants.Nd.ANTICIPATING, // ANTACTIVE, READY
114
Constants.Nd.BAD_TRANSITION, // ANTACTIVE, DEAD
115
Constants.Nd.ANTICIPATING, // ANTACTIVE, ANTICIPABLE
116
Constants.Nd.BAD_TRANSITION, // ANTACTIVE, EXPIRED
117
Constants.Nd.ANTICIPATING, // ANTACTIVE, ANTICIPATING
118
Constants.Nd.ANTICIPATING, // ANTACTIVE, EXECUTING
119
Constants.Nd.BAD_TRANSITION, // ANTACTIVE, EXECUTED
120
Constants.Nd.BAD_TRANSITION, // ANTACTIVE, INERROR
121
Constants.Nd.BAD_TRANSITION, // ANTACTIVE, FINISHED
122
Constants.Nd.TERMINATED, // ANTACTIVE, TERMINATED
123
Constants.Nd.BAD_TRANSITION, // ANTACTIVE, CHECKEDOUT
124
Constants.Nd.BAD_TRANSITION, // ANTACTIVE, ANT_SUSPENDED
125
Constants.Nd.BAD_TRANSITION, // ANTACTIVE, EXEC_SUSPENDED
126
},{
127         Constants.Nd.TERMINATED, // ACTIVE, INITIAL
128
Constants.Nd.TERMINATED, // ACTIVE, READY
129
Constants.Nd.BAD_TRANSITION, // ACTIVE, DEAD
130
Constants.Nd.BAD_TRANSITION, // ACTIVE, ANTICIPABLE
131
Constants.Nd.BAD_TRANSITION, // ACTIVE, EXPIRED
132
Constants.Nd.TERMINATED, // ACTIVE, ANTICIPATING
133
Constants.Nd.TERMINATED, // ACTIVE, EXECUTING
134
Constants.Nd.BAD_TRANSITION, // ACTIVE, EXECUTED
135
Constants.Nd.BAD_TRANSITION, // ACTIVE, INERROR
136
Constants.Nd.BAD_TRANSITION, // ACTIVE, FINISHED
137
Constants.Nd.TERMINATED, // ACTIVE, TERMINATED
138
Constants.Nd.BAD_TRANSITION, // ACTIVE, CHECKEDOUT
139
Constants.Nd.BAD_TRANSITION, // ACTIVE, ANT_SUSPENDED
140
Constants.Nd.BAD_TRANSITION, // ACTIVE, EXEC_SUSPENDED
141
},{
142         Constants.Nd.DEAD, // CANCEL, INITIAL
143
Constants.Nd.DEAD, // CANCEL, READY
144
Constants.Nd.DEAD, // CANCEL, DEAD
145
Constants.Nd.BAD_TRANSITION, // CANCEL, ANTICIPABLE
146
Constants.Nd.BAD_TRANSITION, // CANCEL, EXPIRED
147
Constants.Nd.DEAD, // CANCEL, ANTICIPATING
148
Constants.Nd.DEAD, // CANCEL, EXECUTING
149
Constants.Nd.BAD_TRANSITION, // CANCEL, EXECUTED
150
Constants.Nd.BAD_TRANSITION, // CANCEL, INERROR
151
Constants.Nd.BAD_TRANSITION, // CANCEL, FINISHED
152
Constants.Nd.BAD_TRANSITION, // CANCEL, TERMINATED
153
Constants.Nd.BAD_TRANSITION, // CANCEL, CHECKEDOUT
154
Constants.Nd.BAD_TRANSITION, // CANCEL, ANT_SUSPENDED
155
Constants.Nd.BAD_TRANSITION, // CANCEL, EXEC_SUSPENDED
156
}
157     };
158
159     public AutomaticNodeState() {
160     }
161
162     public int computeState(BnNodeLocal node,int operation) {
163     log.debug("computeState: node="+node.getName()+" operation="+Constants.Nd.operationName[operation]);
164     return nodeTransition[operation][node.getState()];
165     }
166     
167     
168 }
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
Popular Tags