Record Class Reallocator.AlignedReallocator

java.lang.Object
java.lang.Record
dev.pfaff.altargui.io.Reallocator.AlignedReallocator
All Implemented Interfaces:
Reallocator
Enclosing interface:
Reallocator

public static record Reallocator.AlignedReallocator(Reallocator delegate, long byteAlignment) extends Record implements Reallocator
  • Constructor Details

    • AlignedReallocator

      public AlignedReallocator(Reallocator delegate, long byteAlignment)
      Creates an instance of a AlignedReallocator record class.
      Parameters:
      delegate - the value for the delegate record component
      byteAlignment - the value for the byteAlignment record component
  • Method Details

    • reallocate

      public MemorySegment reallocate(MemorySegment segment, long byteSize, long byteAlignment)
      Description copied from interface: Reallocator
      Reallocates the given segment to be the specified size. Upon returning, the original segment may be invalid.
      Specified by:
      reallocate in interface Reallocator
      Parameters:
      segment - the segment to reallocate. This must be either MemorySegment.NULL or the return value of a prior invocation to this method on the same Reallocator instance.
      byteSize - the size (in bytes) of the reallocated segment
      byteAlignment - the alignment (in bytes) of the reallocated segment
      Returns:
      the new segment
    • reallocate

      public MemorySegment reallocate(MemorySegment segment, long byteSize)
      Description copied from interface: Reallocator
      Like Reallocator.reallocate(MemorySegment, long, long) but the byteAlignment is at least 1. This alignment may be increased by a particular Reallocator implementation).
      Specified by:
      reallocate in interface Reallocator
    • 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.
    • delegate

      public Reallocator delegate()
      Returns the value of the delegate record component.
      Returns:
      the value of the delegate record component
    • byteAlignment

      public long byteAlignment()
      Returns the value of the byteAlignment record component.
      Returns:
      the value of the byteAlignment record component