JAL-966 JAL-1854 removed redundant methods / modifiers from search
[jalview.git] / src / jalview / datamodel / SearchResultsI.java
index f90832a..93183f2 100644 (file)
@@ -1,16 +1,17 @@
 package jalview.datamodel;
 
-
 import java.util.BitSet;
 import java.util.List;
 
+/**
+ * An interface describing the result of a search or other operation which
+ * highlights matched regions of an alignment
+ */
 public interface SearchResultsI
 {
 
   /**
-   * This method replaces the old search results which merely held an alignment
-   * index of search matches. This broke when sequences were moved around the
-   * alignment
+   * Adds one region to the results
    * 
    * @param seq
    *          Sequence
@@ -18,68 +19,56 @@ public interface SearchResultsI
    *          int
    * @param end
    *          int
-   * @return SearchResultMatchI instance created for this instance
+   * @return
    */
-  public abstract SearchResultMatchI addResult(SequenceI seq, int start,
-          int end);
+  SearchResultMatchI addResult(SequenceI seq, int start, int end);
 
   /**
-   * Quickly check if the given sequence is referred to in the search results
+   * Answers true if the search results include the given sequence (or its
+   * dataset sequence), else false
    * 
    * @param sequence
-   *          (specific alignment sequence or a dataset sequence)
-   * @return true if the results involve sequence
+   * @return
    */
-  public abstract boolean involvesSequence(SequenceI sequence);
+  boolean involvesSequence(SequenceI sequence);
 
   /**
-   * This Method returns the search matches which lie between the start and end
-   * points of the sequence in question . It is optimised for returning objects
-   * for drawing on SequenceCanvas
+   * Returns an array of [from, to, from, to..] matched columns (base 0) between
+   * the given start and end columns of the given sequence. Returns null if no
+   * matches overlap the specified region.
+   * <p>
+   * Implementations should provide an optimised method to return locations to
+   * highlight on a visible portion of an alignment.
    * 
    * @param sequence
-   *          sequence to highlight columns according to matches
    * @param start
-   *          - first column of visible region
+   *          first column of range (base 0, inclusive)
    * @param end
-   *          - last column of visible region
-   * @return int[] ranges within start/end index on sequence
-   */
-  public abstract int[] getResults(SequenceI sequence, int start, int end);
-
-  public abstract int getSize();
-
-  public abstract SequenceI getResultSequence(int index);
-
-  /**
-   * Returns the start position of the i'th match in the search results.
-   * 
-   * @param i
-   * @return
+   *          last column of range base 0, inclusive)
+   * @return int[]
    */
-  public abstract int getResultStart(int i);
+  int[] getResults(SequenceI sequence, int start, int end);
 
   /**
-   * Returns the end position of the i'th match in the search results.
+   * Returns the number of matches found
    * 
-   * @param i
    * @return
    */
-  public abstract int getResultEnd(int i);
+  int getSize();
 
   /**
    * Returns true if no search result matches are held.
    * 
    * @return
    */
-  public abstract boolean isEmpty();
+  boolean isEmpty();
 
   /**
    * Returns the list of matches.
    * 
    * @return
    */
-  public abstract List<SearchResultMatchI> getResults();
+  List<SearchResultMatchI> getResults();
 
   /**
    * Set bits in a bitfield for all columns in the given sequence collection
@@ -91,5 +80,5 @@ public interface SearchResultsI
    *          bitset to set
    * @return number of bits set
    */
-  public abstract int markColumns(SequenceCollectionI sqcol, BitSet bs);
+  int markColumns(SequenceCollectionI sqcol, BitSet bs);
 }
\ No newline at end of file