Record Class SourceChangePoint

java.lang.Object
java.lang.Record
com.inductiveautomation.historian.common.model.data.SourceChangePoint
Record Components:
value - the old and new source paths.
timestamp - when the change occurred.
All Implemented Interfaces:
ChangePoint<SourceChangePoint.SourceMapKey>, TemporalPoint<SourceChangePoint.SourceMapKey, ChangePointType>, Comparable<TemporalPoint<SourceChangePoint.SourceMapKey, ChangePointType>>

public record SourceChangePoint(SourceChangePoint.SourceMapKey value, Instant timestamp) extends Record implements ChangePoint<SourceChangePoint.SourceMapKey>
A change to a source: a rename from an old path to a new one, or a retirement of the old path.
  • Constructor Details

    • SourceChangePoint

      public SourceChangePoint(SourceChangePoint.SourceMapKey value, Instant timestamp)
      Creates a point. A null timestamp defaults to now.
      Parameters:
      value - the change; must not be null.
      timestamp - the time of the change.
  • Method Details

    • source

      public QualifiedPath source()
      Returns the old source path.
      Specified by:
      source in interface TemporalPoint<SourceChangePoint.SourceMapKey, ChangePointType>
      Returns:
      the old source.
    • type

      public StandardChangePointType type()
      Specified by:
      type in interface ChangePoint<SourceChangePoint.SourceMapKey>
      Specified by:
      type in interface TemporalPoint<SourceChangePoint.SourceMapKey, ChangePointType>
      Returns:
      the point type.
    • oldSource

      public QualifiedPath oldSource()
      Returns the old source path.
      Returns:
      the old source.
    • newSource

      public QualifiedPath newSource()
      Returns the new source path.
      Returns:
      the new source, or null for a retirement.
    • isRetirement

      public boolean isRetirement()
      Returns whether this change retires the source, meaning the new source is null.
      Returns:
      true for a retirement.
    • isDeletion

      public boolean isDeletion()
      Returns whether this change retires the source; equivalent to isRetirement().
      Specified by:
      isDeletion in interface ChangePoint<SourceChangePoint.SourceMapKey>
      Returns:
      true for a retirement.
    • retirement

      public static SourceChangePoint retirement(QualifiedPath oldSource)
      Creates a retirement timestamped now.
      Parameters:
      oldSource - the source being retired; must not be null.
      Returns:
      the new point.
    • retirement

      public static SourceChangePoint retirement(QualifiedPath oldSource, Instant timestamp)
      Creates a retirement.
      Parameters:
      oldSource - the source being retired; must not be null.
      timestamp - the time of the retirement; must not be null.
      Returns:
      the new point.
    • update

      public static SourceChangePoint update(QualifiedPath oldSource, QualifiedPath newSource)
      Creates a rename timestamped now.
      Parameters:
      oldSource - the old path; must not be null.
      newSource - the new path; must not be null.
      Returns:
      the new point.
    • update

      public static SourceChangePoint update(QualifiedPath oldSource, QualifiedPath newSource, Instant timestamp)
      Creates a rename.
      Parameters:
      oldSource - the old path; must not be null.
      newSource - the new path; must not be null.
      timestamp - the time of the rename; must not be null.
      Returns:
      the new point.
    • merge

      public static SourceChangePoint merge(@Nullable SourceChangePoint earlier, SourceChangePoint later)
      Returns the net effect of earlier followed by later, so A->B then B->C becomes A->C, with later's timestamp. If later is a retirement, the result retires earlier.oldSource(). If earlier is null, returns later.

      The changes must form a chain, earlier.newSource() equal to later.oldSource(); merging unrelated changes silently drops later.oldSource().

      Parameters:
      earlier - the prior change in the chain, or null.
      later - the next change in the chain; must not be null.
      Returns:
      the merged change.
    • toString

      public final String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared with Objects::equals(Object,Object).
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • value

      Returns the value of the value record component.
      Specified by:
      value in interface ChangePoint<SourceChangePoint.SourceMapKey>
      Specified by:
      value in interface TemporalPoint<SourceChangePoint.SourceMapKey, ChangePointType>
      Returns:
      the value of the value record component
    • timestamp

      public Instant timestamp()
      Returns the value of the timestamp record component.
      Specified by:
      timestamp in interface TemporalPoint<SourceChangePoint.SourceMapKey, ChangePointType>
      Returns:
      the value of the timestamp record component