Package net.solarnetwork.domain.datum
Interface MutableDatumSamplesOperations
- All Superinterfaces:
DatumSamplesOperations,Differentiable<DatumSamplesOperations>
- All Known Implementing Classes:
DatumSamples,GeneralDatum,MapSampleOperations
Extension of
DatumSamplesOperations that adds mutate operations.- Since:
- 2.0
- Version:
- 1.1
- Author:
- matt
-
Method Summary
Modifier and TypeMethodDescriptiondefault booleanAdd a tag.voidclear()Remove all property values and tags.default voidcopyFrom(DatumSamplesOperations other) Copy all the sample data from another samples instance.default voidmergeFrom(DatumSamplesOperations other) Merge all the sample data from another samples instance, overwriting any duplicate properties in this instance.default voidmergeFrom(DatumSamplesOperations other, boolean overwrite) Merge all the sample data from another samples instance.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.default booleanRemove one or more tags.voidsetSampleData(DatumSamplesType type, Map<String, ?> data) Set specific sample data.voidSet the tags.Methods inherited from interface net.solarnetwork.domain.datum.DatumSamplesOperations
differsFrom, findSampleValue, getSampleBigDecimal, getSampleData, getSampleDouble, getSampleFloat, getSampleInteger, getSampleLong, getSampleString, getSampleValue, getTags, hasSampleValue, hasSampleValue, hasTag, isEmpty
-
Method Details
-
clear
void clear()Remove all property values and tags. -
putSampleValue
Add 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.- 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
-
setSampleData
Set specific sample data.In the case of
DatumSamplesType.Tagthe keys ofdatawill be used as the tag values to save.- Parameters:
type- the type of sample data to setdata- the data to set; this is cast to the appropriate type without checking- Throws:
IllegalArgumentException- iftypeis not supported
-
setTags
Set the tags.- Parameters:
tags- the tags to set
-
addTag
Add a tag.- Parameters:
tag- the tag value to add- Returns:
- true if the tag was not already present
-
removeTag
Remove one or more tags.- Parameters:
tags- the tags to remove- Returns:
- true if any of the given tags were removed
-
copyFrom
Copy all the sample data from another samples instance.- Parameters:
other- the instance to copy the sample data from
-
mergeFrom
Merge all the sample data from another samples instance, overwriting any duplicate properties in this instance.- Parameters:
other- the instance to merge the sample data from
-
mergeFrom
Merge all the sample data from another samples instance.- Parameters:
other- the instance to merge the sample data fromoverwrite- true to replace any duplicate properties in this instance with those fromother, false to skip duplicate properties and preserve the values from this instance
-