Package com.petrolpark.util
Class NestedSequenceBiMap<K,V>
java.lang.Object
com.petrolpark.util.NestedSequenceBiMap<K,V>
- All Implemented Interfaces:
ISequenceBiMap<K,V, List<K>, NestedSequenceBiMap.Entry<K, V>, NestedSequenceBiMap<K, V>>
- Direct Known Subclasses:
EnumSequenceBiMap
public abstract class NestedSequenceBiMap<K,V>
extends Object
implements ISequenceBiMap<K,V,List<K>,NestedSequenceBiMap.Entry<K,V>,NestedSequenceBiMap<K,V>>
-
Nested Class Summary
Nested Classes -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionfinal VFollow a sequence of keys until a value is found.final NestedSequenceBiMap.Entry<K, V> Get theISequenceBiMap.IEntryat this exact sequence position.final NestedSequenceBiMap.Entry<K, V> Get theISequenceBiMap.IEntryassociated with this key.protected abstract Map<K, NestedSequenceBiMap.Entry<K, V>> getKeySequence(V value) Essentially a shortcut forISequenceBiMap.getKeySequenceMap().Map.get(Object).protected static <K,V> void populateSequenceMap(Map<V, List<K>> sequenceMap, NestedSequenceBiMap.Entry<K, V> entry, List<K> sequence) final Collection<V> values()Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.petrolpark.util.ISequenceBiMap
getKeySequenceMap
-
Constructor Details
-
NestedSequenceBiMap
public NestedSequenceBiMap()
-
-
Method Details
-
getEntryMap
-
get
Description copied from interface:ISequenceBiMapGet theISequenceBiMap.IEntryassociated with this key. Equivalently, theISequenceBiMap.IEntryassociatedwith the sequence of length1containing this key.- Specified by:
getin interfaceISequenceBiMap<K,V, List<K>, NestedSequenceBiMap.Entry<K, V>, NestedSequenceBiMap<K, V>> - Parameters:
key-- Returns:
nullif noISequenceBiMap.IEntryexists
-
get
Description copied from interface:ISequenceBiMapGet theISequenceBiMap.IEntryat this exact sequence position.- Specified by:
getin interfaceISequenceBiMap<K,V, List<K>, NestedSequenceBiMap.Entry<K, V>, NestedSequenceBiMap<K, V>> - Parameters:
sequence- Not mutated- Returns:
ISequenceBiMap.IEntryornullif no entry exists with that sequence.- See Also:
-
follow
Description copied from interface:ISequenceBiMapFollow a sequence of keys until a value is found. A key is taken off the start of the sequence and used to find theISequenceBiMap.IEntrythere. If thisISequenceBiMap.IEntryis a value, this is returned. If it is a sub-map, then the process is repeated with the next key.- Specified by:
followin interfaceISequenceBiMap<K,V, List<K>, NestedSequenceBiMap.Entry<K, V>, NestedSequenceBiMap<K, V>> - Parameters:
sequence- This is shortened by this operation- Returns:
- The value found by following the sequence of keys, or
nullif the sequence reaches a dead end, or the sequence runs out before a value is found. - See Also:
-
getKeySequence
Description copied from interface:ISequenceBiMapEssentially a shortcut forISequenceBiMap.getKeySequenceMap().Map.get(Object).- Specified by:
getKeySequencein interfaceISequenceBiMap<K,V, List<K>, NestedSequenceBiMap.Entry<K, V>, NestedSequenceBiMap<K, V>> - Parameters:
value-- Returns:
- The
sequencesuch thatget(sequence) == value, ornullif that value is not in this Map - See Also:
-
values
- Specified by:
valuesin interfaceISequenceBiMap<K,V, List<K>, NestedSequenceBiMap.Entry<K, V>, NestedSequenceBiMap<K, V>>
-
populateSequenceMap
protected static <K,V> void populateSequenceMap(Map<V, List<K>> sequenceMap, NestedSequenceBiMap.Entry<K, V> entry, List<K> sequence)
-