Package soot.util
Class WeakMapNumberer<T extends Numberable>
- java.lang.Object
-
- soot.util.WeakMapNumberer<T>
-
- Type Parameters:
T-
- All Implemented Interfaces:
Iterable<T>,IterableNumberer<T>,Numberer<T>
public class WeakMapNumberer<T extends Numberable> extends Object implements IterableNumberer<T>
A class that numbers objects but keeps weak references for garbage collection- Author:
- William Bonnaventure
-
-
Constructor Summary
Constructors Constructor Description WeakMapNumberer()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidadd(T o)Tells the numberer that a new object needs to be assigned a number.booleancontains(T o)Tget(long number)Should return the object that was assigned the number number.longget(T o)Should return the number that was assigned to object o that was previously passed as an argument to add().Iterator<T>iterator()Returns an iterator over all objects added to the numberer.booleanremove(T 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
-
-
-
-
Method Detail
-
add
public void add(T o)
Description copied from interface:NumbererTells the numberer that a new object needs to be assigned a number.- Specified by:
addin interfaceNumberer<T extends Numberable>
-
remove
public boolean remove(T o)
Description copied from interface:NumbererRemoves the number for a given object.- Specified by:
removein interfaceNumberer<T extends Numberable>- Parameters:
o- the element- Returns:
- true if the removal was successful, false when not
-
get
public long get(T 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<T extends Numberable>
-
get
public T get(long number)
Description copied from interface:NumbererShould return the object that was assigned the number number.- Specified by:
getin interfaceNumberer<T 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<T extends Numberable>
-
contains
public boolean contains(T o)
-
iterator
public Iterator<T> iterator()
Description copied from interface:IterableNumbererReturns an iterator over all objects added to the numberer.- Specified by:
iteratorin interfaceIterable<T extends Numberable>- Specified by:
iteratorin interfaceIterableNumberer<T extends Numberable>
-
-