Package adams.data.binning
Class Binnable<T>
- java.lang.Object
-
- adams.data.binning.Binnable<T>
-
- Type Parameters:
T
- the type of payload
- All Implemented Interfaces:
MetaDataSupporter
,Serializable
public class Binnable<T> extends Object implements Serializable, MetaDataSupporter
Wrapper for objects to be binned.- Author:
- FracPete (fracpete at waikato dot ac dot nz)
- See Also:
- Serialized Form
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Object
addMetaData(String key, Object value)
Adds meta-data.Map<String,Object>
getMetaData()
Returns the meta-data.Object
getMetaData(String key)
Rertrieves meta-data.T
getPayload()
Returns the actual object.double
getValue()
Returns the value to use for the binning calculation.boolean
hasMetaData()
Returns if meta-data is present.Set<String>
metaDataKeys()
Returns the set of meta-data keys.Object
removeMetaData(String key)
Removes meta-data.void
setValue(double value)
Sets the value to use for the binning calculation.String
toString()
Returns a short description of the wrapper.String
toString(int decimals)
Returns a short description of the wrapper.
-
-
-
Constructor Detail
-
Binnable
public Binnable(T payload, double value)
Initializes the wrapper.- Parameters:
payload
- the actual objectvalue
- the value to use for binning
-
-
Method Detail
-
getPayload
public T getPayload()
Returns the actual object.- Returns:
- the payload
-
setValue
public void setValue(double value)
Sets the value to use for the binning calculation.- Parameters:
value
- the value
-
getValue
public double getValue()
Returns the value to use for the binning calculation.- Returns:
- the value
-
hasMetaData
public boolean hasMetaData()
Returns if meta-data is present.- Returns:
- true if meta-data there
-
addMetaData
public Object addMetaData(String key, Object value)
Adds meta-data.- Specified by:
addMetaData
in interfaceMetaDataSupporter
- Parameters:
key
- the key of the valuevalue
- the value to store- Returns:
- any previously stored object for this key, otherwise null
-
removeMetaData
public Object removeMetaData(String key)
Removes meta-data.- Specified by:
removeMetaData
in interfaceMetaDataSupporter
- Parameters:
key
- the key of the value to remove- Returns:
- the removed value, null if none removed
-
getMetaData
public Object getMetaData(String key)
Rertrieves meta-data.- Specified by:
getMetaData
in interfaceMetaDataSupporter
- Parameters:
key
- the key of the value to retrieve- Returns:
- the associated value, null if none available
-
getMetaData
public Map<String,Object> getMetaData()
Returns the meta-data.- Specified by:
getMetaData
in interfaceMetaDataSupporter
- Returns:
- the data, null if none stored
-
metaDataKeys
public Set<String> metaDataKeys()
Returns the set of meta-data keys.- Specified by:
metaDataKeys
in interfaceMetaDataSupporter
- Returns:
- the meta-data keys
-
toString
public String toString()
Returns a short description of the wrapper.
-
toString
public String toString(int decimals)
Returns a short description of the wrapper.- Parameters:
decimals
- the number of decimals in the output, -1 for no limit- Returns:
- the description
-
-