- for (int from=1; from<=51; from++) {
- int[] too=ml.shiftTo(from);
- int[] toofrom=ml.shiftFrom(too[0]);
- System.out.println("ShiftFrom("+from+")=="+too[0]+" % "+too[1]+"\t+-+\tShiftTo("+too[0]+")=="+toofrom[0]+" % "+toofrom[1]);
- }*/
- System.out.print("Success?\n"); // if we get here - something must be working!
+ * for (int from=1; from<=51; from++) { int[] too=ml.shiftTo(from); int[]
+ * toofrom=ml.shiftFrom(too[0]);
+ * System.out.println("ShiftFrom("+from+")=="+too[0]+" %
+ * "+too[1]+"\t+-+\tShiftTo("+too[0]+")=="+toofrom[0]+" % "+toofrom[1]); }
+ */
+ System.out.print("Success?\n"); // if we get here - something must be
+ // working!
+ }
+
+ private static void testLocateFrom(MapList mldna, int i, int j, int[] ks)
+ {
+ int[] frm = mldna.locateInFrom(i, j);
+ if (frm == ks || java.util.Arrays.equals(frm, ks))
+ {
+ System.out.println("Success test locate from " + i + " to " + j);
+ }
+ else
+ {
+ System.err.println("Failed test locate from " + i + " to " + j);
+ for (int c = 0; c < frm.length; c++)
+ {
+ System.err.print(frm[c] + ((c % 2 == 0) ? "," : ";"));
+ }
+ System.err.println("Expected");
+ for (int c = 0; c < ks.length; c++)
+ {
+ System.err.print(ks[c] + ((c % 2 == 0) ? "," : ";"));
+ }
+ }
+ }
+
+ /**
+ *
+ * @return a MapList whose From range is this maplist's To Range, and vice
+ * versa
+ */
+ public MapList getInverse()
+ {
+ return new MapList(getToRanges(), getFromRanges(), getToRatio(),
+ getFromRatio());
+ }
+
+ /**
+ * 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
+ */
+ 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()));
+ }