org.relaxng.datatype.helpers
Class ValueSet

java.lang.Object
  |
  +--java.util.AbstractCollection
        |
        +--java.util.AbstractSet
              |
              +--org.relaxng.datatype.helpers.ValueSet
All Implemented Interfaces:
java.util.Collection, java.util.Set

public final class ValueSet
extends java.util.AbstractSet

A Set implementation for value objects of datatypes.

Since the value objects of datatypes do not implement the hashCode method and the equals method correctly, normal collection classes like Hashtable or HashSet cannot be used.

This class implements a set who behaves consistently with the equality notion of the specified datatype.

To achieve that, this class wraps value objects by the wrapper, and stores it to a ordinary set. The wrapper implements the hashCode method and the equals method in the expected way.

Author:
Kohsuke KAWAGUCHI

Method Summary
 boolean add(java.lang.Object o)
           
 boolean contains(java.lang.Object o)
           
 java.util.Iterator iterator()
           
 boolean remove(java.lang.Object o)
           
 int size()
           
 
Methods inherited from class java.util.AbstractSet
equals, hashCode, removeAll
 
Methods inherited from class java.util.AbstractCollection
addAll, clear, containsAll, isEmpty, retainAll, toArray, toArray, toString
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.util.Set
addAll, clear, containsAll, isEmpty, retainAll, toArray, toArray
 

Method Detail

iterator

public java.util.Iterator iterator()
Overrides:
iterator in class java.util.AbstractCollection

size

public int size()
Overrides:
size in class java.util.AbstractCollection

add

public boolean add(java.lang.Object o)
Overrides:
add in class java.util.AbstractCollection

contains

public boolean contains(java.lang.Object o)
Overrides:
contains in class java.util.AbstractCollection

remove

public boolean remove(java.lang.Object o)
Overrides:
remove in class java.util.AbstractCollection