Interface MutableDatumSamplesOperations

All Superinterfaces:
DatumSamplesOperations, Differentiable<DatumSamplesOperations>
All Known Implementing Classes:
DatumSamples, GeneralDatum, MapSampleOperations

public interface MutableDatumSamplesOperations extends DatumSamplesOperations
Extension of DatumSamplesOperations that adds mutate operations.
Since:
2.0
Version:
1.1
Author:
matt
  • Method Details

    • clear

      void clear()
      Remove all property values and tags.
    • putSampleValue

      void putSampleValue(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.

      To add a tag, pass the tag name for both key and value. To remove a tag, pass the tag name for key and null for value. To replace a tag, pass the tag to remove for key and the tag to add as value.

      For DatumSamplesType.Instantaneous and DatumSamplesType.Accumulating if value is non-null but not a Number, it will be silently ignored.

      Parameters:
      type - the type of sample data to get
      key - the key to put, or tag to add/remove for DatumSamplesType.Tag
      value - the value to put, or tag to add, or null to remove the value; this will be cast without checking
    • setSampleData

      void setSampleData(DatumSamplesType type, Map<String,?> data)
      Set specific sample data.

      In the case of DatumSamplesType.Tag the keys of data will be used as the tag values to save.

      Parameters:
      type - the type of sample data to set
      data - the data to set; this is cast to the appropriate type without checking
      Throws:
      IllegalArgumentException - if type is not supported
    • setTags

      void setTags(Set<String> tags)
      Set the tags.
      Parameters:
      tags - the tags to set
    • addTag

      default boolean addTag(String tag)
      Add a tag.
      Parameters:
      tag - the tag value to add
      Returns:
      true if the tag was not already present
    • removeTag

      default boolean removeTag(String... tags)
      Remove one or more tags.
      Parameters:
      tags - the tags to remove
      Returns:
      true if any of the given tags were removed
    • copyFrom

      default void copyFrom(DatumSamplesOperations other)
      Copy all the sample data from another samples instance.
      Parameters:
      other - the instance to copy the sample data from
    • mergeFrom

      default void mergeFrom(DatumSamplesOperations other)
      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

      default void mergeFrom(DatumSamplesOperations other, boolean overwrite)
      Merge all the sample data from another samples instance.
      Parameters:
      other - the instance to merge the sample data from
      overwrite - true to replace any duplicate properties in this instance with those from other, false to skip duplicate properties and preserve the values from this instance