X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;ds=inline;f=src%2Fjalview%2Fdatamodel%2FMapping.java;h=f2c16d07c739fe4ffd5c2cbc4152ad902401d596;hb=61f1a8b75ea5ce352d6214c34fbdcd58bafbbb73;hp=b6b4c966c65967dae3a53037b59bc50f6407cd7f;hpb=153dd62dc91da13ae732600e6ea55ddbe15eab39;p=jalview.git
diff --git a/src/jalview/datamodel/Mapping.java b/src/jalview/datamodel/Mapping.java
index b6b4c96..f2c16d0 100644
--- a/src/jalview/datamodel/Mapping.java
+++ b/src/jalview/datamodel/Mapping.java
@@ -1,37 +1,40 @@
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.6)
- * Copyright (C) 2010 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8.2)
+ * Copyright (C) 2014 The Jalview Authors
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see .
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see .
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
*/
package jalview.datamodel;
-import java.util.Vector;
-
import jalview.util.MapList;
+import java.util.Vector;
+
public class Mapping
{
/**
* Contains the start-end pairs mapping from the associated sequence to the
- * sequence in the database coordinate system it also takes care of step
- * difference between coordinate systems
+ * sequence in the database coordinate system. It also takes care of step
+ * difference between coordinate systems.
*/
MapList map = null;
/**
- * The seuqence that map maps the associated seuqence to (if any).
+ * The sequence that map maps the associated sequence to (if any).
*/
SequenceI to = null;
@@ -108,19 +111,31 @@ public class Mapping
* @param other
* @return
*/
- public boolean equals(Mapping other)
+ @Override
+ public boolean equals(Object o)
{
- if (other == null)
+ if (o == null || !(o instanceof Mapping))
+ {
return false;
+ }
+ Mapping other = (Mapping) o;
if (other == this)
+ {
return true;
+ }
if (other.to != to)
+ {
return false;
+ }
if ((map != null && other.map == null)
|| (map == null && other.map != null))
+ {
return false;
+ }
if (map.equals(other.map))
+ {
return true;
+ }
return false;
}
@@ -248,7 +263,9 @@ public class Mapping
vf[v].setBegin(frange[i]);
vf[v].setEnd(frange[i + 1]);
if (frange.length > 2)
+ {
vf[v].setDescription(f.getDescription() + "\nPart " + (v + 1));
+ }
}
return vf;
}
@@ -297,14 +314,18 @@ public class Mapping
from = (map.getToLowest() < from) ? from : map.getToLowest();
to = (map.getToHighest() > to) ? to : map.getToHighest();
if (from > to)
+ {
return null;
+ }
}
else
{
from = (map.getToHighest() > from) ? from : map.getToHighest();
to = (map.getToLowest() < to) ? to : map.getToLowest();
if (from < to)
+ {
return null;
+ }
}
return map.locateInFrom(from, to);
}
@@ -330,14 +351,18 @@ public class Mapping
from = (map.getFromLowest() < from) ? from : map.getFromLowest();
to = (map.getFromHighest() > to) ? to : map.getFromHighest();
if (from > to)
+ {
return null;
+ }
}
else
{
from = (map.getFromHighest() > from) ? from : map.getFromHighest();
to = (map.getFromLowest() < to) ? to : map.getFromLowest();
if (from < to)
+ {
return null;
+ }
}
return map.locateInTo(from, to);
}