Class ExpressionRoot
- All Implemented Interfaces:
Map<String,,Object> net.solarnetwork.domain.datum.DatumExpressionRoot,net.solarnetwork.domain.datum.DatumMathFunctions
ExpressionService evaluation.
This object extends DatumSamplesExpressionRoot to allow all datum
sample properties to be exposed as top-level expression properties (via the
Map API).
- Since:
- 1.79
- Version:
- 2.1
- Author:
- matt
-
Nested Class Summary
Nested classes/interfaces inherited from class java.util.AbstractMap
AbstractMap.SimpleEntry<K extends Object,V extends Object>, AbstractMap.SimpleImmutableEntry<K extends Object, V extends Object> -
Constructor Summary
ConstructorsConstructorDescriptionExpressionRoot(Map<String, ?> data, net.solarnetwork.domain.datum.Datum datum) Constructor.ExpressionRoot(net.solarnetwork.domain.datum.Datum datum) Constructor.ExpressionRoot(net.solarnetwork.domain.datum.Datum datum, net.solarnetwork.domain.datum.DatumSamplesOperations samples) Constructor.ExpressionRoot(net.solarnetwork.domain.datum.Datum datum, net.solarnetwork.domain.datum.DatumSamplesOperations samples, Map<String, ?> parameters, DatumService datumService) Constructor.ExpressionRoot(net.solarnetwork.domain.datum.Datum datum, net.solarnetwork.domain.datum.DatumSamplesOperations samples, Map<String, ?> parameters, DatumService datumService, OperationalModesService opModesService) Constructor. -
Method Summary
Modifier and TypeMethodDescriptionnet.solarnetwork.domain.datum.DatumMetadataOperationsgetMeta()Get the metadata for thegetSourceId()datum stream.Get the datum's source ID.Get the datum's timestamp.booleanTest if a "latest" datum is available for a given source ID.booleanhasLatestMatching(String sourceIdPattern) Test if a "latest" datum is available for a given source ID.booleanhasLatestOthersMatching(String sourceIdPattern) Test if a "latest" datum is available for a given source ID, excluding thegetSourceId()source ID.booleanhasMeta()Test if metadata for thegetSourceId()datum stream is available.booleanTest if metadata for a given datum stream is available.booleanhasOffset(int offset) Test if an offset from a "latest" datum is available for theDatumSamplesExpressionRoot.getDatum()source ID and timestamp.booleanTest if an offset from a "latest" datum is available for a given source ID.booleanTest if a datum offset from a given timestamp is available for a given source ID.booleanTest if an operational mode is active.net.solarnetwork.domain.datum.DatumExpressionRootGet the latest available datum for a given source ID, as anDatumExpressionRoot.Collection<net.solarnetwork.domain.datum.DatumExpressionRoot>latestMatching(String sourceIdPattern) Get the latest available datum matching a given source ID pattern, asDatumExpressionRootinstances.Collection<net.solarnetwork.domain.datum.DatumExpressionRoot>latestOthersMatching(String sourceIdPattern) Get the latest available datum matching a given source ID pattern, excluding thegetSourceId()source ID, asDatumExpressionRootinstances.net.solarnetwork.domain.datum.DatumMetadataOperationsGet the metadata for a given datum stream.Collection<net.solarnetwork.domain.datum.DatumMetadataOperations>metaMatching(String sourceIdFilter) Get the metadata for a set of datum streams matching a filter.net.solarnetwork.domain.datum.DatumExpressionRootoffset(int offset) Get an offset from latest available datum for theDatumSamplesExpressionRoot.getDatum()source ID and timestamp, as anDatumExpressionRoot.net.solarnetwork.domain.datum.DatumExpressionRootGet an offset from latest available datum for a given source ID, as anDatumExpressionRoot.net.solarnetwork.domain.datum.DatumExpressionRootGet a datum offset from a given timestamp for a given source ID, as anDatumExpressionRoot.Collection<net.solarnetwork.domain.datum.DatumExpressionRoot>selfAndLatestMatching(String sourceIdPattern) Get the latest available datum matching a given source ID pattern, including this instance, asDatumExpressionRootinstances.toString()Methods inherited from class net.solarnetwork.domain.datum.DatumSamplesExpressionRoot
containsKey, entrySet, get, getData, getDatum, getParameters, getProps, getSamples, group, hasMethods inherited from class java.util.AbstractMap
clear, clone, containsValue, equals, hashCode, isEmpty, keySet, put, putAll, remove, size, valuesMethods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface net.solarnetwork.domain.datum.DatumMathFunctions
and, andNot, avg, ceil, ceil, decimal, down, down, floor, floor, integer, max, max, min, min, mround, narrow, narrow16, narrow32, narrow64, narrow8, not, or, round, round, roundDown, roundUp, shiftLeft, shiftRight, sum, testBit, up, up, xorMethods inherited from interface java.util.Map
clear, compute, computeIfAbsent, computeIfPresent, containsValue, equals, forEach, getOrDefault, hashCode, isEmpty, keySet, merge, put, putAll, putIfAbsent, remove, remove, replace, replace, replaceAll, size, values
-
Constructor Details
-
ExpressionRoot
public ExpressionRoot(net.solarnetwork.domain.datum.Datum datum) Constructor.- Parameters:
datum- the datum currently being populated
-
ExpressionRoot
public ExpressionRoot(net.solarnetwork.domain.datum.Datum datum, net.solarnetwork.domain.datum.DatumSamplesOperations samples) Constructor.- Parameters:
datum- the datum currently being populatedsamples- the samples
-
ExpressionRoot
Constructor.- Parameters:
data- the map datadatum- the datum currently being populated- Since:
- 1.2
-
ExpressionRoot
public ExpressionRoot(net.solarnetwork.domain.datum.Datum datum, net.solarnetwork.domain.datum.DatumSamplesOperations samples, Map<String, ?> parameters, DatumService datumService) Constructor.- Parameters:
datum- the datum currently being populatedsamples- the samplesparameters- the parametersdatumService- the optional datum service
-
ExpressionRoot
public ExpressionRoot(net.solarnetwork.domain.datum.Datum datum, net.solarnetwork.domain.datum.DatumSamplesOperations samples, Map<String, ?> parameters, DatumService datumService, OperationalModesService opModesService) Constructor.- Parameters:
datum- the datum currently being populatedsamples- the samplesparameters- the parametersdatumService- the optional datum serviceopModesService- the optional operational modes service- Since:
- 2.1
-
-
Method Details
-
toString
- Overrides:
toStringin classAbstractMap<String,Object>
-
hasLatest
Test if a "latest" datum is available for a given source ID.This can be used to test if
latest(String)will return a non-null value.- Parameters:
sourceId- the source ID of the datum to look for- Returns:
- true if
latest(String)for the givensourceIdwill return a non-null value
-
latest
Get the latest available datum for a given source ID, as anDatumExpressionRoot.Note a non-null
DatumServiceinstance must have been provided to the constructor of this instance for this method to work.- Parameters:
sourceId- the source ID of the datum to look for- Returns:
- the latest datum, or null if
sourceIdis null, theDatumServiceprovided to this instance's constructor was null, orDatumService.latest(java.util.Set, Class)returns null for the givensourceId
-
hasLatestMatching
Test if a "latest" datum is available for a given source ID.This can be used to test if
latestMatching(String)will return a non-null value.- Parameters:
sourceIdPattern- the Ant-style source ID pattern of the datum to look for- Returns:
- true if
latestMatching(String)for the givensourceIdPatternwill return a non-null value
-
latestMatching
public Collection<net.solarnetwork.domain.datum.DatumExpressionRoot> latestMatching(String sourceIdPattern) Get the latest available datum matching a given source ID pattern, asDatumExpressionRootinstances.Note a non-null
DatumServiceinstance must have been provided to the constructor of this instance for this method to work.- Parameters:
sourceIdPattern- the Ant-style source ID pattern of the datum to look for- Returns:
- the matching datum, never null
-
hasLatestOthersMatching
Test if a "latest" datum is available for a given source ID, excluding thegetSourceId()source ID.This can be used to test if
latestOthersMatching(String)will return a non-null value.- Parameters:
sourceIdPattern- the Ant-style source ID pattern of the datum to look for- Returns:
- true if
latestMatching(String)for the givensourceIdPatternwill return a non-null value
-
latestOthersMatching
public Collection<net.solarnetwork.domain.datum.DatumExpressionRoot> latestOthersMatching(String sourceIdPattern) Get the latest available datum matching a given source ID pattern, excluding thegetSourceId()source ID, asDatumExpressionRootinstances.Note a non-null
DatumServiceinstance must have been provided to the constructor of this instance for this method to work.- Parameters:
sourceIdPattern- the Ant-style source ID pattern of the datum to look for- Returns:
- the matching datum, never null
-
selfAndLatestMatching
public Collection<net.solarnetwork.domain.datum.DatumExpressionRoot> selfAndLatestMatching(String sourceIdPattern) Get the latest available datum matching a given source ID pattern, including this instance, asDatumExpressionRootinstances.Note a non-null
DatumServiceinstance must have been provided to the constructor of this instance for this method to work.- Parameters:
sourceIdPattern- the Ant-style source ID pattern of the datum to look for- Returns:
- the matching datum, never null and always having at least one value (this instance)
-
getSourceId
Get the datum's source ID.- Returns:
- the source ID, or null
- Since:
- 2.1
-
getTimestamp
Get the datum's timestamp.- Returns:
- the timestamp, or null
- Since:
- 2.1
-
hasOffset
public boolean hasOffset(int offset) Test if an offset from a "latest" datum is available for theDatumSamplesExpressionRoot.getDatum()source ID and timestamp.This can be used to test if
offset(int)will return a non-null value.- Parameters:
offset- the offset from the latest, 0 being the latest and 1 the next later, and so on- Returns:
- true if
offset(String, Instant, int)will return a non-null value - Since:
- 2.1
- See Also:
-
offset
public net.solarnetwork.domain.datum.DatumExpressionRoot offset(int offset) Get an offset from latest available datum for theDatumSamplesExpressionRoot.getDatum()source ID and timestamp, as anDatumExpressionRoot.Note a non-null
DatumServiceinstance must have been provided to the constructor of this instance for this method to work.- Parameters:
offset- the offset from the latest, 0 being the latest and 1 the next later, and so on- Returns:
- the offset from the latest datum, or null if
getSourceId()orgetTimestamp()are null, theDatumServiceprovided to this instance's constructor was null, orDatumService.offset(java.util.Set, int, Class)returns null forgetSourceId() - Since:
- 2.1
- See Also:
-
hasOffset
Test if an offset from a "latest" datum is available for a given source ID.This can be used to test if
offset(String,int)will return a non-null value.- Parameters:
sourceId- the source ID of the datum to look foroffset- the offset from the latest, 0 being the latest and 1 the next later, and so on- Returns:
- true if
offset(String, int)for the givensourceIdwill return a non-null value - Since:
- 2.1
-
offset
Get an offset from latest available datum for a given source ID, as anDatumExpressionRoot.Note a non-null
DatumServiceinstance must have been provided to the constructor of this instance for this method to work.- Parameters:
sourceId- the source ID of the datum to look foroffset- the offset from the latest, 0 being the latest and 1 the next later, and so on- Returns:
- the offset from the latest datum, or null if
sourceIdis null, theDatumServiceprovided to this instance's constructor was null, orDatumService.offset(java.util.Set, int, Class)returns null for the givensourceId - Since:
- 2.1
-
hasOffset
Test if a datum offset from a given timestamp is available for a given source ID.This can be used to test if
offset(String,Instant,int)will return a non-null value.- Parameters:
sourceId- the source ID of the datum to look fortimestamp- the timestamp refernce pointoffset- the offset from the latest, 0 being the latest and 1 the next later, and so on- Returns:
- true if
offset(String, int)for the givensourceIdwill return a non-null value - Since:
- 2.1
-
offset
public net.solarnetwork.domain.datum.DatumExpressionRoot offset(String sourceId, Instant timestamp, int offset) Get a datum offset from a given timestamp for a given source ID, as anDatumExpressionRoot.Note a non-null
DatumServiceinstance must have been provided to the constructor of this instance for this method to work.- Parameters:
sourceId- the source ID of the datum to look fortimestamp- the timestamp reference pointoffset- the offset from the latest, 0 being the latest and 1 the next later, and so on- Returns:
- the offset from the latest datum, or null if
sourceIdis null, theDatumServiceprovided to this instance's constructor was null, orDatumService.offset(java.util.Set, int, Class)returns null for the givensourceId - Since:
- 2.1
-
isOpMode
Test if an operational mode is active.- Parameters:
mode- the mode to test- Returns:
- true if the
OperationalModesServiceprovided to this instance's constructor was not null andOperationalModesService.isOperationalModeActive(String)returns true for the given mode - Since:
- 2.1
- See Also:
-
hasMeta
public boolean hasMeta()Test if metadata for thegetSourceId()datum stream is available.- Returns:
- true if metadata for
getSourceId()is available - Since:
- 2.1
-
getMeta
public net.solarnetwork.domain.datum.DatumMetadataOperations getMeta()Get the metadata for thegetSourceId()datum stream.- Returns:
- the metadata, or null if no such metadata is available
- Since:
- 2.1
-
hasMeta
Test if metadata for a given datum stream is available.- Parameters:
sourceId- the source ID of the datum metadata to get- Returns:
- true if metadata for
sourceIdis available - Since:
- 2.1
-
meta
Get the metadata for a given datum stream.- Parameters:
sourceId- the source ID of the datum metadata to get- Returns:
- the metadata, or null if no such metadata is available
- Since:
- 2.1
-
metaMatching
public Collection<net.solarnetwork.domain.datum.DatumMetadataOperations> metaMatching(String sourceIdFilter) Get the metadata for a set of datum streams matching a filter.- Parameters:
sourceIdFilter- an optional Ant-style source ID pattern to filter by; use null to return metadata for all available sources- Returns:
- the matching metadata, never null
- Since:
- 2.1
-