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.Object
The GenericKey class can be used as key inHashMap
s 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.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 typeint
hashCode()
int
numComponents()
-
-
-
Method Detail
-
equals
public boolean equals(java.lang.Object obj)
- Overrides:
equals
in classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCode
in 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
-
-