1 21 package com.db4o.nativequery.expr.cmp; 22 23 24 public class FieldValue extends ComparisonOperandDescendant { 25 26 private String _fieldName; 27 28 private Object _tag; 29 30 public FieldValue(ComparisonOperandAnchor root, String name) { 31 this(root, name, null); 32 } 33 34 public FieldValue(ComparisonOperandAnchor root, String name, Object tag) { 35 super(root); 36 _fieldName=name; 37 _tag=tag; 38 } 39 40 public String fieldName() { 41 return _fieldName; 42 } 43 44 public boolean equals(Object other) { 45 if(!super.equals(other)) { 46 return false; 47 } 48 FieldValue casted = (FieldValue) other; 49 if(_tag==null) { 50 if(casted._tag!=null) { 51 return false; 52 } 53 } 54 else { 55 if(!_tag.equals(casted._tag)) { 56 return false; 57 } 58 } 59 return _fieldName.equals(casted._fieldName); 60 } 61 62 public int hashCode() { 63 int hash=super.hashCode()*29+_fieldName.hashCode(); 64 if(_tag!=null) { 65 hash*=29+_tag.hashCode(); 66 } 67 return hash; 68 } 69 70 public String toString() { 71 return super.toString()+"."+_fieldName; 72 } 73 74 public void accept(ComparisonOperandVisitor visitor) { 75 visitor.visit(this); 76 } 77 78 84 public Object tag() { 85 return _tag; 86 } 87 88 public void tag(Object value) { 89 _tag = value; 90 } 91 } 92 | Popular Tags |