edu.emory.mathcs.util.collections.shorts
Class AbstractShortSet

java.lang.Object
  extended byedu.emory.mathcs.util.collections.shorts.AbstractShortCollection
      extended byedu.emory.mathcs.util.collections.shorts.AbstractShortSet
All Implemented Interfaces:
ShortCollection, ShortSet
Direct Known Subclasses:
AbstractShortSortedSet, ShortRadkeHashSet

public abstract class AbstractShortSet
extends AbstractShortCollection
implements ShortSet

Convenience subclass for short sets.

Version:
1.0
Author:
Dawid Kurzyniec

Constructor Summary
protected AbstractShortSet()
           
 
Method Summary
 boolean addAll(ShortCollection c)
          Adds all of the elements in the specified collection to this set if they're not already present, and if they fall within this set's domain.
 boolean addInterval(short first, short last)
          Adds to this set all the numbers between first and last, inclusive, that are not already present in this set and beshort to this set's domain.
 ShortSet complementSet()
          Returns a complement view of this set.
 boolean containsInterval(short first, short last)
          Returns true if this set contains all the numbers between first and last, inclusive; false otherwise.
 boolean equals(java.lang.Object obj)
          Two sets are equal if they consists of the same elements.
 int hashCode()
           
 boolean isEmpty()
          Returns true if this set is empty; false otherwise.
 short max()
          The largest number that can be stored in this set.
 short min()
          The smallest number that can be stored in this set.
 boolean removeAll(ShortCollection c)
          Removes from this set all of its elements that are contained in the specified collection.
 boolean removeInterval(short first, short last)
          Removes from this set all the numbers between first and last, inclusive.
 boolean retainAll(ShortCollection c)
          Retains only the elements in this set that are contained in the specified collection.
 boolean retainInterval(short first, short last)
          Retains in this set only the numbers between first and last, inclusive.
 
Methods inherited from class edu.emory.mathcs.util.collections.shorts.AbstractShortCollection
add, clear, contains, containsAll, iterator, remove, size, toArray, toArray, toString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface edu.emory.mathcs.util.collections.shorts.ShortSet
add, clear, contains, containsAll, iterator, remove, size, toArray, toArray
 

Constructor Detail

AbstractShortSet

protected AbstractShortSet()
Method Detail

min

public short min()
Description copied from interface: ShortSet
The smallest number that can be stored in this set.

Specified by:
min in interface ShortSet
Returns:
the smallest number that can be stored in this set

max

public short max()
Description copied from interface: ShortSet
The largest number that can be stored in this set.

Specified by:
max in interface ShortSet
Returns:
the largest number that can be stored in this set

equals

public boolean equals(java.lang.Object obj)
Description copied from interface: ShortSet
Two sets are equal if they consists of the same elements.

Specified by:
equals in interface ShortSet

hashCode

public int hashCode()
Specified by:
hashCode in interface ShortSet

isEmpty

public boolean isEmpty()
Description copied from interface: ShortSet
Returns true if this set is empty; false otherwise.

Specified by:
isEmpty in interface ShortSet
Overrides:
isEmpty in class AbstractShortCollection

addAll

public boolean addAll(ShortCollection c)
Description copied from interface: ShortSet
Adds all of the elements in the specified collection to this set if they're not already present, and if they fall within this set's domain. If the specified collection is also a set, the addAll operation effectively modifies this set so that its value is the union of the two sets, intersected with this set's domain. The behavior of this operation is undefined if the specified collection is modified while the operation is in progress.

Specified by:
addAll in interface ShortSet
Overrides:
addAll in class AbstractShortCollection

removeAll

public boolean removeAll(ShortCollection c)
Description copied from interface: ShortSet
Removes from this set all of its elements that are contained in the specified collection. If the specified collection is also a set, this operation effectively modifies this set so that its value is the asymmetric set difference of the two sets.

Specified by:
removeAll in interface ShortSet
Overrides:
removeAll in class AbstractShortCollection

retainAll

public boolean retainAll(ShortCollection c)
Description copied from interface: ShortSet
Retains only the elements in this set that are contained in the specified collection. In other words, removes from this set all of its elements that are not contained in the specified collection. If the specified collection is also a set, this operation effectively modifies this set so that its value is the intersection of the two sets.

Specified by:
retainAll in interface ShortSet
Overrides:
retainAll in class AbstractShortCollection

containsInterval

public boolean containsInterval(short first,
                                short last)
Description copied from interface: ShortSet
Returns true if this set contains all the numbers between first and last, inclusive; false otherwise.

Specified by:
containsInterval in interface ShortSet
Returns:
true if this set contains the specified interval; false otherwise

addInterval

public boolean addInterval(short first,
                           short last)
Description copied from interface: ShortSet
Adds to this set all the numbers between first and last, inclusive, that are not already present in this set and beshort to this set's domain.

Specified by:
addInterval in interface ShortSet
Parameters:
first - the beginning of the interval (inclusive)
last - the end of the interval (inclusive)
Returns:
true if this set changed as a result of the call
See Also:
ShortSet.add(short)

removeInterval

public boolean removeInterval(short first,
                              short last)
Description copied from interface: ShortSet
Removes from this set all the numbers between first and last, inclusive.

Specified by:
removeInterval in interface ShortSet
Parameters:
first - the beginning of the interval (inclusive)
last - the end of the interval (inclusive)
Returns:
true if this set changed as a result of the call
See Also:
ShortSet.remove(short), #removeAll()

retainInterval

public boolean retainInterval(short first,
                              short last)
Description copied from interface: ShortSet
Retains in this set only the numbers between first and last, inclusive. In other words, removes from this set all the numbers outside the specified interval.

Specified by:
retainInterval in interface ShortSet
Parameters:
first - the beginning of the interval (inclusive)
last - the end of the interval (inclusive)
Returns:
true if this set changed as a result of the call
See Also:
#retainAll()

complementSet

public ShortSet complementSet()
Description copied from interface: ShortSet
Returns a complement view of this set. Complement view is a set that has the same domain as this set, and consists of all numbers from the domain that are not contained in this set. Changes done to this set are reflected in the complement view after it is created.

Specified by:
complementSet in interface ShortSet
Returns:
the complement view of this set