Package gov.nih.mipav.model.algorithms
Class ContourPlot.GenericKey
- java.lang.Object
-
- gov.nih.mipav.model.algorithms.ContourPlot.GenericKey
-
- Enclosing class:
- ContourPlot
public class ContourPlot.GenericKey extends java.lang.ObjectThe GenericKey class can be used as key inHashMaps when multiple objects should be combined to a single key. The hash key is then generated usingArrays.hashCode(Object[])on the objects combined in this key.
This is for example used by the atlas collection inContourPlot.CharacterAtlaswhere 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 booleanequals(java.lang.Object obj)java.lang.ObjectgetComponent(int i)Returns the component at specified index<T> TgetComponent(int i, java.lang.Class<T> clazz)Returns the component at specified index casted to the specified typeinthashCode()intnumComponents()
-
-
-
Method Detail
-
equals
public boolean equals(java.lang.Object obj)
- Overrides:
equalsin classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.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- indexclazz- type to cast to- Returns:
- key component
-
-