public class HapSegment extends java.lang.Object implements java.lang.Comparable<HapSegment>, IntInterval
Class HapSegment
represents a marker interval
for a haplotype.
HapSegment
are immutable.Constructor and Description |
---|
HapSegment(int hap,
int start,
int end)
Constructs a new
HapSegment instance. |
Modifier and Type | Method and Description |
---|---|
int |
compareTo(HapSegment hs)
Compares this object with the specified object for order.
|
int |
end()
Returns the end marker index (inclusive).
|
boolean |
equals(java.lang.Object o)
Compares the specified object with this
HapSegment for
equality. |
int |
hap()
Returns the first haplotype index.
|
int |
hashCode()
Returns the hash code value for this object.
|
int |
start()
Returns the start marker index (inclusive).
|
java.lang.String |
toString()
Returns a string representation of
this . |
public HapSegment(int hap, int start, int end)
HapSegment
instance.hap
- the haplotype indexstart
- the start marker index (inclusive)end
- the end marker index (inclusive)java.lang.IllegalArgumentException
- if start > end
public int hap()
public int start()
start
in interface IntInterval
public int end()
end
in interface IntInterval
public java.lang.String toString()
this
. The exact
details of the representation are unspecified and subject to change.toString
in class java.lang.Object
this
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();
hashCode
in class java.lang.Object
public boolean equals(java.lang.Object o)
HapSegment
for
equality. Returns true
if the specified object is a
HapSegment
instance and if this HapSegment
is
equal to the specified HapSegment
, and returns
false
otherwise. Two HapSegment
instances
are equal if they have equal haplotype indices,
equal starting marker indices, and equal ending marker indices.equals
in class java.lang.Object
o
- the reference object with which to compare.true
if the specified object is an
HapSegment
instance and if this HapSegment
is
equal to the specified HapSegment
public int compareTo(HapSegment hs)
HapSegment
instances are ordered first by
this.start()
, then by this.end()
,
and finally by this.hap()
.compareTo
in interface java.lang.Comparable<HapSegment>
hs
- the HapSegment
to be comparedHapSegment
is less than, equal to, or greater than the
specified HapSegment
java.lang.NullPointerException
- if o == null