Package org.mvel2.util
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).
- Author:
- Mike Brock
-
Nested Class Summary
-
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 java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface java.util.Map
compute, computeIfAbsent, computeIfPresent, equals, forEach, getOrDefault, hashCode, merge, putIfAbsent, remove, replace, replace, replaceAll
-
Constructor Details
-
SimpleIndexHashMapWrapper
public SimpleIndexHashMapWrapper() -
SimpleIndexHashMapWrapper
-
SimpleIndexHashMapWrapper
-
SimpleIndexHashMapWrapper
-
-
Method Details
-
initWithKeys
-
addKey
-
addKey
-
size
public int size() -
isEmpty
public boolean isEmpty() -
containsKey
- Specified by:
containsKeyin interfaceMap<K,V>
-
containsValue
- Specified by:
containsValuein interfaceMap<K,V>
-
get
-
getByIndex
-
getKeyAtIndex
-
indexOf
-
put
-
putAtIndex
-
remove
-
putAll
-
clear
public void clear() -
keySet
-
values
-
entrySet
-