/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
- * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, 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 <http://www.gnu.org/licenses/>.
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * 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;
* @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;
}
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;
}
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);
}
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);
}