public class ArrayNumberer<E extends Numberable> extends Object implements IterableNumberer<E>
Modifier and Type | Field and Description |
---|---|
protected int |
lastNumber |
protected E[] |
numberToObj |
Constructor and Description |
---|
ArrayNumberer() |
ArrayNumberer(E[] elements) |
Modifier and Type | Method and Description |
---|---|
void |
add(E o)
Tells the numberer that a new object needs to be assigned a number.
|
long |
get(E o)
Should return the number that was assigned to object o that was
previously passed as an argument to add().
|
E |
get(long number)
Should return the object that was assigned the number number.
|
Iterator<E> |
iterator()
Returns an iterator over all objects added to the numberer.
|
int |
size()
Should return the number of objects that have been assigned numbers.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
forEach, spliterator
protected E extends Numberable[] numberToObj
protected int lastNumber
public ArrayNumberer()
public ArrayNumberer(E[] elements)
public void add(E o)
Numberer
add
in interface Numberer<E extends Numberable>
public long get(E o)
Numberer
get
in interface Numberer<E extends Numberable>
public E get(long number)
Numberer
get
in interface Numberer<E extends Numberable>
public int size()
Numberer
size
in interface Numberer<E extends Numberable>
public Iterator<E> iterator()
IterableNumberer
iterator
in interface Iterable<E extends Numberable>
iterator
in interface IterableNumberer<E extends Numberable>