Class SimpleIndexHashMapWrapper<K,​V>

  • All Implemented Interfaces:
    java.util.Map<K,​V>

    public class SimpleIndexHashMapWrapper<K,​V>
    extends java.lang.Object
    implements java.util.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).
    • Constructor Detail

      • SimpleIndexHashMapWrapper

        public SimpleIndexHashMapWrapper()
      • SimpleIndexHashMapWrapper

        public SimpleIndexHashMapWrapper​(K[] keys)
      • SimpleIndexHashMapWrapper

        public SimpleIndexHashMapWrapper​(K[] keys,
                                         int initialCapacity,
                                         float load)
    • Method Detail

      • initWithKeys

        public void initWithKeys​(K[] keys)
      • addKey

        public void addKey​(K key)
      • addKey

        public void addKey​(K key,
                           V value)
      • size

        public int size()
        Specified by:
        size in interface java.util.Map<K,​V>
      • isEmpty

        public boolean isEmpty()
        Specified by:
        isEmpty in interface java.util.Map<K,​V>
      • containsKey

        public boolean containsKey​(java.lang.Object key)
        Specified by:
        containsKey in interface java.util.Map<K,​V>
      • containsValue

        public boolean containsValue​(java.lang.Object value)
        Specified by:
        containsValue in interface java.util.Map<K,​V>
      • get

        public V get​(java.lang.Object key)
        Specified by:
        get in interface java.util.Map<K,​V>
      • getByIndex

        public V getByIndex​(int index)
      • getKeyAtIndex

        public K getKeyAtIndex​(int index)
      • indexOf

        public int indexOf​(K key)
      • put

        public V put​(K key,
                     V value)
        Specified by:
        put in interface java.util.Map<K,​V>
      • putAtIndex

        public void putAtIndex​(int index,
                               V value)
      • remove

        public V remove​(java.lang.Object key)
        Specified by:
        remove in interface java.util.Map<K,​V>
      • putAll

        public void putAll​(java.util.Map<? extends K,​? extends V> m)
        Specified by:
        putAll in interface java.util.Map<K,​V>
      • clear

        public void clear()
        Specified by:
        clear in interface java.util.Map<K,​V>
      • keySet

        public java.util.Set<K> keySet()
        Specified by:
        keySet in interface java.util.Map<K,​V>
      • values

        public java.util.Collection<V> values()
        Specified by:
        values in interface java.util.Map<K,​V>
      • entrySet

        public java.util.Set<java.util.Map.Entry<K,​V>> entrySet()
        Specified by:
        entrySet in interface java.util.Map<K,​V>