Package com.ibm.wala.util.intset
Class OffsetOrdinalSetMapping<T>
- java.lang.Object
-
- com.ibm.wala.util.intset.OffsetOrdinalSetMapping<T>
-
- All Implemented Interfaces:
OrdinalSetMapping<T>
,Iterable<T>
public class OffsetOrdinalSetMapping<T> extends Object implements OrdinalSetMapping<T>
An ordinal set mapping, backed a delegate, but adding an offset to each index.
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description int
add(T o)
Add an Object to the set of mapped objects.int
getMappedIndex(Object o)
T
getMappedObject(int n)
int
getMaximumIndex()
int
getSize()
boolean
hasMappedIndex(T o)
Iterator<T>
iterator()
static <T> OffsetOrdinalSetMapping<T>
make(int offset)
static <T> OffsetOrdinalSetMapping<T>
make(OrdinalSetMapping<T> delegate, int offset)
-
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
-
getMaximumIndex
public int getMaximumIndex()
- Specified by:
getMaximumIndex
in interfaceOrdinalSetMapping<T>
- Returns:
- the maximum integer mapped to an object
-
getSize
public int getSize()
- Specified by:
getSize
in interfaceOrdinalSetMapping<T>
- Returns:
- the current size of the bijection
-
make
public static <T> OffsetOrdinalSetMapping<T> make(OrdinalSetMapping<T> delegate, int offset)
-
make
public static <T> OffsetOrdinalSetMapping<T> make(int offset)
-
add
public int add(T o)
Description copied from interface:OrdinalSetMapping
Add an Object to the set of mapped objects.- Specified by:
add
in interfaceOrdinalSetMapping<T>
- Returns:
- the integer to which the object is mapped.
-
getMappedIndex
public int getMappedIndex(Object o)
- Specified by:
getMappedIndex
in interfaceOrdinalSetMapping<T>
- Returns:
- the number of a given object, or -1 if the object is not currently in the range.
-
getMappedObject
public T getMappedObject(int n) throws NoSuchElementException
- Specified by:
getMappedObject
in interfaceOrdinalSetMapping<T>
- Returns:
- the object numbered n.
- Throws:
NoSuchElementException
-
hasMappedIndex
public boolean hasMappedIndex(T o)
- Specified by:
hasMappedIndex
in interfaceOrdinalSetMapping<T>
- Returns:
- whether the given object is mapped by this mapping
-
-