Clover Coverage Report - KS Common 1.3.0-SNAPSHOT (Aggregated)
Coverage timestamp: Thu Apr 28 2011 06:00:36 EDT
../../../../../../../img/srcFileCovDistChart0.png 0% of files have more coverage
13   153   16   1
6   55   1.23   13
13     1.23  
1    
 
  BooleanNode       Line # 24 13 0% 16 32 0% 0.0
 
No Tests
 
1    /**
2    * Copyright 2010 The Kuali Foundation Licensed under the
3    * Educational Community License, Version 2.0 (the "License"); you may
4    * not use this file except in compliance with the License. You may
5    * obtain a copy of the License at
6    *
7    * http://www.osedu.org/licenses/ECL-2.0
8    *
9    * Unless required by applicable law or agreed to in writing,
10    * software distributed under the License is distributed on an "AS IS"
11    * BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
12    * or implied. See the License for the specific language governing
13    * permissions and limitations under the License.
14    */
15   
16    package org.kuali.student.common.messagebuilder.booleanmessage.ast;
17   
18    import org.antlr.runtime.Token;
19    import org.antlr.runtime.tree.CommonTree;
20   
21    /**
22    * This class is a boolean node in a binary tree.
23    */
 
24    public class BooleanNode extends CommonTree {
25   
26    private BooleanNode parent;
27    private Boolean value;
28    private String nodeMessage;
29    private String language;
30   
31    /**
32    * Construct a boolean node for a particular token in a binary tree.
33    * Tokens are +, *, (, ) and propositions e.g. tokens: (M1*M2)+M3
34    * See BooleanFunctionParser.java
35    *
36    * @param payload Node token
37    */
 
38  0 toggle public BooleanNode(Token payload) {
39  0 super(payload);
40    }
41   
42    /**
43    * Gets the parent boolean node.
44    *
45    * @return Parent boolean node
46    */
 
47  0 toggle public BooleanNode getParent(){
48  0 return parent;
49    }
50   
51    /**
52    * Gets the b-tree left node.
53    *
54    * @return B-tree left boolean node
55    */
 
56  0 toggle public BooleanNode getLeftNode(){
57  0 return (BooleanNode) this.getChild(0);
58    }
59   
60    /**
61    * Gets the b-tree right node.
62    *
63    * @return B-tree right boolean node
64    */
 
65  0 toggle public BooleanNode getRightNode(){
66  0 return (BooleanNode) this.getChild(1);
67    }
68   
69    /**
70    * Gets the label of the node.
71    *
72    * @return Node label
73    */
 
74  0 toggle public String getLabel(){
75  0 return this.getText();
76    }
77   
78    /**
79    * Gets the boolean value (true or false).
80    *
81    * @return Boolean value
82    */
 
83  0 toggle public Boolean getValue(){
84  0 return value;
85    }
86   
87    /**
88    * Gets the node message.
89    *
90    * @return Node message
91    */
 
92  0 toggle public String getNodeMessage(){
93  0 return nodeMessage;
94    }
95   
96    /**
97    * Gets the message language.
98    *
99    * @return Message language
100    */
 
101  0 toggle public String getLanguage() {
102  0 return language;
103    }
104   
105    /**
106    * org.antlr.runtime.tree.CommonTree.getParent() is not implemented
107    * you have to set the parent yourself, BinaryMessageTree.java
108    *
109    * @param parent Parent node
110    */
 
111  0 toggle public void setParent(BooleanNode parent){
112  0 this.parent = parent;
113    }
114   
115    /**
116    * Sets the boolean value (true or false).
117    *
118    * @param value Boolean value
119    */
 
120  0 toggle public void setValue(Boolean value){
121  0 this.value = value;
122    }
123   
124    /**
125    * Sets the node message.
126    *
127    * @param nodeMessage Node message
128    */
 
129  0 toggle public void setNodeMessage(String nodeMessage){
130  0 this.nodeMessage = nodeMessage;
131    }
132   
133    /**
134    * Sets the message language.
135    *
136    * @param language Message language
137    */
 
138  0 toggle public void setLanguage(String language) {
139  0 this.language = language;
140    }
141   
 
142  0 toggle @Override
143    public String toString() {
144  0 return "BooleanNode["
145    + "label=" + getLabel()
146    + ", value=" + value
147  0 + ", leftNodeLabel=" + (getLeftNode() == null ? null : getLeftNode().getLabel())
148  0 + ", rightNodeLabel=" + (getRightNode() == null ? null : getRightNode().getLabel())
149  0 + ", parentLabel=" + (parent == null ? null : parent.getLabel())
150    + "]";
151    }
152   
153    }