git://source.jalview.org
/
jalview.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
JAL-2094 first pass with jalview.api.ColorI interface
[jalview.git]
/
src
/
jalview
/
util
/
MappingUtils.java
diff --git
a/src/jalview/util/MappingUtils.java
b/src/jalview/util/MappingUtils.java
index
c2cad1f
..
ae4e55d
100644
(file)
--- a/
src/jalview/util/MappingUtils.java
+++ b/
src/jalview/util/MappingUtils.java
@@
-770,7
+770,8
@@
public final class MappingUtils
}
/**
}
/**
- * Returns the total length of the supplied ranges
+ * Returns the total length of the supplied ranges, which may be as single
+ * [start, end] or multiple [start, end, start, end ...]
*
* @param ranges
* @return
*
* @param ranges
* @return
@@
-784,7
+785,16
@@
public final class MappingUtils
int length = 0;
for (int[] range : ranges)
{
int length = 0;
for (int[] range : ranges)
{
- length += Math.abs(range[1] - range[0]) + 1;
+ if (range.length % 2 != 0)
+ {
+ System.err.println("Error unbalance start/end ranges: "
+ + ranges.toString());
+ return 0;
+ }
+ for (int i = 0; i < range.length - 1; i += 2)
+ {
+ length += Math.abs(range[i + 1] - range[i]) + 1;
+ }
}
return length;
}
}
return length;
}
@@
-848,7
+858,6
@@
public final class MappingUtils
int cdspos = 0;
for (int x = 0; x < copy.length && sxpos == -1; x += 2)
{
int cdspos = 0;
for (int x = 0; x < copy.length && sxpos == -1; x += 2)
{
- // fixme handle reverse strand
cdspos += Math.abs(copy[x + 1] - copy[x]) + 1;
if (removeCount < cdspos)
{
cdspos += Math.abs(copy[x + 1] - copy[x]) + 1;
if (removeCount < cdspos)
{