Package model
Record Class Variant.Stub
java.lang.Object
java.lang.Record
model.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
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 -
Method Summary
Modifier and TypeMethodDescriptionReturns the value of thealternative
record component.boolean
Compares this variant stub to another object for equality.int
hashCode()
Computes the hash code for this variant stub.int
position()
Returns the value of theposition
record component.toString()
Converts the variant stub to its string representation.
-
Constructor Details
-
Stub
Creates an instance of aStub
record class.- Parameters:
position
- the value for theposition
record componentalternative
- the value for thealternative
record component
-
-
Method Details
-
toString
Converts the variant stub to its string representation.The string representation is formatted as "position + alternative".
-
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.
-
equals
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 classRecord
- Parameters:
obj
- The object to compare with thisVariant.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 theposition
record component.- Returns:
- the value of the
position
record component
-
alternative
Returns the value of thealternative
record component.- Returns:
- the value of the
alternative
record component
-