Package com.ibm.wala.util.collections
Class SparseVector<T>
- java.lang.Object
-
- com.ibm.wala.util.collections.SparseVector<T>
-
- All Implemented Interfaces:
IVector<T>
,java.io.Serializable
,java.lang.Iterable<T>
public class SparseVector<T> extends java.lang.Object implements IVector<T>, java.io.Serializable
AnIVector
implementation designed for low occupancy. Note that get() from this vector is a binary search. This should only be used for small sets ... insertion and deletion are linear in size of set.- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description SparseVector()
SparseVector(int initialSize, float expansion)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
clear()
T
get(int x)
int
getMaxIndex()
IntIterator
iterateIndices()
java.util.Iterator<T>
iterator()
void
performVerboseAction()
void
remove(int x)
IntIterator
safeIterateIndices()
This iteration _will_ cover all indices even when remove is called while the iterator is active.void
set(int x, T value)
TODO: this can be optimizedint
size()
-
-
-
Method Detail
-
set
public void set(int x, T value)
TODO: this can be optimized- Specified by:
set
in interfaceIVector<T>
- See Also:
IntVector.set(int, int)
-
performVerboseAction
public void performVerboseAction()
- Specified by:
performVerboseAction
in interfaceIVector<T>
-
iterator
public java.util.Iterator<T> iterator()
- Specified by:
iterator
in interfacejava.lang.Iterable<T>
-
getMaxIndex
public int getMaxIndex() throws java.lang.IllegalStateException
- Specified by:
getMaxIndex
in interfaceIVector<T>
- Returns:
- max i s.t get(i) != null
- Throws:
java.lang.IllegalStateException
-
size
public int size()
-
iterateIndices
public IntIterator iterateIndices()
-
safeIterateIndices
public IntIterator safeIterateIndices()
This iteration _will_ cover all indices even when remove is called while the iterator is active.
-
clear
public void clear()
-
remove
public void remove(int x)
-
-