KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > hero > entity > ActivityNodeState


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