Package phase

Class SampleSeg

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

    public class SampleSeg
    extends java.lang.Object
    implements java.lang.Comparable<SampleSeg>, IntInterval

    Class SampleSeg represents a haplotype shared with a sample.

    Instances of class SampleSeg are immutable.
    • Constructor Summary

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

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      int compareTo​(SampleSeg hs)
      Compares this object with the specified object for order.
      boolean equals​(java.lang.Object o)
      Compares the specified object with this SampleSeg for equality.
      int hashCode()
      Returns the hash code value for this object.
      int inclEnd()
      Returns the end of the segment (inclusive).
      int sample()
      Returns the sample index.
      static java.util.Comparator<SampleSeg> sampleComp()
      Returns a comparator that orders first by this.sample(), then by this.start(), and finally by this.end().
      int start()
      Returns the start of the segment (inclusive).
      java.lang.String toString()
      Returns a string representation of this.
      • Methods inherited from class java.lang.Object

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

      • SampleSeg

        public SampleSeg​(int sample,
                         int start,
                         int end)
        Constructs a new SampleSeg instance from the specified data.
        Parameters:
        sample - the sample index
        start - the start of the segment (inclusive)
        end - the end of the segment (inclusive)
        Throws:
        java.lang.IllegalArgumentException - if start > end
    • Method Detail

      • sample

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

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

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

        public java.lang.String toString()
        Returns a string representation of this. The exact details of the representation are unspecified and subject to change.
        Overrides:
        toString in class java.lang.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.end();
             
        Overrides:
        hashCode in class java.lang.Object
        Returns:
        the hash code value for this object
      • equals

        public boolean equals​(java.lang.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 haplotype indices, equal starting marker indices, and equal ending marker indices.
        Overrides:
        equals in class java.lang.Object
        Parameters:
        o - the reference object with which to compare.
        Returns:
        true if the specified object is an SampleSeg instance and if this SampleSeg is equal to the specified SampleSeg
      • compareTo

        public int compareTo​(SampleSeg hs)
        Compares this object with the specified object 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 this.sample().
        Specified by:
        compareTo in interface java.lang.Comparable<SampleSeg>
        Parameters:
        hs - the SampleSeg to be compared
        Returns:
        a negative integer, zero, or a positive integer as this SampleSeg is less than, equal to, or greater than the specified SampleSeg
        Throws:
        java.lang.NullPointerException - if o == null
      • sampleComp

        public static java.util.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()