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
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidTells the numberer that a new object needs to be assigned a number.get(long number) Should return the object that was assigned the number.longShould 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.booleanRemoves the number for a given object.intsize()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, waitMethods 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:NumbererTells the numberer that a new object needs to be assigned a number.- Specified by:
addin interfaceNumberer<E extends Numberable>
-
get
Description copied from interface:NumbererShould return the number that was assigned to object o that was previously passed as an argument to add().- Specified by:
getin interfaceNumberer<E extends Numberable>
-
get
Description copied from interface:NumbererShould return the object that was assigned the number.- Specified by:
getin interfaceNumberer<E extends Numberable>
-
size
public int size()Description copied from interface:NumbererShould return the number of objects that have been assigned numbers.- Specified by:
sizein interfaceNumberer<E extends Numberable>
-
iterator
Description copied from interface:IterableNumbererReturns an iterator over all objects added to the numberer.- Specified by:
iteratorin interfaceIterable<E extends Numberable>- Specified by:
iteratorin interfaceIterableNumberer<E extends Numberable>
-
remove
Description copied from interface:NumbererRemoves the number for a given object.- Specified by:
removein interfaceNumberer<E extends Numberable>- Parameters:
o- the element- Returns:
- true if the removal was successful, false when not
-