Class DatumSamples
- All Implemented Interfaces:
Serializable,DatumSamplesOperations,MutableDatumSamplesOperations,Differentiable<DatumSamplesOperations>
- Version:
- 2.1
- Author:
- matt
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidclear()Clear all property values.boolean<V> VfindSampleValue(String key) Find a sample value.getA()Shortcut forgetAccumulating().Get a map accumulating sample values.Get a BigDecimal value from thegetAccumulating()map, or null if not available.Get a Double value from thegetAccumulating()map, or null if not available.Get a Float value from thegetAccumulating()map, or null if not available.Get an Integer value from thegetAccumulating()map, or null if not available.Get a Long value from thegetAccumulating()map, or null if not available.getI()Shortcut forgetInstantaneous().Get a map of instantaneous sample values.Get a BigDecimal value from thegetInstantaneous()map, or null if not available.Get a Double value from thegetInstantaneous()map, or null if not available.Get a Float value from thegetInstantaneous()map, or null if not available.Get an Integer value from thegetInstantaneous()map, or null if not available.Get a Long value from thegetInstantaneous()map, or null if not available.getS()Shortcut forgetStatus().getSampleBigDecimal(DatumSamplesType type, String key) Get a BigDecimal value from a sample map, or null if not available.Get a merged map of all sample data.Get specific sample data.getSampleDouble(DatumSamplesType type, String key) Get a Double value from a sample map, or null if not available.getSampleFloat(DatumSamplesType type, String key) Get a Float value from a sample map, or null if not available.getSampleInteger(DatumSamplesType type, String key) Get an Integer value from a sample map, or null if not available.getSampleLong(DatumSamplesType type, String key) Get a Long value from a sample map, or null if not available.getSampleString(DatumSamplesType type, String key) Get a String value from a sample map, or null if not available.<V> VgetSampleValue(DatumSamplesType type, String key) Get a sample value.Get a map of status sample values.Get a BigDecimal value from thegetInstantaneous()map, or null if not available.Get a Double value from thegetInstantaneous()map, or null if not available.Get a Float value from thegetInstantaneous()map, or null if not available.Get an Integer value from thegetInstantaneous()map, or null if not available.Get a Long value from thegetInstantaneous()map, or null if not available.Get a String value from thegetStatus()map, or null if not available.inthashCode()booleanhasSampleValue(String key) Test is a sample value is present for a given key.booleanhasSampleValue(DatumSamplesType type, String key) Test is a sample value is present for a given key.booleanisEmpty()Test if there are any properties configured in the instantaneous, accumulating, status, or tag data sets.voidputAccumulatingSampleValue(String key, Number n) Put a value into or remove a value from thegetAccumulating()map, creating the map if it doesn't exist.voidputInstantaneousSampleValue(String key, Number n) Put a value into or remove a value from thegetInstantaneous()map, creating the map if it doesn't exist.voidputSampleValue(DatumSamplesType type, String key, Object value) Add a value into or remove a value from a sample type collection, creating the collection if it doesn't already exist.voidputStatusSampleValue(String key, Object value) Put a value into or remove a value from thegetStatus()map, creating the map if it doesn't exist.voidvoidsetAccumulating(Map<String, Number> accumulating) voidvoidsetInstantaneous(Map<String, Number> instantaneous) voidvoidsetSampleData(DatumSamplesType type, Map<String, ?> data) Set specific sample data.voidtoString()Methods inherited from class net.solarnetwork.domain.datum.DatumSupport
addTag, getMapBigDecimal, getMapDouble, getMapFloat, getMapInteger, getMapLong, getMapString, getT, getTags, hasTag, removeTag, setT, setTagsMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface net.solarnetwork.domain.datum.DatumSamplesOperations
differsFrom, getTags, hasTag
-
Constructor Details
-
DatumSamples
public DatumSamples()Default constructor. -
DatumSamples
public DatumSamples(Map<String, Number> instantaneous, Map<String, Number> accumulating, Map<String, Object> status) Construct with values.- Parameters:
instantaneous- the instantaneous dataaccumulating- the accumulating datastatus- the status data
-
DatumSamples
Copy constructor.- Parameters:
other- the samples to copy- Since:
- 1.4
-
-
Method Details
-
toString
-
clear
public void clear()Clear all property values.- Specified by:
clearin interfaceMutableDatumSamplesOperations- Overrides:
clearin classDatumSupport
-
getSampleData
Get a merged map of all sample data.- Returns:
- a map with all sample data combined
-
isEmpty
public boolean isEmpty()Test if there are any properties configured in the instantaneous, accumulating, status, or tag data sets.- Specified by:
isEmptyin interfaceDatumSamplesOperations- Returns:
- true if there is at least one value in one of the data sets of this object
- Since:
- 1.3
-
getSampleData
Description copied from interface:DatumSamplesOperationsGet specific sample data.- Specified by:
getSampleDatain interfaceDatumSamplesOperations- Parameters:
type- the type of sample data to get- Returns:
- a map with the specific sample data, or null
-
setSampleData
Description copied from interface:MutableDatumSamplesOperationsSet specific sample data.In the case of
DatumSamplesType.Tagthe keys ofdatawill be used as the tag values to save.- Specified by:
setSampleDatain interfaceMutableDatumSamplesOperations- Parameters:
type- the type of sample data to setdata- the data to set; this is cast to the appropriate type without checking
-
getSampleInteger
Description copied from interface:DatumSamplesOperationsGet an Integer value from a sample map, or null if not available.- Specified by:
getSampleIntegerin interfaceDatumSamplesOperations- Parameters:
type- the type of sample data to getkey- the key of the value to get- Returns:
- the value as an Integer, or null if not available
-
getSampleLong
Description copied from interface:DatumSamplesOperationsGet a Long value from a sample map, or null if not available.- Specified by:
getSampleLongin interfaceDatumSamplesOperations- Parameters:
type- the type of sample data to getkey- the key of the value to get- Returns:
- the value as an Long, or null if not available
-
getSampleFloat
Description copied from interface:DatumSamplesOperationsGet a Float value from a sample map, or null if not available.- Specified by:
getSampleFloatin interfaceDatumSamplesOperations- Parameters:
type- the type of sample data to getkey- the key of the value to get- Returns:
- the value as an Float, or null if not available
-
getSampleDouble
Description copied from interface:DatumSamplesOperationsGet a Double value from a sample map, or null if not available.- Specified by:
getSampleDoublein interfaceDatumSamplesOperations- Parameters:
type- the type of sample data to getkey- the key of the value to get- Returns:
- the value as an Double, or null if not available
-
getSampleBigDecimal
Description copied from interface:DatumSamplesOperationsGet a BigDecimal value from a sample map, or null if not available.- Specified by:
getSampleBigDecimalin interfaceDatumSamplesOperations- Parameters:
type- the type of sample data to getkey- the key of the value to get- Returns:
- the value as an BigDecimal, or null if not available
-
getSampleString
Description copied from interface:DatumSamplesOperationsGet a String value from a sample map, or null if not available.If
typeisDatumSamplesType.Tag, then this method will returnkeyif a tag by that name exists and otherwise it will return null.- Specified by:
getSampleStringin interfaceDatumSamplesOperations- Parameters:
type- the type of sample data to getkey- the key of the value, or tag name, to get- Returns:
- the value as an String, or null if not available
-
getSampleValue
Description copied from interface:DatumSamplesOperationsGet a sample value.If
typeisDatumSamplesType.Tag, then this method will returnkeyif a tag by that name exists and otherwise it will return null.- Specified by:
getSampleValuein interfaceDatumSamplesOperations- Type Parameters:
V- the expected value type- Parameters:
type- the type of sample data to getkey- the key of the value, or tag name, to get- Returns:
- the value cast as a
V, or null if not available
-
findSampleValue
Description copied from interface:DatumSamplesOperationsFind a sample value.This will search
Instantaneous,Accumulating, andStatusdata types, in that order, and return the first non-null value found.- Specified by:
findSampleValuein interfaceDatumSamplesOperations- Type Parameters:
V- the expected value type- Parameters:
key- the key of the value, or tag name, to get- Returns:
- the value cast as a
V, or null if not available
-
hasSampleValue
Description copied from interface:DatumSamplesOperationsTest is a sample value is present for a given key.This will search
Instantaneous,Accumulating, andStatusdata types, in that order, and return the first non-null value found.- Specified by:
hasSampleValuein interfaceDatumSamplesOperations- Parameters:
key- the key of the value, or name of the tag, to look for- Returns:
- true if a value is present for the given key
-
putSampleValue
Description copied from interface:MutableDatumSamplesOperationsAdd a value into or remove a value from a sample type collection, creating the collection if it doesn't already exist.To add a tag, pass the tag name for both
keyandvalue. To remove a tag, pass the tag name forkeyand null forvalue. To replace a tag, pass the tag to remove forkeyand the tag to add asvalue.For
DatumSamplesType.InstantaneousandDatumSamplesType.Accumulatingifvalueis non-null but not aNumber, it will be silently ignored.- Specified by:
putSampleValuein interfaceMutableDatumSamplesOperations- Parameters:
type- the type of sample data to getkey- the key to put, or tag to add/remove forDatumSamplesType.Tagvalue- the value to put, or tag to add, or null to remove the value; this will be cast without checking
-
hasSampleValue
Description copied from interface:DatumSamplesOperationsTest is a sample value is present for a given key.Tags can be tested for as well by passing
DatumSamplesType.Tagand the tag name askey.- Specified by:
hasSampleValuein interfaceDatumSamplesOperations- Parameters:
type- the type of sample data to testkey- the key of the value, or name of the tag, to look for- Returns:
- true if a value is present for the given key
-
putInstantaneousSampleValue
Put a value into or remove a value from thegetInstantaneous()map, creating the map if it doesn't exist.- Parameters:
key- the key to putn- the value to put, or null to remove the key
-
putAccumulatingSampleValue
Put a value into or remove a value from thegetAccumulating()map, creating the map if it doesn't exist.- Parameters:
key- the key to putn- the value to put, or null to remove the key
-
putStatusSampleValue
Put a value into or remove a value from thegetStatus()map, creating the map if it doesn't exist.- Parameters:
key- the key to putvalue- the value to put, or null to remove the key
-
getInstantaneousSampleInteger
Get an Integer value from thegetInstantaneous()map, or null if not available.- Parameters:
key- the key of the value to get- Returns:
- the value as an Integer, or null if not available
-
getInstantaneousSampleLong
Get a Long value from thegetInstantaneous()map, or null if not available.- Parameters:
key- the key of the value to get- Returns:
- the value as an Long, or null if not available
-
getInstantaneousSampleFloat
Get a Float value from thegetInstantaneous()map, or null if not available.- Parameters:
key- the key of the value to get- Returns:
- the value as an Float, or null if not available
-
getInstantaneousSampleDouble
Get a Double value from thegetInstantaneous()map, or null if not available.- Parameters:
key- the key of the value to get- Returns:
- the value as an Double, or null if not available
-
getInstantaneousSampleBigDecimal
Get a BigDecimal value from thegetInstantaneous()map, or null if not available.- Parameters:
key- the key of the value to get- Returns:
- the value as an BigDecimal, or null if not available
-
getAccumulatingSampleInteger
Get an Integer value from thegetAccumulating()map, or null if not available.- Parameters:
key- the key of the value to get- Returns:
- the value as an Integer, or null if not available
-
getAccumulatingSampleLong
Get a Long value from thegetAccumulating()map, or null if not available.- Parameters:
key- the key of the value to get- Returns:
- the value as an Long, or null if not available
-
getAccumulatingSampleFloat
Get a Float value from thegetAccumulating()map, or null if not available.- Parameters:
key- the key of the value to get- Returns:
- the value as an Float, or null if not available
-
getAccumulatingSampleDouble
Get a Double value from thegetAccumulating()map, or null if not available.- Parameters:
key- the key of the value to get- Returns:
- the value as an Double, or null if not available
-
getAccumulatingSampleBigDecimal
Get a BigDecimal value from thegetAccumulating()map, or null if not available.- Parameters:
key- the key of the value to get- Returns:
- the value as an BigDecimal, or null if not available
-
getStatusSampleInteger
Get an Integer value from thegetInstantaneous()map, or null if not available.- Parameters:
key- the key of the value to get- Returns:
- the value as an Integer, or null if not available
-
getStatusSampleLong
Get a Long value from thegetInstantaneous()map, or null if not available.- Parameters:
key- the key of the value to get- Returns:
- the value as an Long, or null if not available
-
getStatusSampleFloat
Get a Float value from thegetInstantaneous()map, or null if not available.- Parameters:
key- the key of the value to get- Returns:
- the value as an Float, or null if not available
-
getStatusSampleDouble
Get a Double value from thegetInstantaneous()map, or null if not available.- Parameters:
key- the key of the value to get- Returns:
- the value as an Double, or null if not available
-
getStatusSampleBigDecimal
Get a BigDecimal value from thegetInstantaneous()map, or null if not available.- Parameters:
key- the key of the value to get- Returns:
- the value as an BigDecimal, or null if not available
-
getStatusSampleString
Get a String value from thegetStatus()map, or null if not available.- Parameters:
key- the key of the value to get- Returns:
- the value as a String, or null if not available
-
hashCode
public int hashCode() -
equals
-
getI
Shortcut forgetInstantaneous().- Returns:
- map
-
setI
-
getA
Shortcut forgetAccumulating().- Returns:
- map
-
setA
-
getS
Shortcut forgetStatus().- Returns:
- map
-
setS
-
getInstantaneous
Get a map of instantaneous sample values. These values measure instant readings of something.- Returns:
- map of instantaneous measurements
-
setInstantaneous
-
getAccumulating
Get a map accumulating sample values. These values measure an accumulating data value, whose values represent an offset from another sample on a different date.- Returns:
- map of accumulating measurements
-
setAccumulating
-
getStatus
Get a map of status sample values. These are arbitrary values.- Returns:
- map of status messages
-
setStatus
-