1 package com.genimen.djeneric.repository.oql.core.nodes; 2 3 import java.util.HashMap ; 4 5 import com.genimen.djeneric.repository.oql.core.DjOqlParserEngine; 6 import com.genimen.djeneric.repository.oql.core.SimpleNode; 7 8 public class BoolNode extends SimpleNode implements BooleanExpression, ValueExpression 9 { 10 private Boolean booleanValue; 11 12 public BoolNode(int i) 13 { 14 super(i); 15 } 16 17 public BoolNode(DjOqlParserEngine p, int i) 18 { 19 super(p, i); 20 } 21 22 public String getName() 23 { 24 return toString(); 25 } 26 27 public String toString() 28 { 29 return booleanValue.toString(); 30 } 31 32 public void setValue(boolean value) 33 { 34 booleanValue = new Boolean (value); 35 } 36 37 public boolean isTrue() 38 { 39 return booleanValue.booleanValue(); 40 } 41 42 public void translate(StringBuffer result, HashMap path2AliasMapping) 43 { 44 appendOpenBrackets(result); 45 if (isTrue()) result.append("1"); 46 else result.append("0"); 47 appendCloseBrackets(result); 48 } 49 50 public Object getValue(MatchingContext context) 51 { 52 return booleanValue; 53 } 54 55 public boolean isTrue(MatchingContext context) 56 { 57 return booleanValue.booleanValue(); 58 } 59 60 } | Popular Tags |