Package qilin.util
Class ArrayNumberer<E extends Numberable>
java.lang.Object
qilin.util.ArrayNumberer<E>
- All Implemented Interfaces:
Iterable<E>
,IterableNumberer<E>
,Numberer<E>
- Direct Known Subclasses:
StringNumberer
A class that numbers objects, so they can be placed in bitsets.
- Author:
- Ondrej Lhotak, xiao, generalize it.
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
Tells the numberer that a new object needs to be assigned a number.get
(long number) Should return the object that was assigned the number.long
Should return the number that was assigned to object o that was previously passed as an argument to add().iterator()
Returns an iterator over all objects added to the numberer.boolean
Removes the number for a given object.int
size()
Should return the number of objects that have been assigned numbers.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
Field Details
-
numberToObj
-
lastNumber
protected int lastNumber -
freeNumbers
-
-
Constructor Details
-
ArrayNumberer
public ArrayNumberer() -
ArrayNumberer
-
-
Method Details
-
add
Description copied from interface:Numberer
Tells the numberer that a new object needs to be assigned a number.- Specified by:
add
in interfaceNumberer<E extends Numberable>
-
get
Description copied from interface:Numberer
Should return the number that was assigned to object o that was previously passed as an argument to add().- Specified by:
get
in interfaceNumberer<E extends Numberable>
-
get
Description copied from interface:Numberer
Should return the object that was assigned the number.- Specified by:
get
in interfaceNumberer<E extends Numberable>
-
size
public int size()Description copied from interface:Numberer
Should return the number of objects that have been assigned numbers.- Specified by:
size
in interfaceNumberer<E extends Numberable>
-
iterator
Description copied from interface:IterableNumberer
Returns an iterator over all objects added to the numberer.- Specified by:
iterator
in interfaceIterable<E extends Numberable>
- Specified by:
iterator
in interfaceIterableNumberer<E extends Numberable>
-
remove
Description copied from interface:Numberer
Removes the number for a given object.- Specified by:
remove
in interfaceNumberer<E extends Numberable>
- Parameters:
o
- the element- Returns:
- true if the removal was successful, false when not
-