GNU Trove

gnu.trove.decorator
Class TDoubleSetDecorator

java.lang.Object
  extended by java.util.AbstractCollection<E>
      extended by java.util.AbstractSet<java.lang.Double>
          extended by gnu.trove.decorator.TDoubleSetDecorator
All Implemented Interfaces:
java.io.Externalizable, java.io.Serializable, java.lang.Iterable<java.lang.Double>, java.util.Collection<java.lang.Double>, java.util.Set<java.lang.Double>

public class TDoubleSetDecorator
extends java.util.AbstractSet<java.lang.Double>
implements java.util.Set<java.lang.Double>, java.io.Externalizable

Wrapper class to make a TDoubleSet conform to the java.util.Set API. This class simply decorates an underlying TDoubleSet and translates the Object-based APIs into their Trove primitive analogs.

Note that wrapping and unwrapping primitive values is extremely inefficient. If possible, users of this class should override the appropriate methods in this class and use a table of canonical values.

Created: Tue Sep 24 22:08:17 PDT 2002

See Also:
Serialized Form

Field Summary
protected  TDoubleSet _set
          the wrapped primitive set
 
Constructor Summary
TDoubleSetDecorator()
          FOR EXTERNALIZATION ONLY!!
TDoubleSetDecorator(TDoubleSet set)
          Creates a wrapper that decorates the specified primitive set.
 
Method Summary
 boolean add(java.lang.Double value)
          Inserts a value into the set.
 void clear()
          Empties the set.
 boolean contains(java.lang.Object o)
          
 boolean equals(java.lang.Object other)
          Compares this set with another set for equality of their stored entries.
 TDoubleSet getSet()
          Returns a reference to the set wrapped by this decorator.
 boolean isEmpty()
          Indicates whether set has any entries.
 java.util.Iterator<java.lang.Double> iterator()
          Creates an iterator over the values of the set.
 void readExternal(java.io.ObjectInput in)
           
 boolean remove(java.lang.Object value)
          Deletes a value from the set.
 int size()
          Returns the number of entries in the set.
 void writeExternal(java.io.ObjectOutput out)
           
 
Methods inherited from class java.util.AbstractSet
hashCode, removeAll
 
Methods inherited from class java.util.AbstractCollection
addAll, containsAll, retainAll, toArray, toArray, toString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.util.Set
addAll, containsAll, hashCode, removeAll, retainAll, toArray, toArray
 

Field Detail

_set

protected TDoubleSet _set
the wrapped primitive set

Constructor Detail

TDoubleSetDecorator

public TDoubleSetDecorator()
FOR EXTERNALIZATION ONLY!!


TDoubleSetDecorator

public TDoubleSetDecorator(TDoubleSet set)
Creates a wrapper that decorates the specified primitive set.

Parameters:
set - the TDoubleSet to wrap.
Method Detail

getSet

public TDoubleSet getSet()
Returns a reference to the set wrapped by this decorator.

Returns:
the wrapped TDoubleSet instance.

add

public boolean add(java.lang.Double value)
Inserts a value into the set.

Specified by:
add in interface java.util.Collection<java.lang.Double>
Specified by:
add in interface java.util.Set<java.lang.Double>
Overrides:
add in class java.util.AbstractCollection<java.lang.Double>
Parameters:
value - true if the set was modified by the insertion

equals

public boolean equals(java.lang.Object other)
Compares this set with another set for equality of their stored entries.

Specified by:
equals in interface java.util.Collection<java.lang.Double>
Specified by:
equals in interface java.util.Set<java.lang.Double>
Overrides:
equals in class java.util.AbstractSet<java.lang.Double>
Parameters:
other - an Object value
Returns:
true if the sets are identical

clear

public void clear()
Empties the set.

Specified by:
clear in interface java.util.Collection<java.lang.Double>
Specified by:
clear in interface java.util.Set<java.lang.Double>
Overrides:
clear in class java.util.AbstractCollection<java.lang.Double>

remove

public boolean remove(java.lang.Object value)
Deletes a value from the set.

Specified by:
remove in interface java.util.Collection<java.lang.Double>
Specified by:
remove in interface java.util.Set<java.lang.Double>
Overrides:
remove in class java.util.AbstractCollection<java.lang.Double>
Parameters:
value - an Object value
Returns:
true if the set was modified

iterator

public java.util.Iterator<java.lang.Double> iterator()
Creates an iterator over the values of the set.

Specified by:
iterator in interface java.lang.Iterable<java.lang.Double>
Specified by:
iterator in interface java.util.Collection<java.lang.Double>
Specified by:
iterator in interface java.util.Set<java.lang.Double>
Specified by:
iterator in class java.util.AbstractCollection<java.lang.Double>
Returns:
an iterator with support for removals in the underlying set

size

public int size()
Returns the number of entries in the set.

Specified by:
size in interface java.util.Collection<java.lang.Double>
Specified by:
size in interface java.util.Set<java.lang.Double>
Specified by:
size in class java.util.AbstractCollection<java.lang.Double>
Returns:
the set's size.

isEmpty

public boolean isEmpty()
Indicates whether set has any entries.

Specified by:
isEmpty in interface java.util.Collection<java.lang.Double>
Specified by:
isEmpty in interface java.util.Set<java.lang.Double>
Overrides:
isEmpty in class java.util.AbstractCollection<java.lang.Double>
Returns:
true if the set is empty

contains

public boolean contains(java.lang.Object o)

Specified by:
contains in interface java.util.Collection<java.lang.Double>
Specified by:
contains in interface java.util.Set<java.lang.Double>
Overrides:
contains in class java.util.AbstractCollection<java.lang.Double>

readExternal

public void readExternal(java.io.ObjectInput in)
                  throws java.io.IOException,
                         java.lang.ClassNotFoundException
Specified by:
readExternal in interface java.io.Externalizable
Throws:
java.io.IOException
java.lang.ClassNotFoundException

writeExternal

public void writeExternal(java.io.ObjectOutput out)
                   throws java.io.IOException
Specified by:
writeExternal in interface java.io.Externalizable
Throws:
java.io.IOException

GNU Trove