KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > thaiopensource > relaxng > impl > DatatypeValue


1 package com.thaiopensource.relaxng.impl;
2
3 import org.relaxng.datatype.Datatype;
4
5 class DatatypeValue {
6   private final Object JavaDoc value;
7   private final Datatype dt;
8
9   DatatypeValue(Object JavaDoc 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 JavaDoc 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