Clover Coverage Report - KS Common 1.1-SNAPSHOT (Aggregated)
Coverage timestamp: Thu Mar 3 2011 04:37:11 EST
../../../../../../../img/srcFileCovDistChart9.png 18% of files have more coverage
13   153   16   1
6   55   1.23   13
13     1.23  
1    
 
  BooleanNode       Line # 24 13 0% 16 3 90.6% 0.90625
 
  (65)
 
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  1205 toggle public BooleanNode(Token payload) {
39  1205 super(payload);
40    }
41   
42    /**
43    * Gets the parent boolean node.
44    *
45    * @return Parent boolean node
46    */
 
47  408 toggle public BooleanNode getParent(){
48  408 return parent;
49    }
50   
51    /**
52    * Gets the b-tree left node.
53    *
54    * @return B-tree left boolean node
55    */
 
56  827 toggle public BooleanNode getLeftNode(){
57  827 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  648 toggle public BooleanNode getRightNode(){
66  648 return (BooleanNode) this.getChild(1);
67    }
68   
69    /**
70    * Gets the label of the node.
71    *
72    * @return Node label
73    */
 
74  1591 toggle public String getLabel(){
75  1591 return this.getText();
76    }
77   
78    /**
79    * Gets the boolean value (true or false).
80    *
81    * @return Boolean value
82    */
 
83  677 toggle public Boolean getValue(){
84  677 return value;
85    }
86   
87    /**
88    * Gets the node message.
89    *
90    * @return Node message
91    */
 
92  916 toggle public String getNodeMessage(){
93  916 return nodeMessage;
94    }
95   
96    /**
97    * Gets the message language.
98    *
99    * @return Message language
100    */
 
101  1 toggle public String getLanguage() {
102  1 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  354 toggle public void setParent(BooleanNode parent){
112  354 this.parent = parent;
113    }
114   
115    /**
116    * Sets the boolean value (true or false).
117    *
118    * @param value Boolean value
119    */
 
120  227 toggle public void setValue(Boolean value){
121  227 this.value = value;
122    }
123   
124    /**
125    * Sets the node message.
126    *
127    * @param nodeMessage Node message
128    */
 
129  334 toggle public void setNodeMessage(String nodeMessage){
130  334 this.nodeMessage = nodeMessage;
131    }
132   
133    /**
134    * Sets the message language.
135    *
136    * @param language Message language
137    */
 
138  180 toggle public void setLanguage(String language) {
139  180 this.language = language;
140    }
141   
 
142  8 toggle @Override
143    public String toString() {
144  8 return "BooleanNode["
145    + "label=" + getLabel()
146    + ", value=" + value
147  8 + ", leftNodeLabel=" + (getLeftNode() == null ? null : getLeftNode().getLabel())
148  8 + ", rightNodeLabel=" + (getRightNode() == null ? null : getRightNode().getLabel())
149  8 + ", parentLabel=" + (parent == null ? null : parent.getLabel())
150    + "]";
151    }
152   
153    }