/*
- * Jalview - A Sequence Alignment Editor and Viewer (Development Version 2.4.1)
- * Copyright (C) 2009 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.5)
+ * Copyright (C) 2010 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
*
- * This program 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 2
- * of the License, or (at your option) any later version.
+ * This file is part of Jalview.
*
- * This program 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.
+ * 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.
*
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
+ * 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/>.
*/
package jalview.util;
* addShift
*
* @param pos
- * start position for shift (in original reference frame)
+ * start position for shift (in original reference frame)
* @param shift
- * length of shift
+ * length of shift
*
- * public void addShift(int pos, int shift) { int sidx = 0; int[] rshift=null;
- * while (sidx<shifts.size() && (rshift=(int[]) shifts.elementAt(sidx))[0]<pos)
- * sidx++; if (sidx==shifts.size()) shifts.insertElementAt(new int[] { pos,
- * shift}, sidx); else rshift[1]+=shift; }
+ * public void addShift(int pos, int shift) { int sidx = 0; int[]
+ * rshift=null; while (sidx<shifts.size() && (rshift=(int[])
+ * shifts.elementAt(sidx))[0]<pos) sidx++; if (sidx==shifts.size())
+ * shifts.insertElementAt(new int[] { pos, shift}, sidx); else
+ * rshift[1]+=shift; }
*/
/**
* shift from pos to To(pos)
*
* @param pos
- * int
+ * int
* @return int shifted position in To, frameshift in From, direction of mapped
* symbol in To
*/
* inverse of shiftFrom - maps pos in To to a position in From
*
* @param pos
- * (in To)
+ * (in To)
* @return shifted position in From, frameshift in To, direction of mapped
* symbol in From
*/
* find series of intervals mapping from start-end in the From map.
*
* @param start
- * position in to map
+ * position in to map
* @param end
- * position in to map
+ * position in to map
* @return series of ranges in from map
*/
public int[] locateInFrom(int start, int end)
* find series of intervals mapping from start-end in the to map.
*
* @param start
- * position in from map
+ * position in from map
* @param end
- * position in from map
+ * position in from map
* @return series of ranges in to map
*/
public int[] locateInTo(int start, int end)
{
fe = i;
endpos = endpos + endindx; // end of end token is within this
- // interval
+ // interval
}
else
{
{
fe = i;
endpos = endpos - endindx; // end of end token is within this
- // interval
+ // interval
}
else
{
* get the 'initial' position of mpos in To
*
* @param mpos
- * position in from
+ * position in from
* @return position of first word in to reference frame
*/
public int getToPosition(int mpos)
* get range of positions in To frame for the mpos word in From
*
* @param mpos
- * position in From
+ * position in From
* @return null or int[] first position in To for mpos, last position in to
* for Mpos
*/
/**
* test for containment rather than equivalence to another mapping
- * @param map to be tested for containment
- * @return true if local or mapped range map contains or is contained by this mapping
+ *
+ * @param map
+ * to be tested for containment
+ * @return true if local or mapped range map contains or is contained by this
+ * mapping
*/
public boolean containsEither(boolean local, MapList map)
{
if (local)
{
- return ((getFromLowest()>=map.getFromLowest() && getFromHighest()<=map.getFromHighest())
- || (getFromLowest()<=map.getFromLowest() && getFromHighest()>=map.getFromHighest()));
- } else {
- return ((getToLowest()>=map.getToLowest() && getToHighest()<=map.getToHighest())
- || (getToLowest()<=map.getToLowest() && getToHighest()>=map.getToHighest()));
+ return ((getFromLowest() >= map.getFromLowest() && getFromHighest() <= map
+ .getFromHighest()) || (getFromLowest() <= map.getFromLowest() && getFromHighest() >= map
+ .getFromHighest()));
+ }
+ else
+ {
+ return ((getToLowest() >= map.getToLowest() && getToHighest() <= map
+ .getToHighest()) || (getToLowest() <= map.getToLowest() && getToHighest() >= map
+ .getToHighest()));
}
}
}