Class ContourPlot.GenericKey

java.lang.Object
gov.nih.mipav.model.algorithms.ContourPlot.GenericKey
Enclosing class:
ContourPlot

public class ContourPlot.GenericKey extends Object
The GenericKey class can be used as key in HashMaps when multiple objects should be combined to a single key. The hash key is then generated using Arrays.hashCode(Object[]) on the objects combined in this key.
This is for example used by the atlas collection in ContourPlot.CharacterAtlas where the attributes fontSize, style and antialiasing are used to lookup the correct atlas.
Author:
hageldave
  • Field Details

    • keycontents

      private Object[] keycontents
  • Constructor Details

    • GenericKey

      public GenericKey(Object... objects)
      Creates a new key from the specified objects
      Parameters:
      objects - the objects to form a key from (ordering changes hash)
  • Method Details

    • equals

      public boolean equals(Object obj)
      Overrides:
      equals in class Object
    • hashCode

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

      public int numComponents()
      Returns:
      the number of components this key consists of
    • getComponent

      public Object getComponent(int i)
      Returns the component at specified index
      Parameters:
      i - index
      Returns:
      key component
    • getComponent

      public <T> T getComponent(int i, Class<T> clazz)
      Returns the component at specified index casted to the specified type
      Type Parameters:
      T - type of the component
      Parameters:
      i - index
      clazz - type to cast to
      Returns:
      key component