Class MutableMapping<T extends @Nullable Object>
java.lang.Object
com.ibm.wala.util.intset.MutableMapping<T>
- All Implemented Interfaces:
OrdinalSetMapping<T>, Serializable, Iterable<T>
- Direct Known Subclasses:
UnorderedDomain
public class MutableMapping<T extends @Nullable Object>
extends Object
implements OrdinalSetMapping<T>, Serializable
A bit set mapping based on an object array. This is not terribly efficient, but is useful for
prototyping.
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionintAdd an object to the set of mapped objects.voidintgetMappedIndex(@Nullable Object o) getMappedObject(int n) intintgetSize()booleanhasMappedIndex(T o) iterator()static <T> MutableMapping<T> make()makeSingleton(int i) voidAdd an object to the set of mapped objects at index i.voidReplace a in this mapping with b.stream()Stream over mapped objects.toString()Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface Iterable
forEach, spliterator
-
Constructor Details
-
MutableMapping
- Throws:
IllegalArgumentException- if array is null
-
MutableMapping
protected MutableMapping()
-
-
Method Details
-
make
-
getMappedObject
- Specified by:
getMappedObjectin interfaceOrdinalSetMapping<T extends @Nullable Object>- Returns:
- the object numbered n.
-
getMappedIndex
- Specified by:
getMappedIndexin interfaceOrdinalSetMapping<T extends @Nullable Object>- Returns:
- the number of a given object, or -1 if the object is not currently in the range.
-
hasMappedIndex
- Specified by:
hasMappedIndexin interfaceOrdinalSetMapping<T extends @Nullable Object>- Returns:
- whether the given object is mapped by this mapping
-
add
Add an object to the set of mapped objects.- Specified by:
addin interfaceOrdinalSetMapping<T extends @Nullable Object>- Returns:
- the integer to which the object is mapped.
-
toString
-
iterator
-
stream
Description copied from interface:OrdinalSetMappingStream over mapped objects.- Specified by:
streamin interfaceOrdinalSetMapping<T extends @Nullable Object>- Returns:
- a stream over the mapped objects
-
makeSingleton
- See Also:
-
deleteMappedObject
-
getObjects
-
replace
Replace a in this mapping with b.- Throws:
IllegalArgumentException
-
put
Add an object to the set of mapped objects at index i. -
getMaximumIndex
public int getMaximumIndex()- Specified by:
getMaximumIndexin interfaceOrdinalSetMapping<T extends @Nullable Object>- Returns:
- the maximum integer mapped to an object
-
getSize
public int getSize()- Specified by:
getSizein interfaceOrdinalSetMapping<T extends @Nullable Object>- Returns:
- the current size of the bijection
-