Class SimpleIndexHashMapWrapper<K,​V>

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

    public class SimpleIndexHashMapWrapper<K,​V>
    extends Object
    implements 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
    • 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 Map<K,​V>
      • isEmpty

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

        public boolean containsKey​(Object key)
        Specified by:
        containsKey in interface Map<K,​V>
      • get

        public V get​(Object key)
        Specified by:
        get in interface 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 Map<K,​V>
      • putAtIndex

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

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

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

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

        public Set<K> keySet()
        Specified by:
        keySet in interface Map<K,​V>