coins.backend.util
Class HashNumberSet

java.lang.Object
  extended bycoins.backend.util.HashNumberSet
All Implemented Interfaces:
NumberSet

public class HashNumberSet
extends java.lang.Object
implements NumberSet

Set of small integers represented in hash table.


Nested Class Summary
static class HashNumberSet.Iterator
           
 
Constructor Summary
HashNumberSet(int max)
          Create a set of numbers which is supposed to be less than max
 
Method Summary
 void add(int x)
          Add number x to set.
 void addAll(NumberSet x)
          Add all elements of another NumberSet x to this set.
 void addAllTo(NumberSet x)
          Add all elements of this set to another NumberSet x.
 void clear()
          Clear contents of set.
 java.lang.Object clone()
          Return copy of the object.
 boolean contains(int x)
          Return true if x is in the set.
 void copy(NumberSet x)
          Copy another NumberSet x to this object.
 boolean equals(java.lang.Object x)
          Return true if x is same as this set.
 NumberSet.Iterator iterator()
          Enumerate all members.
 void remove(int x)
          Remove number x from set.
 void removeAll(NumberSet x)
          Remove all elements of another NumberSet x from this set.
 void removeAllFrom(NumberSet x)
          Remove all elements of this set from another NumberSet x.
 int size()
          Return the number of elements.
 int tableSize()
           
 void toArray(int[] a)
          Convert to array
 
Methods inherited from class java.lang.Object
finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

HashNumberSet

public HashNumberSet(int max)
Create a set of numbers which is supposed to be less than max

Method Detail

size

public int size()
Return the number of elements.

Specified by:
size in interface NumberSet

tableSize

public int tableSize()

clear

public void clear()
Clear contents of set.

Specified by:
clear in interface NumberSet

add

public void add(int x)
Add number x to set.

Specified by:
add in interface NumberSet

addAll

public void addAll(NumberSet x)
Add all elements of another NumberSet x to this set.

Specified by:
addAll in interface NumberSet

addAllTo

public void addAllTo(NumberSet x)
Add all elements of this set to another NumberSet x.

Specified by:
addAllTo in interface NumberSet

remove

public void remove(int x)
Remove number x from set.

Specified by:
remove in interface NumberSet

removeAll

public void removeAll(NumberSet x)
Remove all elements of another NumberSet x from this set.

Specified by:
removeAll in interface NumberSet

removeAllFrom

public void removeAllFrom(NumberSet x)
Remove all elements of this set from another NumberSet x.

Specified by:
removeAllFrom in interface NumberSet

contains

public boolean contains(int x)
Return true if x is in the set.

Specified by:
contains in interface NumberSet

iterator

public NumberSet.Iterator iterator()
Enumerate all members.

Specified by:
iterator in interface NumberSet

toArray

public void toArray(int[] a)
Convert to array

Specified by:
toArray in interface NumberSet

copy

public void copy(NumberSet x)
Copy another NumberSet x to this object.

Specified by:
copy in interface NumberSet

equals

public boolean equals(java.lang.Object x)
Return true if x is same as this set.

Specified by:
equals in interface NumberSet

clone

public java.lang.Object clone()
Return copy of the object.

Specified by:
clone in interface NumberSet