Class Entities.BinaryEntityMap

    • Constructor Summary

      Constructors 
      Constructor Description
      BinaryEntityMap()
      Constructs a new instance of BinaryEntityMap.
      BinaryEntityMap​(int growBy)
      Constructs a new instance of ArrayEntityMap specifying the size by which the underlying array should grow.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void add​(java.lang.String name, int value)
      Add an entry to this entity map.
      private int binarySearch​(int key)
      Performs a binary search of the entity array for the specified key.
      java.lang.String name​(int value)
      Returns the name of the entity identified by the specified value.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • BinaryEntityMap

        public BinaryEntityMap()
        Constructs a new instance of BinaryEntityMap.
      • BinaryEntityMap

        public BinaryEntityMap​(int growBy)
        Constructs a new instance of ArrayEntityMap specifying the size by which the underlying array should grow.
        Parameters:
        growBy - array will be initialized to and will grow by this amount
    • Method Detail

      • binarySearch

        private int binarySearch​(int key)
        Performs a binary search of the entity array for the specified key. This method is based on code in Arrays.
        Parameters:
        key - the key to be found
        Returns:
        the index of the entity array matching the specified key
      • add

        public void add​(java.lang.String name,
                        int value)

        Add an entry to this entity map.

        Specified by:
        add in interface Entities.EntityMap
        Overrides:
        add in class Entities.ArrayEntityMap
        Parameters:
        name - the entity name
        value - the entity value
      • name

        public java.lang.String name​(int value)

        Returns the name of the entity identified by the specified value.

        Specified by:
        name in interface Entities.EntityMap
        Overrides:
        name in class Entities.ArrayEntityMap
        Parameters:
        value - the value to locate
        Returns:
        entity name associated with the specified value