Class MapLookupTable

java.lang.Object
nz.org.riskscape.defaults.lookup.MapLookupTable
All Implemented Interfaces:
nz.org.riskscape.engine.data.SelfDescribingScalarData, nz.org.riskscape.engine.lookup.LookupTable

public class MapLookupTable extends Object implements nz.org.riskscape.engine.lookup.LookupTable

Very simple lookup table based on HashMap. It's completely up to the user to make sure the values in the map correspond to the advertised key and value types.

  • Constructor Details

    • MapLookupTable

      public MapLookupTable(Map<?,?> values, nz.org.riskscape.engine.types.Type keyType, nz.org.riskscape.engine.types.Type valueType)
  • Method Details

    • lookup

      public Object lookup(Object key)
      Specified by:
      lookup in interface nz.org.riskscape.engine.lookup.LookupTable
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • canEqual

      protected boolean canEqual(Object other)
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • getKeyType

      public nz.org.riskscape.engine.types.Type getKeyType()
      Specified by:
      getKeyType in interface nz.org.riskscape.engine.lookup.LookupTable
    • getValueType

      public nz.org.riskscape.engine.types.Type getValueType()
      Specified by:
      getValueType in interface nz.org.riskscape.engine.lookup.LookupTable