1 package com.thaiopensource.relaxng.impl; 2 3 import org.relaxng.datatype.Datatype; 4 5 class DatatypeValue { 6 private final Object value; 7 private final Datatype dt; 8 9 DatatypeValue(Object value, Datatype dt) { 10 this.value = value; 11 this.dt = dt; 12 } 13 14 public int hashCode() { 15 return dt.hashCode() ^ dt.valueHashCode(value); 16 } 17 18 public boolean equals(Object obj) { 19 if (!(obj instanceof DatatypeValue)) 20 return false; 21 DatatypeValue other = (DatatypeValue)obj; 22 if (other.dt != dt) 23 return false; 24 return dt.sameValue(value, other.value); 25 } 26 } 27 | Popular Tags |