1 56 package org.objectstyle.cayenne.exp.parser; 57 58 import java.io.PrintWriter ; 59 60 import org.objectstyle.cayenne.exp.Expression; 61 62 68 public class ASTScalar extends SimpleNode { 69 protected Object value; 70 71 74 ASTScalar(int id) { 75 super(id); 76 } 77 78 public ASTScalar() { 79 super(ExpressionParserTreeConstants.JJTSCALAR); 80 } 81 82 public ASTScalar(Object value) { 83 super(ExpressionParserTreeConstants.JJTSCALAR); 84 setValue(value); 85 } 86 87 protected Object evaluateNode(Object o) throws Exception { 88 return value; 89 } 90 91 94 public Expression shallowCopy() { 95 ASTScalar copy = new ASTScalar(id); 96 copy.value = value; 97 return copy; 98 } 99 100 public void encodeAsString(PrintWriter pw) { 101 SimpleNode.encodeScalarAsString(pw, value); 102 } 103 104 public void setValue(Object value) { 105 this.value = value; 106 } 107 108 public Object getValue() { 109 return value; 110 } 111 112 protected String getExpressionOperator(int index) { 113 throw new UnsupportedOperationException ( 114 "No operator for '" + ExpressionParserTreeConstants.jjtNodeName[id] + "'"); 115 } 116 } 117 | Popular Tags |