Record Class PConflict

java.lang.Object
java.lang.Record
ai.badmonkey.agentspaces.pdt.refs.PConflict
Record Components:
name - the ref name
key - the key the decision was about, or null when a whole head was taken
winnerRoot - the root of the head whose value was kept
loserRoot - the root of the head whose value was dropped
reason - why: the later issued HLC, a registered merge function, or the missing common base of PD-R-06

public record PConflict(String name, String key, String winnerRoot, String loserRoot, String reason) extends Record
A key changed on both sides of a merge to different values, or a whole head taken over another (srad/agentspaces-pdt.md §3.6.1, PD-R-05, PD-R-06). A reader records one event per decision, delivers it to the listeners of Ref.onConflict(Consumer), and counts it in Pdt.stats().conflicts().
  • Field Details

    • LATER_HLC

      public static final String LATER_HLC
      The reason when both sides changed a key and the later issued head took it.
      See Also:
    • WHOLE_HEAD

      public static final String WHOLE_HEAD
      The reason when a vector or blob has no registered merge function.
      See Also:
    • NO_COMMON_BASE

      public static final String NO_COMMON_BASE
      The reason when the base walk of PD-R-06 found no common base within its bound.
      See Also:
    • MERGE_FUNCTION_FAILED

      public static final String MERGE_FUNCTION_FAILED
      The reason when a registered merge function threw or returned null, so the rule of §3.6.1 decided instead.
      See Also:
  • Constructor Details

    • PConflict

      public PConflict(String name, String key, String winnerRoot, String loserRoot, String reason)
      Creates an instance of a PConflict record class.
      Parameters:
      name - the value for the name record component
      key - the value for the key record component
      winnerRoot - the value for the winnerRoot record component
      loserRoot - the value for the loserRoot record component
      reason - the value for the reason record component
  • Method Details

    • 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.
    • name

      public String name()
      Returns the value of the name record component.
      Returns:
      the value of the name record component
    • key

      public String key()
      Returns the value of the key record component.
      Returns:
      the value of the key record component
    • winnerRoot

      public String winnerRoot()
      Returns the value of the winnerRoot record component.
      Returns:
      the value of the winnerRoot record component
    • loserRoot

      public String loserRoot()
      Returns the value of the loserRoot record component.
      Returns:
      the value of the loserRoot record component
    • reason

      public String reason()
      Returns the value of the reason record component.
      Returns:
      the value of the reason record component