1 17 18 package SOFA.SOFAnode.Util.DFSRChecker.node; 19 20 21 import java.util.TreeMap ; 22 import java.util.TreeSet ; 23 24 25 import SOFA.SOFAnode.Util.DFSRChecker.state.State; 26 import SOFA.SOFAnode.Util.DFSRChecker.state.TransitionPair; 27 import SOFA.SOFAnode.Util.DFSRChecker.state.TransitionPairs; 28 import SOFA.SOFAnode.Util.DFSRChecker.utils.AnotatedProtocol; 29 30 33 public class ExplicitNode extends TreeNode { 34 35 36 public ExplicitNode(State initial, TreeMap transitions, TreeSet accepting, String protocol, TreeNode original) { 37 super(protocol); 38 this.initial = initial; 39 this.transitions = transitions; 40 this.accepting = accepting; 41 42 this.nodes = new TreeNode[0]; 43 this.original = original; 44 45 this.weight = 1; 46 } 47 48 51 public State getInitial() { 52 return initial; 53 } 54 55 59 public TransitionPairs getTransitions(State state) throws InvalidParameterException { 60 TransitionPair[] result = (TransitionPair[]) transitions.get(state); 61 if (result != null) 62 return new TransitionPairs(result); 63 else 64 return new TransitionPairs(new TransitionPair[0]); 65 66 } 67 68 72 public boolean isAccepting(SOFA.SOFAnode.Util.DFSRChecker.state.State state) { 73 return accepting.contains(state); 74 } 75 76 80 public long getWeight() { 81 return 1; 82 } 83 84 88 public TreeNode forwardCut(TreeSet livingevents) { 89 return this; 91 } 92 93 97 public TreeNode copy() { 98 return this; 100 } 101 102 105 public String [] getTypeName() { 106 String [] result = { "Explicit", "EXPLICIT" }; 107 return result; 108 } 109 110 113 public AnotatedProtocol getAnotatedProtocol(State state) { 114 return original.getAnotatedProtocol(state); 115 } 116 120 final private State initial; 121 122 125 private TreeNode original; 126 127 130 131 final private TreeMap transitions; 132 133 136 final private TreeSet accepting; 137 138 139 } | Popular Tags |