Record Class Copy

java.lang.Object
java.lang.Record
com.j3d.engine.scene.copy.Copy
Record Components:
original - The UUID of the original GObject from which this copy was made.
copy - The GObject instance that is the actual copy.

public record Copy(UUID original, GObject copy) extends Record
Represents a copy of a GObject, linking it back to its original.

The equality and hash code stuff are based solely on the original UUID, meaning two Copy instances are considered equal if they refer to the same original object, regardless of the actual GObject instance they hold as a copy.

Author:
Lehlogonolo Poole
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    private final GObject
    The field for the copy record component.
    private final UUID
    The field for the original record component.
  • Constructor Summary

    Constructors
    Constructor
    Description
    Copy(UUID original, GObject copy)
    Creates an instance of a Copy record class.
  • Method Summary

    Modifier and Type
    Method
    Description
    Returns the value of the copy record component.
    boolean
    Compares this Copy object with the specified object for equality.
    int
    Returns a hash code value for this Copy object.
    boolean
    is(UUID id)
    Checks if this Copy instance refers to a specific original GObject by comparing its original UUID with the given ID.
    Returns the value of the original 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
  • Field Details

    • original

      private final UUID original
      The field for the original record component.
    • copy

      private final GObject copy
      The field for the copy record component.
  • Constructor Details

    • Copy

      public Copy(UUID original, GObject copy)
      Creates an instance of a Copy record class.
      Parameters:
      original - the value for the original record component
      copy - the value for the copy record component
  • Method Details

    • is

      public boolean is(UUID id)
      Checks if this Copy instance refers to a specific original GObject by comparing its original UUID with the given ID.
      Parameters:
      id - The UUID of the original GObject to check against.
      Returns:
      true if this copy's original ID matches the given ID, false otherwise.
    • equals

      public boolean equals(Object o)
      Compares this Copy object with the specified object for equality.
      Specified by:
      equals in class Record
      Parameters:
      o - The object to compare with.
      Returns:
      true if the specified object is equal to this Copy object, false otherwise.
    • hashCode

      public int hashCode()
      Returns a hash code value for this Copy object.
      Specified by:
      hashCode in class Record
      Returns:
      A hash code value for this object.
    • 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
    • original

      public UUID original()
      Returns the value of the original record component.
      Returns:
      the value of the original record component
    • copy

      public GObject copy()
      Returns the value of the copy record component.
      Returns:
      the value of the copy record component