Package phase

Class SampleSeg

java.lang.Object
phase.SampleSeg
All Implemented Interfaces:
IntInterval, Comparable<SampleSeg>

public class SampleSeg extends Object implements Comparable<SampleSeg>, IntInterval

Class SampleSeg represents a segment of genotype data in a sample.

Instances of class SampleSeg are immutable

  • Constructor Summary

    Constructors
    Constructor
    Description
    SampleSeg(int sample, int start, int inclEnd)
    Constructs a new SampleSeg instance from the specified data.
  • Method Summary

    Modifier and Type
    Method
    Description
    int
    Compares this SampleSeg with the specified SampleSeg for order.
    boolean
    Compares the specified object with this SampleSeg for equality.
    int
    Returns the hash code value for this object.
    int
    Returns the end marker index (inclusive).
    int
    Returns the sample index.
    Returns a comparator that orders first by this.sample(), then by this.start(), and finally by this.end().
    int
    Returns the start marker index (inclusive).
    Returns a string representation of this.

    Methods inherited from class java.lang.Object

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

    • SampleSeg

      public SampleSeg(int sample, int start, int inclEnd)
      Constructs a new SampleSeg instance from the specified data.
      Parameters:
      sample - the sample index
      start - the start marker index (inclusive)
      inclEnd - the end marker index (inclusive)
      Throws:
      IllegalArgumentException - if start > inclEnd
  • Method Details

    • sample

      public int sample()
      Returns the sample index.
      Returns:
      the sample index
    • start

      public int start()
      Returns the start marker index (inclusive).
      Specified by:
      start in interface IntInterval
      Returns:
      the start marker index (inclusive)
    • inclEnd

      public int inclEnd()
      Returns the end marker index (inclusive).
      Specified by:
      inclEnd in interface IntInterval
      Returns:
      the end marker index (inclusive)
    • toString

      public String toString()
      Returns a string representation of this. The exact details of the representation are unspecified and subject to change.
      Overrides:
      toString in class Object
      Returns:
      a string representation of this
    • hashCode

      public int hashCode()

      Returns the hash code value for this object. The hash code is defined by the following calculation:

        int hash = 5;
        hash = 89 * hash + this.hap();
        hash = 89 * hash + this.start();
        hash = 89 * hash + this.inclEnd();
           
      Overrides:
      hashCode in class Object
      Returns:
      the hash code value for this object
    • equals

      public boolean equals(Object o)
      Compares the specified object with this SampleSeg for equality. Returns true if the specified object is a SampleSeg instance and if this SampleSeg is equal to the specified SampleSeg, and returns false otherwise. Two SampleSeg instances are equal if they have equal sample indices, equal start marker indices, and equal end marker indices.
      Overrides:
      equals in class Object
      Parameters:
      o - the object to be compared with this SampleSeg for equality
      Returns:
      true if the specified object is equal to this
    • compareTo

      public int compareTo(SampleSeg ss)
      Compares this SampleSeg with the specified SampleSeg for order. Returns a negative integer, zero, or a positive integer as this object is less than, equal to, or greater than the specified object. SampleSeg instances are ordered first by this.start(), then by this.end(), and finally by tthis.sample().
      Specified by:
      compareTo in interface Comparable<SampleSeg>
      Parameters:
      ss - the SampleSeg to be compared with this SampleSeg
      Returns:
      a negative integer, zero, or a positive integer as this SampleSeg is less than, equal to, or greater than the specified SampleSeg
      Throws:
      NullPointerException - if ss == null
    • sampleComp

      public static Comparator<SampleSeg> sampleComp()
      Returns a comparator that orders first by this.sample(), then by this.start(), and finally by this.end().
      Returns:
      a comparator that orders first by this.sample(), then by this.start(), and finally by this.end()