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 thealternativerecord component.booleanCompares this variant stub to another object for equality.inthashCode()Computes the hash code for this variant stub.intposition()Returns the value of thepositionrecord component.toString()Converts the variant stub to its string representation.
-
Constructor Details
-
Stub
Creates an instance of aStubrecord class.- Parameters:
position- the value for thepositionrecord componentalternative- the value for thealternativerecord 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:
equalsin classRecord- Parameters:
obj- The object to compare with thisVariant.Stubinstance.- Returns:
trueif the objects are the same instance or if their string representations are equal;falseotherwise.
-
position
public int position()Returns the value of thepositionrecord component.- Returns:
- the value of the
positionrecord component
-
alternative
Returns the value of thealternativerecord component.- Returns:
- the value of the
alternativerecord component
-