KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > SOFA > SOFAnode > Util > DFSRChecker > node > NullNode


1 /*
2  * $Id: NullNode.java,v 1.1 2005/07/13 07:27:49 kofron Exp $
3  *
4  * Copyright 2004
5  * Distributed Systems Research Group
6  * Department of Software Engineering
7  * Faculty of Mathematics and Physics
8  * Charles University, Prague
9  *
10  * Copyright 2005
11  * Formal Methods In Software Engineering Group
12  * Institute of Computer Science
13  * Academy of Sciences of the Czech Republic
14  *
15  * This code was developed by Jan Kofron <kofron@nenya.ms.mff.cuni.cz>
16  */

17
18 package SOFA.SOFAnode.Util.DFSRChecker.node;
19
20 import java.util.ArrayList JavaDoc;
21 import java.util.TreeSet JavaDoc;
22
23
24 import SOFA.SOFAnode.Util.DFSRChecker.DFSR.CheckingException;
25 import SOFA.SOFAnode.Util.DFSRChecker.state.SimpleState;
26 import SOFA.SOFAnode.Util.DFSRChecker.state.State;
27 import SOFA.SOFAnode.Util.DFSRChecker.state.TransitionPair;
28 import SOFA.SOFAnode.Util.DFSRChecker.state.TransitionPairs;
29 import SOFA.SOFAnode.Util.DFSRChecker.utils.AnotatedProtocol;
30
31
32 /**
33  * NullNode represents an empty protocol.
34  */

35 public class NullNode extends TreeNode {
36     
37     /**
38      * Creates a new instance of NullNode.
39      */

40     public NullNode() {
41         super("NULL");
42         
43         this.initial = new SimpleState(0);
44         this.transitions = new TransitionPairs(new TransitionPair[0]);
45         this.nodes = new TreeNode[0];
46     }
47
48     /**
49      * @see SOFA.SOFAnode.Util.objectweb.fractal.behprotocols.checker.node.TreeNode#getWeight()
50      */

51     public long getWeight() {
52         return 0;
53     }
54
55     /**
56      * @see SOFA.SOFAnode.Util.objectweb.fractal.behprotocols.checker.node.TreeNode#getInitial()
57      */

58     public State getInitial() {
59         return this.initial;
60     }
61
62     /**
63      * @see SOFA.SOFAnode.Util.objectweb.fractal.behprotocols.checker.node.TreeNode#isAccepting(SOFA.SOFAnode.Util.objectweb.fractal.behprotocols.checker.state.State)
64      */

65     public boolean isAccepting(State state) {
66         return true;
67     }
68
69     /**
70      * @see SOFA.SOFAnode.Util.objectweb.fractal.behprotocols.checker.node.TreeNode#getTransitions(SOFA.SOFAnode.Util.objectweb.fractal.behprotocols.checker.state.State)
71      */

72     public TransitionPairs getTransitions(State state) throws InvalidParameterException, CheckingException {
73         return transitions;
74     }
75
76     /**
77      * @see SOFA.SOFAnode.Util.objectweb.fractal.behprotocols.checker.node.TreeNode#getTypeName()
78      */

79     public String JavaDoc[] getTypeName() {
80         String JavaDoc result[] ={"NULL_node", "NULL"};
81         return result;
82     }
83     
84     /**
85      * @see SOFA.SOFAnode.Util.objectweb.fractal.behprotocols.checker.node.TreeNode#forwardCut(java.util.TreeSet)
86      */

87     public TreeNode forwardCut(TreeSet JavaDoc livingevents) {
88         return this;
89     }
90     
91     /**
92      * @see SOFA.SOFAnode.Util.objectweb.fractal.behprotocols.checker.node.TreeNode#getAnotatedProtocol(SOFA.SOFAnode.Util.objectweb.fractal.behprotocols.checker.state.State)
93      */

94     public AnotatedProtocol getAnotatedProtocol(State state) {
95         return new AnotatedProtocol("NULL", new ArrayList JavaDoc());
96     }
97     
98     /**
99      * The initial state (and the only state of this empty thing)
100      */

101     private SimpleState initial;
102     
103     /**
104      * An empty transition set
105      */

106     private TransitionPairs transitions;
107
108 }
109
Popular Tags