Record Class DiffLine

java.lang.Object
java.lang.Record
com.enhancedechest.log.DiffLine

public record DiffLine(String itemKey, int delta) extends Record
One line of a CLOSE event's change summary: how the amount of a single item kind changed over the visit. delta > 0 means that many were put into the chest, delta < 0 that many taken out. itemKey is a namespaced material key (e.g. minecraft:diamond).

Material-level on purpose. The summary totals by material, not by full item identity, so a swap of two differently-enchanted swords of the same material nets to zero here. That is a readable headline, not the source of truth: the exact before/after contents are the OPEN and CLOSE snapshots, viewable by clicking the entry. Keeping the summary at material level is what lets it render as a localized item name with no stored text and no per-viewer work at write time.

  • Constructor Summary

    Constructors
    Constructor
    Description
    DiffLine(String itemKey, int delta)
    Creates an instance of a DiffLine record class.
  • Method Summary

    Modifier and Type
    Method
    Description
    int
    Returns the value of the delta record component.
    final boolean
    Indicates whether some other object is "equal to" this one.
    final int
    Returns a hash code value for this object.
    Returns the value of the itemKey record component.
    final String
    Returns a string representation of this record class.

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait
  • Constructor Details

    • DiffLine

      public DiffLine(String itemKey, int delta)
      Creates an instance of a DiffLine record class.
      Parameters:
      itemKey - the value for the itemKey record component
      delta - the value for the delta 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. Reference components are compared with Objects::equals(Object,Object); primitive components are compared with '=='.
      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.
    • itemKey

      public String itemKey()
      Returns the value of the itemKey record component.
      Returns:
      the value of the itemKey record component
    • delta

      public int delta()
      Returns the value of the delta record component.
      Returns:
      the value of the delta record component