Package soot.jimple.spark.geom.utils
Class ZArrayNumberer<E extends Numberable>
- java.lang.Object
-
- soot.jimple.spark.geom.utils.ZArrayNumberer<E>
-
- All Implemented Interfaces:
Iterable<E>,IterableNumberer<E>,Numberer<E>
public class ZArrayNumberer<E extends Numberable> extends Object implements IterableNumberer<E>, Iterable<E>
Similar to the ArrayNumberer class in soot. But, this class counts the objects from zero. And, we permit the deletion of objects from the array container. And most importantly, we permits the search for a particular object efficiently. Therefore, this class supports efficiently insert, lookup, deletion and traversal queries.- Author:
- xiao
-
-
Constructor Summary
Constructors Constructor Description ZArrayNumberer()ZArrayNumberer(int initSize)
-
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.voidclear()Clear the reference to the objects to help the garbage collectionEget(long number)Should return the object that was assigned the number number.longget(E o)Input object o should be added to this container previously.Iterator<E>iterator()Returns an iterator over all objects added to the numberer.voidreassign()The removed objects cause some empty slots.booleanremove(E o)Removes the number for a given object.EsearchFor(E o)Input object o is not required to be an object added previously.intsize()Return how many objects are in the container but not the capacity of the container.-
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
-
-
-
-
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>
-
clear
public void clear()
Clear the reference to the objects to help the garbage collection
-
get
public long get(E o)
Input object o should be added to this container previously.- 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>
-
searchFor
public E searchFor(E o)
Input object o is not required to be an object added previously.- Parameters:
o-- Returns:
-
remove
public boolean remove(E o)
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
-
size
public int size()
Return how many objects are in the container but not the capacity of the container.- Specified by:
sizein interfaceNumberer<E extends Numberable>
-
reassign
public void reassign()
The removed objects cause some empty slots. We shift the objects to the empty slots in order to ensure ids of the objects are less than the filledCells.
-
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>
-
-