Record Class BlockPair

java.lang.Object
java.lang.Record
dev.roanh.cpqindex.BlockPair
Record Components:
first - The first block.
second - The second block.

public record BlockPair(Index.Block first, Index.Block second) extends Record
Simple record representing a pair of blocks.
  • Field Details

    • first

      private final Index.Block first
      The field for the first record component.
    • second

      private final Index.Block second
      The field for the second record component.
  • Constructor Details

    • BlockPair

      public BlockPair(PathPair pair)
      Constructs a new block pair from the given path pair.
      Parameters:
      pair - The path pair to get the blocks from.
    • BlockPair

      public BlockPair(DataInputStream in, dev.roanh.gmark.util.RangeList<Index.Block> blockMap) throws IOException
      Reads a previously saved block pair from the given stream.
      Parameters:
      in - The stream to read from.
      blockMap - A map of blocks read so far by ID.
      Throws:
      IOException - When an IOException occurs.
    • BlockPair

      public BlockPair(Index.Block first, Index.Block second)
      Creates an instance of a BlockPair record class.
      Parameters:
      first - the value for the first record component
      second - the value for the second record component
  • Method Details

    • write

      public void write(DataOutputStream out) throws IOException
      Writes this block pair to the given stream.
      Parameters:
      out - The stream to write to.
      Throws:
      IOException - When an IOException occurs.
    • 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.
    • first

      public Index.Block first()
      Returns the value of the first record component.
      Returns:
      the value of the first record component
    • second

      public Index.Block second()
      Returns the value of the second record component.
      Returns:
      the value of the second record component