+
+ @Override
+ public boolean equals(Object obj)
+ {
+ if (obj == null || !(obj instanceof contactInterval))
+ {
+ return false;
+ }
+ contactInterval them = (contactInterval) obj;
+ return cStart == them.cStart && cEnd == them.cEnd && pEnd == them.pEnd
+ && pStart == them.pStart;
+ }
+ @Override
+ public String toString()
+ {
+ return "Contacts ["+cStart+","+cEnd+"] : Pixels ["+pStart+","+pEnd+"]";
+ }
+ }
+
+ /**
+ *
+ * @param columnSelection
+ * @param ci
+ * @param visibleOnly
+ * - when true, only test intersection of visible columns given
+ * matrix range
+ * @return true if the range on the matrix specified by ci intersects with
+ * selected columns in the ContactListI's reference frame.
+ */
+
+ boolean intersects(contactInterval ci, ColumnSelection columnSelection,
+ HiddenColumns hiddenColumns, boolean visibleOnly)
+ {
+ boolean rowsel = false;
+ final int[] mappedRange = contacts.getMappedPositionsFor(ci.cStart,
+ ci.cEnd);
+ if (mappedRange == null)
+ {
+ return false;
+ }
+ for (int p = 0; p < mappedRange.length && !rowsel; p += 2)
+ {
+ boolean containsHidden = false;
+ if (visibleOnly && hiddenColumns != null
+ && hiddenColumns.hasHiddenColumns())
+ {
+ // TODO: turn into function on hiddenColumns and create test !!
+ Iterator<int[]> viscont = hiddenColumns.getVisContigsIterator(
+ -1+mappedRange[p], -1+mappedRange[p + 1], false);
+ containsHidden = !viscont.hasNext();
+ if (!containsHidden)
+ {
+ for (int[] interval = viscont.next(); viscont
+ .hasNext(); rowsel |= columnSelection
+ .intersects(interval[p], interval[p + 1]))
+ ;
+ }
+ }
+ else
+ {
+ rowsel = columnSelection.intersects(-1+mappedRange[p],
+ -1+mappedRange[p + 1]);
+ }
+ }
+ return rowsel;
+