Class ContourPlot.GenericKey

  • Enclosing class:
    ContourPlot

    public class ContourPlot.GenericKey
    extends java.lang.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 Summary

      Fields 
      Modifier and Type Field Description
      private java.lang.Object[] keycontents  
    • Constructor Summary

      Constructors 
      Constructor Description
      GenericKey​(java.lang.Object... objects)
      Creates a new key from the specified objects
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      boolean equals​(java.lang.Object obj)  
      java.lang.Object getComponent​(int i)
      Returns the component at specified index
      <T> T getComponent​(int i, java.lang.Class<T> clazz)
      Returns the component at specified index casted to the specified type
      int hashCode()  
      int numComponents()  
      • Methods inherited from class java.lang.Object

        clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • keycontents

        private java.lang.Object[] keycontents
    • Constructor Detail

      • GenericKey

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

      • equals

        public boolean equals​(java.lang.Object obj)
        Overrides:
        equals in class java.lang.Object
      • hashCode

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

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

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

        public <T> T getComponent​(int i,
                                  java.lang.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