+ * Adds one match to the stored list. If hidden residues are being skipped, then
+ * the match may need to be split into contiguous positions of the sequence (so
+ * it does not include skipped residues).
+ *
+ * @param seq
+ * @param matchStartPosition
+ * @param matchEndPosition
+ * @param ignoreHidden
+ */
+ private void addMatch(SequenceI seq, int matchStartPosition,
+ int matchEndPosition, boolean ignoreHidden)
+ {
+ if (!ignoreHidden)
+ {
+ /*
+ * simple case
+ */
+ searchResults.addResult(seq, matchStartPosition, matchEndPosition);
+ return;
+ }
+
+ /*
+ * get start-end contiguous ranges in underlying sequence
+ */
+ int[] truePositions = searchedSequenceMap
+ .locateInFrom(matchStartPosition, matchEndPosition);
+ for (int i = 0; i < truePositions.length - 1; i += 2)
+ {
+ searchResults.addResult(seq, truePositions[i], truePositions[i + 1]);
+ }
+ }
+
+ /**
+ * Returns true if all residues are hidden, else false
+ *
+ * @param seq
+ * @param fromPos
+ * @param toPos
+ * @return
+ */
+ private boolean allHidden(SequenceI seq, int fromPos, int toPos)
+ {
+ if (!viewport.hasHiddenColumns())
+ {
+ return false;
+ }
+ for (int res = fromPos; res <= toPos; res++)
+ {
+ if (isVisible(seq, res))
+ {
+ return false;
+ }
+ }
+ return true;
+ }
+
+ /**