1 30 package com.genimen.djeneric.tools.scriptengine.core.nodes; 31 32 import java.util.HashMap ; 33 34 import com.genimen.djeneric.tools.scriptengine.core.DjScriptParserEngine; 35 import com.genimen.djeneric.tools.scriptengine.core.SimpleNode; 36 import com.genimen.djeneric.tools.scriptengine.core.util.DjScriptCompileTimeScope; 37 import com.genimen.djeneric.tools.scriptengine.core.util.DjScriptExecutionException; 38 import com.genimen.djeneric.tools.scriptengine.core.util.DjScriptExecutionTimeScope; 39 40 public class BoolNode extends SimpleNode implements BooleanExpression 41 { 42 private Boolean booleanValue; 43 44 public BoolNode(int i) 45 { 46 super(i); 47 } 48 49 public BoolNode(DjScriptParserEngine p, int i) 50 { 51 super(p, i); 52 } 53 54 public String getName() 55 { 56 return toString(); 57 } 58 59 public String toString() 60 { 61 return booleanValue.toString(); 62 } 63 64 public void setValue(boolean value) 65 { 66 booleanValue = new Boolean (value); 67 } 68 69 public Object getValue(DjScriptExecutionTimeScope context) 70 { 71 return booleanValue; 72 } 73 74 public boolean isTrue() 75 { 76 return booleanValue.booleanValue(); 77 } 78 79 public boolean isTrue(DjScriptExecutionTimeScope context) 80 { 81 return booleanValue.booleanValue(); 82 } 83 84 public void translateOql(DjScriptExecutionTimeScope ctxt, StringBuffer result, HashMap parameters) 85 { 86 if (isTrue()) result.append("1"); 87 else result.append("0"); 88 } 89 90 public String getValidatedTypeName(DjScriptCompileTimeScope context) throws DjScriptExecutionException 91 { 92 return Boolean .class.getName(); 93 } 94 } | Popular Tags |