Class SimpleIndexHashMapWrapper<K,V>
java.lang.Object
org.mvel2.util.SimpleIndexHashMapWrapper<K,V>
- All Implemented Interfaces:
Map<K,V>
As most use-cases of the VariableResolverFactory's rely on Maps, this is meant to implement a simple wrapper
which records index positions for use by the optimizing facilities.
This wrapper also ensures that the Map is only additive. You cannot remove an element once it's been added.
While this may seem like an odd limitation, it is consistent with the language semantics. (ie. it's not possible
to delete a variable at runtime once it's been declared).
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final ArrayList<SimpleIndexHashMapWrapper<K, V>.ValueContainer<K, V>> private intprivate final Map<K, SimpleIndexHashMapWrapper<K, V>.ValueContainer<K, V>> -
Constructor Summary
ConstructorsConstructorDescriptionSimpleIndexHashMapWrapper(K[] keys) SimpleIndexHashMapWrapper(K[] keys, int initialCapacity, float load) SimpleIndexHashMapWrapper(SimpleIndexHashMapWrapper<K, V> wrapper, boolean allocateOnly) -
Method Summary
Modifier and TypeMethodDescriptionvoidvoidvoidclear()booleancontainsKey(Object key) booleancontainsValue(Object value) entrySet()getByIndex(int index) getKeyAtIndex(int index) intvoidinitWithKeys(K[] keys) booleanisEmpty()keySet()voidvoidputAtIndex(int index, V value) intsize()values()Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface Map
compute, computeIfAbsent, computeIfPresent, equals, forEach, getOrDefault, hashCode, merge, putIfAbsent, remove, replace, replace, replaceAll
-
Field Details
-
indexCounter
private int indexCounter -
wrappedMap
-
indexBasedLookup
-
-
Constructor Details
-
SimpleIndexHashMapWrapper
public SimpleIndexHashMapWrapper() -
SimpleIndexHashMapWrapper
-
SimpleIndexHashMapWrapper
-
SimpleIndexHashMapWrapper
-
-
Method Details
-
initWithKeys
-
addKey
-
addKey
-
size
-
isEmpty
-
containsKey
- Specified by:
containsKeyin interfaceMap<K,V>
-
containsValue
- Specified by:
containsValuein interfaceMap<K,V>
-
get
-
getByIndex
-
getKeyAtIndex
-
indexOf
-
put
-
putAtIndex
-
remove
-
putAll
-
clear
-
keySet
-
values
-
entrySet
-