org.castor.util
Class IdentitySet

java.lang.Object
  extended by org.castor.util.IdentitySet
All Implemented Interfaces:
java.lang.Iterable, java.util.Collection, java.util.Set

public final class IdentitySet
extends java.lang.Object
implements java.util.Set

An IdentitySet that uses reference-equality instead of object-equality. According to its special function it violates some design contracts of the Set interface.

Since:
0.9.9
Version:
$Revision: 1.3 $ $Date: 2005/07/24 20:37:15 $
Author:
Ralf Joachim

Nested Class Summary
 class IdentitySet.Entry
          An entry of the IdentitySet.
 
Constructor Summary
IdentitySet()
          Construct a set with default capacity.
IdentitySet(int capacity)
          Construct a set with given capacity.
 
Method Summary
 boolean add(java.lang.Object key)
           
 boolean addAll(java.util.Collection c)
          This optional method has not been implemented for IdentitySet instead it throws a UnsupportedOperationException as defined in the Set interface.
 void clear()
           
 boolean contains(java.lang.Object key)
           
 boolean containsAll(java.util.Collection c)
          In contrast with the design contract of the Set interface this method has not been implemented and throws a UnsupportedOperationException.
 boolean isEmpty()
           
 java.util.Iterator iterator()
           
 boolean remove(java.lang.Object key)
           
 boolean removeAll(java.util.Collection c)
          This optional method has not been implemented for IdentitySet instead it throws a UnsupportedOperationException as defined in the Set interface.
 boolean retainAll(java.util.Collection c)
          This optional method has not been implemented for IdentitySet instead it throws a UnsupportedOperationException as defined in the Set interface.
 int size()
           
 java.lang.Object[] toArray()
           
 java.lang.Object[] toArray(java.lang.Object[] a)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface java.util.Set
equals, hashCode
 

Constructor Detail

IdentitySet

public IdentitySet()
Construct a set with default capacity.


IdentitySet

public IdentitySet(int capacity)
Construct a set with given capacity.

Parameters:
capacity - The capacity of entries this set should be initialized with.
Method Detail

clear

public void clear()
Specified by:
clear in interface java.util.Collection
Specified by:
clear in interface java.util.Set
See Also:
Collection.clear()

size

public int size()
Specified by:
size in interface java.util.Collection
Specified by:
size in interface java.util.Set
See Also:
Collection.size()

isEmpty

public boolean isEmpty()
Specified by:
isEmpty in interface java.util.Collection
Specified by:
isEmpty in interface java.util.Set
See Also:
Collection.isEmpty()

add

public boolean add(java.lang.Object key)
Specified by:
add in interface java.util.Collection
Specified by:
add in interface java.util.Set
See Also:
Collection.add(java.lang.Object)

contains

public boolean contains(java.lang.Object key)
Specified by:
contains in interface java.util.Collection
Specified by:
contains in interface java.util.Set
See Also:
Collection.contains(java.lang.Object)

remove

public boolean remove(java.lang.Object key)
Specified by:
remove in interface java.util.Collection
Specified by:
remove in interface java.util.Set
See Also:
Collection.remove(java.lang.Object)

iterator

public java.util.Iterator iterator()
Specified by:
iterator in interface java.lang.Iterable
Specified by:
iterator in interface java.util.Collection
Specified by:
iterator in interface java.util.Set
See Also:
Collection.iterator()

toArray

public java.lang.Object[] toArray()
Specified by:
toArray in interface java.util.Collection
Specified by:
toArray in interface java.util.Set
See Also:
Collection.toArray()

toArray

public java.lang.Object[] toArray(java.lang.Object[] a)
Specified by:
toArray in interface java.util.Collection
Specified by:
toArray in interface java.util.Set
See Also:
Collection.toArray(java.lang.Object[])

containsAll

public boolean containsAll(java.util.Collection c)
In contrast with the design contract of the Set interface this method has not been implemented and throws a UnsupportedOperationException.

Specified by:
containsAll in interface java.util.Collection
Specified by:
containsAll in interface java.util.Set
See Also:
java.util.MSet#containsAll()

addAll

public boolean addAll(java.util.Collection c)
This optional method has not been implemented for IdentitySet instead it throws a UnsupportedOperationException as defined in the Set interface.

Specified by:
addAll in interface java.util.Collection
Specified by:
addAll in interface java.util.Set
See Also:
java.util.Set#addAll()

removeAll

public boolean removeAll(java.util.Collection c)
This optional method has not been implemented for IdentitySet instead it throws a UnsupportedOperationException as defined in the Set interface.

Specified by:
removeAll in interface java.util.Collection
Specified by:
removeAll in interface java.util.Set
See Also:
java.util.Set#removeAll()

retainAll

public boolean retainAll(java.util.Collection c)
This optional method has not been implemented for IdentitySet instead it throws a UnsupportedOperationException as defined in the Set interface.

Specified by:
retainAll in interface java.util.Collection
Specified by:
retainAll in interface java.util.Set
See Also:
java.util.Set#retainAll()


Intalio Inc. (C) 1999-2004. All rights reserved http://www.intalio.com