Package net.solarnetwork.domain.datum
Class DatumProperties
java.lang.Object
net.solarnetwork.domain.datum.DatumProperties
- All Implemented Interfaces:
Serializable
A collection of property values for a datum.
The properties are stored as ordered arrays of values. The meaning of the
values depends on external DatumStreamMetadata. null
values are allowed both as the array fields of this class and as values
within array instances.
- Since:
- 1.72
- Version:
- 1.2
- Author:
- matt
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionaccumulatingValue(int index) Get the value of a specific accumulating property by index.booleanGet the accumulating values.intGet the accumulating values array length.Get the instantaneous values.intGet the instantaneous values array length.intGet the overall number of array property values.String[]Get the status values.intGet the status values array length.String[]getTags()Get the tag values.intGet the tags array length.inthashCode()booleanTest if a specific tag exits (case-insensitive).instantaneousValue(int index) Get the value of a specific instantaneous property by index.static DatumPropertiespropertiesFrom(Datum datum, ObjectDatumStreamMetadata meta) Create a new instance out of a general datum and associated stream metadata.static DatumPropertiespropertiesOf(BigDecimal[] instantaneous, BigDecimal[] accumulating, String[] status, String[] tags) Create a datum properties instance.voidsetAccumulating(BigDecimal[] values) Set the accumulating values.voidsetInstantaneous(BigDecimal[] values) Set the instantaneous values.voidSet the status values.voidSet the tag values.statusValue(int index) Get the value of a specific status property by index.toString()
-
Constructor Details
-
DatumProperties
public DatumProperties()
-
-
Method Details
-
propertiesOf
public static DatumProperties propertiesOf(BigDecimal[] instantaneous, BigDecimal[] accumulating, String[] status, String[] tags) Create a datum properties instance.- Parameters:
instantaneous- the instantaneous valuesaccumulating- the accumulating valuesstatus- the status valuestags- the tag values- Returns:
- the new instance, never null
-
propertiesFrom
public static DatumProperties propertiesFrom(Datum datum, ObjectDatumStreamMetadata meta) throws IllegalArgumentException Create a new instance out of a general datum and associated stream metadata.Note that trailing null values will be removed from the instantaneous, accumulating, and status data arrays.
- Parameters:
datum- the datum to create properties frommeta- the metadata that defines the property order- Returns:
- the properties, or null if
datumis null - Throws:
IllegalArgumentException- if the metadata does not support a property found on the datum
-
hashCode
public int hashCode() -
equals
-
toString
-
getLength
public int getLength()Get the overall number of array property values.This returns the sum of the length of all the array fields of this class.
- Returns:
- the number of values (including null values)
-
getInstantaneousLength
public int getInstantaneousLength()Get the instantaneous values array length.- Returns:
- the number of instantaneous values (including null values)
-
getInstantaneous
Get the instantaneous values.- Returns:
- the instantaneous sample values
-
setInstantaneous
Set the instantaneous values.- Parameters:
values- the values to set
-
instantaneousValue
Get the value of a specific instantaneous property by index.- Parameters:
index- the property index to return- Returns:
- the value, or null if not available
- Since:
- 1.2
-
getAccumulatingLength
public int getAccumulatingLength()Get the accumulating values array length.- Returns:
- the number of accumulating values (including null values)
-
getAccumulating
Get the accumulating values.- Returns:
- the accumulating sample values
-
setAccumulating
Set the accumulating values.- Parameters:
values- the values to set
-
accumulatingValue
Get the value of a specific accumulating property by index.- Parameters:
index- the property index to return- Returns:
- the value, or null if not available
- Since:
- 1.2
-
getStatusLength
public int getStatusLength()Get the status values array length.- Returns:
- the number of status values (including null values)
-
getStatus
Get the status values.- Returns:
- the status sample values
-
setStatus
Set the status values.- Parameters:
status- the values to set
-
statusValue
Get the value of a specific status property by index.- Parameters:
index- the property index to return- Returns:
- the value, or null if not available
- Since:
- 1.2
-
getTagsLength
public int getTagsLength()Get the tags array length.- Returns:
- the number of tags (including null values)
-
getTags
Get the tag values.- Returns:
- the tag values
-
setTags
Set the tag values.- Parameters:
tags- the tags to set
-
hasTag
Test if a specific tag exits (case-insensitive).- Parameters:
tag- the tag to test for- Returns:
- true if the given tag is present in the
getTags()array - Since:
- 1.2
-