KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > hero > entity > NodeState


1 package hero.entity;
2
3 /*
4 *
5 * NodeState.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
26 import hero.interfaces.BnNodeLocal;
27
28 public abstract class NodeState {
29
30     public static final int START=0;
31     public static final int TERMINATE=1;
32     public static final int SUSPEND=2;
33     public static final int RESUME=3;
34     public static final int EDGEINITIAL=4;
35     public static final int ANTACTIVE=5;
36     public static final int ACTIVE=6;
37     public static final int CANCEL=7;
38
39     public static NodeState make(int type,boolean anticipable) {
40     if (anticipable) {
41         if(type == hero.interfaces.Constants.Nd.AND_JOIN_NODE) {return new ActivityNodeState();}
42         if(type == hero.interfaces.Constants.Nd.OR_JOIN_NODE) {return new ActivityNodeState();}
43         if(type == hero.interfaces.Constants.Nd.AND_JOIN_AUTOMATIC_NODE) {return new AutomaticNodeState();}
44         if(type == hero.interfaces.Constants.Nd.OR_JOIN_AUTOMATIC_NODE) {return new AutomaticNodeState();}
45         if(type == hero.interfaces.Constants.Nd.SUB_PROCESS_NODE) {return new AutomaticSubNodeState();}
46     } else {
47         if(type == hero.interfaces.Constants.Nd.AND_JOIN_NODE) {return new TraditionalNodeState();}
48         if(type == hero.interfaces.Constants.Nd.OR_JOIN_NODE) {return new TraditionalNodeState();}
49         if(type == hero.interfaces.Constants.Nd.AND_JOIN_AUTOMATIC_NODE) {return new TraditionalAutomaticNodeState();}
50         if(type == hero.interfaces.Constants.Nd.OR_JOIN_AUTOMATIC_NODE) {return new TraditionalAutomaticNodeState();}
51         if(type == hero.interfaces.Constants.Nd.SUB_PROCESS_NODE) {return new AutomaticSubNodeState();}
52     }
53     return new ActivityNodeState();
54     }
55
56     public abstract int computeState(BnNodeLocal nd,int operation);
57
58 }
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
Popular Tags