Package model

Record Class Variant.Stub

Record Components:
position - The 1-based position of the variant on a contig.
alternative - The alternative allele of the variant.
Enclosing class:
Variant

public static record Variant.Stub(int position, String alternative) extends Record
Represents a simplified variant stub with position and alternative allele information.

This record encapsulates the position and alternative allele of a variant and provides methods for generating its string representation, computing its hash code, and checking equality.

Variant stubs are used to represent variants in a simplified form, to be precisely identify, they constitute the index of a variant in a contig, as variants do not have their own identifiers.

  • Constructor Summary

    Constructors
    Constructor
    Description
    Stub(int position, String alternative)
    Creates an instance of a Stub record class.
  • Method Summary

    Modifier and Type
    Method
    Description
    Returns the value of the alternative record component.
    boolean
    Compares this variant stub to another object for equality.
    int
    Computes the hash code for this variant stub.
    int
    Returns the value of the position record component.
    Converts the variant stub to its string representation.

    Methods inherited from class java.lang.Object

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

    • Stub

      public Stub(int position, String alternative)
      Creates an instance of a Stub record class.
      Parameters:
      position - the value for the position record component
      alternative - the value for the alternative record component
  • Method Details

    • toString

      public String toString()
      Converts the variant stub to its string representation.

      The string representation is formatted as "position + alternative".

      Specified by:
      toString in class Record
      Returns:
      A String representing the variant stub.
    • hashCode

      public int hashCode()
      Computes the hash code for this variant stub.

      The hash code is calculated based on the string representation of the variant stub.

      Specified by:
      hashCode in class Record
      Returns:
      The hash code of the variant stub.
    • equals

      public boolean equals(Object obj)
      Compares this variant stub to another object for equality.

      This method checks if the provided object is the same instance as this object. If not, it verifies that the object is of the same class and compares their string representations.

      Specified by:
      equals in class Record
      Parameters:
      obj - The object to compare with this Variant.Stub instance.
      Returns:
      true if the objects are the same instance or if their string representations are equal; false otherwise.
    • position

      public int position()
      Returns the value of the position record component.
      Returns:
      the value of the position record component
    • alternative

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