Package soot.util
Class ArrayNumberer<E extends Numberable>
- java.lang.Object
-
- soot.util.ArrayNumberer<E>
-
- All Implemented Interfaces:
Iterable<E>,IterableNumberer<E>,Numberer<E>
- Direct Known Subclasses:
StringNumberer
public class ArrayNumberer<E extends Numberable> extends Object implements IterableNumberer<E>
A class that numbers objects, so they can be placed in bitsets.- Author:
- Ondrej Lhotak, xiao, generalize it.
-
-
Field Summary
Fields Modifier and Type Field Description protected BitSetfreeNumbersprotected intlastNumberprotected E[]numberToObj
-
Constructor Summary
Constructors Constructor Description ArrayNumberer()ArrayNumberer(E[] elements)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidadd(E o)Tells the numberer that a new object needs to be assigned a number.Eget(long number)Should return the object that was assigned the number number.longget(E o)Should return the number that was assigned to object o that was previously passed as an argument to add().Iterator<E>iterator()Returns an iterator over all objects added to the numberer.booleanremove(E o)Removes 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, wait
-
Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
-
-
-
Field Detail
-
numberToObj
protected E extends Numberable[] numberToObj
-
lastNumber
protected int lastNumber
-
freeNumbers
protected BitSet freeNumbers
-
-
Constructor Detail
-
ArrayNumberer
public ArrayNumberer()
-
ArrayNumberer
public ArrayNumberer(E[] elements)
-
-
Method Detail
-
add
public void add(E o)
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
public long get(E o)
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
public E get(long number)
Description copied from interface:NumbererShould return the object that was assigned the number 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
public Iterator<E> 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>
-
-