1 package hero.entity; 2 3 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 |