Class ProcessDelta

java.lang.Object
neqsim.process.util.export.ProcessDelta
All Implemented Interfaces:
Serializable

public class ProcessDelta extends Object implements Serializable
Represents the difference between two process snapshots.

Process deltas enable efficient synchronization of state changes between NeqSim and external systems, transmitting only changed values rather than full state.

Version:
1.0
Author:
ESOL
See Also:
  • Field Details

  • Constructor Details

    • ProcessDelta

      public ProcessDelta(ProcessSnapshot from, ProcessSnapshot to)
      Creates a delta between two snapshots.
      Parameters:
      from - the baseline snapshot
      to - the current snapshot
  • Method Details

    • computeDifferences

      private void computeDifferences(ProcessSnapshot from, ProcessSnapshot to)
    • getChangedMeasurements

      public Set<String> getChangedMeasurements()
      Gets all changed measurement names.
      Returns:
      set of changed measurement names
    • getNewValue

      public double getNewValue(String name)
      Gets the new value for a measurement.
      Parameters:
      name - measurement name
      Returns:
      new value or NaN if not changed
    • getPreviousValue

      public double getPreviousValue(String name)
      Gets the previous value for a measurement.
      Parameters:
      name - measurement name
      Returns:
      previous value or NaN if not tracked
    • getChange

      public double getChange(String name)
      Gets the change (delta) for a measurement.
      Parameters:
      name - measurement name
      Returns:
      change in value (new - previous) or NaN
    • getRelativeChange

      public double getRelativeChange(String name)
      Gets the relative change for a measurement.
      Parameters:
      name - measurement name
      Returns:
      relative change (new - previous) / previous, or NaN
    • getUnit

      public String getUnit(String name)
      Gets the unit for a changed measurement.
      Parameters:
      name - measurement name
      Returns:
      unit string or null
    • hasChanges

      public boolean hasChanges()
      Checks if there are any changes.
      Returns:
      true if at least one value changed
    • getChangeCount

      public int getChangeCount()
      Gets the number of changed measurements.
      Returns:
      count of changes
    • getAllChanges

      public Map<String,Double> getAllChanges()
      Gets all changes as a map.
      Returns:
      map of measurement names to new values
    • getFromSnapshotId

      public String getFromSnapshotId()
      Gets the source snapshot ID.
      Returns:
      from snapshot ID
    • getToSnapshotId

      public String getToSnapshotId()
      Gets the target snapshot ID.
      Returns:
      to snapshot ID
    • apply

      public ProcessSnapshot apply(ProcessSnapshot base, String newId)
      Applies this delta to a snapshot to produce a new snapshot.
      Parameters:
      base - the base snapshot
      newId - ID for the new snapshot
      Returns:
      updated snapshot
    • toString

      public String toString()
      Overrides:
      toString in class Object