Package phase
Class SampleSeg
- java.lang.Object
-
- phase.SampleSeg
-
- All Implemented Interfaces:
IntInterval,java.lang.Comparable<SampleSeg>
public class SampleSeg extends java.lang.Object implements java.lang.Comparable<SampleSeg>, IntInterval
Class
Instances of classSampleSegrepresents a haplotype shared with a sample.SampleSegare immutable.
-
-
Constructor Summary
Constructors Constructor Description SampleSeg(int sample, int start, int end)Constructs a newSampleSeginstance from the specified data.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description intcompareTo(SampleSeg hs)Compares this object with the specified object for order.booleanequals(java.lang.Object o)Compares the specified object with thisSampleSegfor equality.inthashCode()Returns the hash code value for this object.intinclEnd()Returns the end of the segment (inclusive).intsample()Returns the sample index.static java.util.Comparator<SampleSeg>sampleComp()Returns a comparator that orders first bythis.sample(), then bythis.start(), and finally bythis.end().intstart()Returns the start of the segment (inclusive).java.lang.StringtoString()Returns a string representation ofthis.
-
-
-
Constructor Detail
-
SampleSeg
public SampleSeg(int sample, int start, int end)Constructs a newSampleSeginstance from the specified data.- Parameters:
sample- the sample indexstart- the start of the segment (inclusive)end- the end of the segment (inclusive)- Throws:
java.lang.IllegalArgumentException- ifstart > 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:
startin interfaceIntInterval- Returns:
- the start of the segment (inclusive)
-
inclEnd
public int inclEnd()
Returns the end of the segment (inclusive).- Specified by:
inclEndin interfaceIntInterval- Returns:
- the end of the segment (inclusive)
-
toString
public java.lang.String toString()
Returns a string representation ofthis. The exact details of the representation are unspecified and subject to change.- Overrides:
toStringin classjava.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:
hashCodein classjava.lang.Object- Returns:
- the hash code value for this object
-
equals
public boolean equals(java.lang.Object o)
Compares the specified object with thisSampleSegfor equality. Returnstrueif the specified object is aSampleSeginstance and if thisSampleSegis equal to the specifiedSampleSeg, and returnsfalseotherwise. TwoSampleSeginstances are equal if they have equal haplotype indices, equal starting marker indices, and equal ending marker indices.- Overrides:
equalsin classjava.lang.Object- Parameters:
o- the reference object with which to compare.- Returns:
trueif the specified object is anSampleSeginstance and if thisSampleSegis equal to the specifiedSampleSeg
-
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.SampleSeginstances are ordered first bythis.start(), then bythis.end(), and finally bythis.sample().- Specified by:
compareToin interfacejava.lang.Comparable<SampleSeg>- Parameters:
hs- theSampleSegto be compared- Returns:
- a negative integer, zero, or a positive integer as this
SampleSegis less than, equal to, or greater than the specifiedSampleSeg - Throws:
java.lang.NullPointerException- ifo == null
-
sampleComp
public static java.util.Comparator<SampleSeg> sampleComp()
Returns a comparator that orders first bythis.sample(), then bythis.start(), and finally bythis.end().- Returns:
- a comparator that orders first by
this.sample(), then bythis.start(), and finally bythis.end()
-
-