Class HashmapEncoding<T>
- java.lang.Object
-
- org.processmining.specpp.datastructures.util.NoRehashing<java.util.Map<T,java.lang.Integer>>
-
- org.processmining.specpp.datastructures.encoding.HashmapEncoding<T>
-
- Type Parameters:
T- domain of this encoding
- All Implemented Interfaces:
Encoding<T,java.lang.Integer>,HasDenseRange,IntEncoding<T>,Copyable<HashmapEncoding<T>>,Immutable,ProperlyHashable,ProperlyPrintable
public class HashmapEncoding<T> extends NoRehashing<java.util.Map<T,java.lang.Integer>> implements IntEncoding<T>, ProperlyHashable, Copyable<HashmapEncoding<T>>, ProperlyPrintable
Represents anIntEncoding<T>with an internal HashMap.
-
-
Field Summary
Fields Modifier and Type Field Description protected com.google.common.collect.BiMap<T,java.lang.Integer>internalprotected intsize-
Fields inherited from interface org.processmining.specpp.datastructures.encoding.IntEncoding
OUTSIDE_RANGE
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedHashmapEncoding(com.google.common.collect.ImmutableBiMap<T,java.lang.Integer> indices)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidassertInvariant()HashmapEncoding<T>copy()static <T> HashmapEncoding<T>copyOf(java.util.Map<T,java.lang.Integer> map)Tdecode(java.lang.Integer index)java.util.stream.Stream<T>domain()java.lang.Integerencode(T item)booleanisInDomain(T toEncode)booleanisInRange(java.lang.Integer toDecode)booleanisIntInRange(int toDecode)protected booleanisValid()static <T> HashmapEncoding<T>ofComparableSet(java.util.Set<T> items, java.util.Comparator<T> ordering)static <T> HashmapEncoding<T>ofList(java.util.List<T> orderedDistinctItems)java.util.stream.IntStreamprimitiveRange()java.util.stream.Stream<java.lang.Integer>range()intsize()java.lang.StringtoString()-
Methods inherited from class org.processmining.specpp.datastructures.util.NoRehashing
equals, hashCode
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.processmining.specpp.traits.ProperlyHashable
hashCode
-
-
-
-
Field Detail
-
internal
protected final com.google.common.collect.BiMap<T,java.lang.Integer> internal
-
size
protected final int size
-
-
Constructor Detail
-
HashmapEncoding
protected HashmapEncoding(com.google.common.collect.ImmutableBiMap<T,java.lang.Integer> indices)
-
-
Method Detail
-
ofComparableSet
public static <T> HashmapEncoding<T> ofComparableSet(java.util.Set<T> items, java.util.Comparator<T> ordering)
-
ofList
public static <T> HashmapEncoding<T> ofList(java.util.List<T> orderedDistinctItems)
-
assertInvariant
protected void assertInvariant()
-
copyOf
public static <T> HashmapEncoding<T> copyOf(java.util.Map<T,java.lang.Integer> map)
-
isValid
protected boolean isValid()
-
domain
public java.util.stream.Stream<T> domain()
-
range
public java.util.stream.Stream<java.lang.Integer> range()
-
primitiveRange
public java.util.stream.IntStream primitiveRange()
- Specified by:
primitiveRangein interfaceIntEncoding<T>
-
isInDomain
public boolean isInDomain(T toEncode)
- Specified by:
isInDomainin interfaceEncoding<T,java.lang.Integer>
-
isInRange
public boolean isInRange(java.lang.Integer toDecode)
-
isIntInRange
public boolean isIntInRange(int toDecode)
- Specified by:
isIntInRangein interfaceIntEncoding<T>
-
encode
public java.lang.Integer encode(T item)
-
decode
public T decode(java.lang.Integer index)
-
toString
public java.lang.String toString()
- Specified by:
toStringin interfaceProperlyPrintable- Overrides:
toStringin classjava.lang.Object
-
copy
public HashmapEncoding<T> copy()
-
-