1 package com.calipso.reportgenerator.reportcalculator.expression; 2 3 import java.util.Set ; 4 import java.util.HashSet ; 5 import java.io.Serializable ; 6 7 10 public class VariableExp extends Expression implements Serializable { 11 Object reference; 12 13 14 20 public VariableExp(Object aReference) { 21 reference = aReference; 22 } 23 24 29 public boolean equals(Object o) { 30 if (this == o) return true; 31 if (!(o instanceof VariableExp)) return false; 32 33 final VariableExp variableExp = (VariableExp) o; 34 35 if (!reference.equals(variableExp.reference)) return false; 36 37 return true; 38 } 39 40 44 public int hashCode() { 45 return reference.hashCode(); 46 } 47 48 52 public Object getReference() { 53 return reference; 54 } 55 56 60 public void setReference(Object reference) { 61 this.reference = reference; 62 } 63 64 68 69 protected Set variables() { 70 Set variables; 71 72 variables = new HashSet (); 73 variables.add(this); 74 return variables; 75 } 76 77 81 82 protected String basicAsString() { 83 return reference.toString(); 84 } 85 86 90 public boolean isVariable() { 91 return true; 92 } 93 94 99 public Object visitedBy(ExpressionVisitor visitor) { 100 return visitor.processVariable(this); 101 } 102 103 } 104 | Popular Tags |