some reformatting and logic cleanup in the comparison functions
git-svn-id: file:///humgen/gsa-scr1/gsa-engineering/svn_contents/trunk@132 348d0f76-0448-11de-a6fe-93d51630548a
This commit is contained in:
parent
dfe50ce773
commit
f7ad17016d
|
|
@ -186,35 +186,51 @@ public class GenomeLoc implements Comparable<GenomeLoc> {
|
||||||
//
|
//
|
||||||
// Comparison operations
|
// Comparison operations
|
||||||
//
|
//
|
||||||
public static int compareContigs( final String thisContig, final String thatContig ) {
|
public static int compareContigs( final String thisContig, final String thatContig )
|
||||||
|
{
|
||||||
if ( thisContig == thatContig )
|
if ( thisContig == thatContig )
|
||||||
|
{
|
||||||
|
assert(false);
|
||||||
return 0;
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
if ( refContigOrdering != null ) {
|
assert refContigOrdering.containsKey(thisContig);// : this;
|
||||||
if ( ! refContigOrdering.containsKey(thisContig) ) {
|
assert refContigOrdering.containsKey(thatContig);// : that;
|
||||||
if ( ! refContigOrdering.containsKey(thatContig) ) {
|
|
||||||
|
if ( refContigOrdering != null )
|
||||||
|
{
|
||||||
|
if ( ! refContigOrdering.containsKey(thisContig) )
|
||||||
|
{
|
||||||
|
if ( ! refContigOrdering.containsKey(thatContig) )
|
||||||
|
{
|
||||||
// Use regular sorted order
|
// Use regular sorted order
|
||||||
return thisContig.compareTo(thatContig);
|
return thisContig.compareTo(thatContig);
|
||||||
}
|
}
|
||||||
else {
|
else
|
||||||
|
{
|
||||||
// this is always bigger if that is in the key set
|
// this is always bigger if that is in the key set
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if ( ! refContigOrdering.containsKey(thatContig) )
|
else if ( ! refContigOrdering.containsKey(thatContig) )
|
||||||
|
{
|
||||||
return -1;
|
return -1;
|
||||||
else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
assert refContigOrdering.containsKey(thisContig);// : this;
|
assert refContigOrdering.containsKey(thisContig);// : this;
|
||||||
assert refContigOrdering.containsKey(thatContig);// : that;
|
assert refContigOrdering.containsKey(thatContig);// : that;
|
||||||
|
|
||||||
final int thisO = refContigOrdering.get(thisContig);
|
final int thisO = refContigOrdering.get(thisContig);
|
||||||
final int thatO = refContigOrdering.get(thatContig);
|
final int thatO = refContigOrdering.get(thatContig);
|
||||||
|
|
||||||
if ( thisO < thatO ) return -1;
|
if ( thisO < thatO ) return -1;
|
||||||
if ( thisO > thatO ) return 1;
|
if ( thisO > thatO ) return 1;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else
|
||||||
|
{
|
||||||
return thisContig.compareTo(thatContig);
|
return thisContig.compareTo(thatContig);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -235,4 +251,4 @@ public class GenomeLoc implements Comparable<GenomeLoc> {
|
||||||
if ( this.getStop() > that.getStop() ) return 1;
|
if ( this.getStop() > that.getStop() ) return 1;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue