import jalview.datamodel.AlignmentI;
import jalview.datamodel.SearchResults;
+import jalview.datamodel.SearchResultsI;
import jalview.datamodel.Sequence;
import jalview.datamodel.SequenceGroup;
/**
* Implements the search algorithms for the Find dialog box.
*/
- SearchResults searchResults;
+ SearchResultsI searchResults;
AlignmentI alignment;
/**
* @return the searchResults
*/
- public SearchResults getSearchResults()
+ public SearchResultsI getSearchResults()
{
return searchResults;
}
import jalview.datamodel.AlignmentI;
import jalview.datamodel.ColumnSelection;
import jalview.datamodel.SearchResults;
+import jalview.datamodel.SearchResultsI;
import jalview.datamodel.Sequence;
import jalview.datamodel.SequenceGroup;
import jalview.datamodel.SequenceI;
* there is no complement, or it is not following highlights, or no mapping
* is found, the result will be empty.
*/
- SearchResults sr = new SearchResults();
+ SearchResultsI sr = new SearchResults();
int seqOffset = findComplementScrollTarget(sr);
if (!sr.isEmpty())
{
import jalview.api.AlignmentViewPanel;
import jalview.bin.JalviewLite;
import jalview.datamodel.AlignmentI;
-import jalview.datamodel.SearchResults;
+import jalview.datamodel.SearchResultsI;
import jalview.datamodel.SequenceI;
import jalview.structure.StructureSelectionManager;
* Highlight the given results on the alignment.
*
*/
- public void highlightSearchResults(SearchResults results)
+ public void highlightSearchResults(SearchResultsI results)
{
scrollToPosition(results);
seqPanel.seqCanvas.highlightSearchResults(results);
* @param results
* @return false if results were not found
*/
- public boolean scrollToPosition(SearchResults results)
+ public boolean scrollToPosition(SearchResultsI results)
{
return scrollToPosition(results, true);
}
* - when set, the overview will be recalculated (takes longer)
* @return false if results were not found
*/
- public boolean scrollToPosition(SearchResults results,
+ public boolean scrollToPosition(SearchResultsI results,
boolean redrawOverview)
{
return scrollToPosition(results, redrawOverview, false);
* - when set, the overview will be recalculated (takes longer)
* @return false if results were not found
*/
- public boolean scrollToPosition(SearchResults results,
+ public boolean scrollToPosition(SearchResultsI results,
boolean redrawOverview, boolean centre)
{
// do we need to scroll the panel?
* @param seqOffset
* the number of visible sequences to show above the mapped region
*/
- protected void scrollToCentre(SearchResults sr, int seqOffset)
+ protected void scrollToCentre(SearchResultsI sr, int seqOffset)
{
/*
* To avoid jumpy vertical scrolling (if some sequences are gapped or not
import jalview.api.FeatureColourI;
import jalview.datamodel.SearchResults;
+import jalview.datamodel.SearchResultsI;
import jalview.datamodel.SequenceFeature;
import jalview.datamodel.SequenceI;
import jalview.io.FeaturesFile;
start.setText(features[index].getBegin() + "");
end.setText(features[index].getEnd() + "");
- SearchResults highlight = new SearchResults();
+ SearchResultsI highlight = new SearchResults();
highlight.addResult(sequences[0], features[index].getBegin(),
features[index].getEnd());
*/
package jalview.appletgui;
-import jalview.datamodel.SearchResults;
+import jalview.datamodel.SearchResultsI;
import jalview.datamodel.SequenceFeature;
import jalview.datamodel.SequenceI;
import jalview.util.MessageManager;
Frame frame;
- SearchResults searchResults;
+ SearchResultsI searchResults;
int seqIndex = 0;
package jalview.appletgui;
import jalview.datamodel.AlignmentI;
-import jalview.datamodel.SearchResults;
+import jalview.datamodel.SearchResultsI;
import jalview.datamodel.SequenceGroup;
import jalview.datamodel.SequenceI;
import jalview.renderer.ScaleRenderer;
AlignViewport av;
- SearchResults searchResults = null;
+ SearchResultsI searchResults = null;
boolean fastPaint = false;
}
}
- public void highlightSearchResults(SearchResults results)
+ public void highlightSearchResults(SearchResultsI results)
{
searchResults = results;
import jalview.commands.EditCommand.Action;
import jalview.datamodel.AlignmentI;
import jalview.datamodel.ColumnSelection;
+import jalview.datamodel.SearchResultMatchI;
import jalview.datamodel.SearchResults;
-import jalview.datamodel.SearchResults.Match;
+import jalview.datamodel.SearchResultsI;
import jalview.datamodel.Sequence;
import jalview.datamodel.SequenceFeature;
import jalview.datamodel.SequenceGroup;
* @param results
* @return true if results were matched, false if not
*/
- private boolean setStatusMessage(SearchResults results)
+ private boolean setStatusMessage(SearchResultsI results)
{
AlignmentI al = this.av.getAlignment();
int sequenceIndex = al.findIndex(results);
return false;
}
SequenceI ds = al.getSequenceAt(sequenceIndex).getDatasetSequence();
- for (Match m : results.getResults())
+ for (SearchResultMatchI m : results.getResults())
{
SequenceI seq = m.getSequence();
if (seq.getDatasetSequence() != null)
if (features != null && features.length > 0)
{
- SearchResults highlight = new SearchResults();
+ SearchResultsI highlight = new SearchResults();
highlight.addResult(sequence, features[0].getBegin(),
features[0].getEnd());
seqCanvas.highlightSearchResults(highlight);
}
@Override
- public void highlightSequence(SearchResults results)
+ public void highlightSequence(SearchResultsI results)
{
if (av.isFollowHighlight())
{
* where highlighted regions go
*/
public void markMappedRegion(SequenceI seq, int index,
- SearchResults results)
+ SearchResultsI results)
{
int[] codon;
SequenceI ds = seq.getDatasetSequence();
* jalview.datamodel.AlignmentI#findIndex(jalview.datamodel.SearchResults)
*/
@Override
- public int findIndex(SearchResults results)
+ public int findIndex(SearchResultsI results)
{
int i = 0;
* @param results
* @return -1 or index of sequence in alignment
*/
- int findIndex(SearchResults results);
+ int findIndex(SearchResultsI results);
/**
* append sequences and annotation from another alignment object to this one.
--- /dev/null
+package jalview.datamodel;
+
+public interface SearchResultMatchI
+{
+
+ public abstract SequenceI getSequence();
+
+ public abstract int getStart();
+
+ public abstract int getEnd();
+
+ /**
+ * Returns the string of characters in the matched region.
+ */
+ public abstract String getCharacters();
+
+}
\ No newline at end of file
* Holds a list of search result matches, where each match is a contiguous
* stretch of a single sequence.
*
- * @author gmcarstairs
+ * @author gmcarstairs amwaterhouse
*
*/
-public class SearchResults
+public class SearchResults implements SearchResultsI
{
private List<Match> matches = new ArrayList<Match>();
* One match consists of a sequence reference, start and end positions.
* Discontiguous ranges in a sequence require two or more Match objects.
*/
- public class Match
+ public class Match implements SearchResultMatchI
{
SequenceI sequence;
}
}
+ /* (non-Javadoc)
+ * @see jalview.datamodel.SearchResultMatchI#getSequence()
+ */
+ @Override
public SequenceI getSequence()
{
return sequence;
}
+ /* (non-Javadoc)
+ * @see jalview.datamodel.SearchResultMatchI#getStart()
+ */
+ @Override
public int getStart()
{
return start;
}
+ /* (non-Javadoc)
+ * @see jalview.datamodel.SearchResultMatchI#getEnd()
+ */
+ @Override
public int getEnd()
{
return end;
return startPosition + getCharacters();
}
- /**
- * Returns the string of characters in the matched region.
+ /* (non-Javadoc)
+ * @see jalview.datamodel.SearchResultMatchI#getCharacters()
*/
+ @Override
public String getCharacters()
{
char[] chars = sequence.getSequence();
}
}
- /**
- * 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
- *
- * @param seq
- * Sequence
- * @param start
- * int
- * @param end
- * int
+ /* (non-Javadoc)
+ * @see jalview.datamodel.SearchResultsI#addResult(jalview.datamodel.SequenceI, int, int)
*/
+ @Override
public void addResult(SequenceI seq, int start, int end)
{
matches.add(new Match(seq, start, end));
}
- /**
- * Quickly check if the given sequence is referred to in the search results
- *
- * @param sequence
- * (specific alignment sequence or a dataset sequence)
- * @return true if the results involve sequence
+ /* (non-Javadoc)
+ * @see jalview.datamodel.SearchResultsI#involvesSequence(jalview.datamodel.SequenceI)
*/
+ @Override
public boolean involvesSequence(SequenceI sequence)
{
SequenceI ds = sequence.getDatasetSequence();
return false;
}
- /**
- * 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
+ /* (non-Javadoc)
+ * @see jalview.datamodel.SearchResultsI#getResults(jalview.datamodel.SequenceI, int, int)
*/
+ @Override
public int[] getResults(SequenceI sequence, int start, int end)
{
if (matches.isEmpty())
return result;
}
+ /* (non-Javadoc)
+ * @see jalview.datamodel.SearchResultsI#getSize()
+ */
+ @Override
public int getSize()
{
return matches.size();
}
+ /* (non-Javadoc)
+ * @see jalview.datamodel.SearchResultsI#getResultSequence(int)
+ */
+ @Override
public SequenceI getResultSequence(int index)
{
return matches.get(index).sequence;
}
- /**
- * Returns the start position of the i'th match in the search results.
- *
- * @param i
- * @return
+ /* (non-Javadoc)
+ * @see jalview.datamodel.SearchResultsI#getResultStart(int)
*/
+ @Override
public int getResultStart(int i)
{
return matches.get(i).start;
}
- /**
- * Returns the end position of the i'th match in the search results.
- *
- * @param i
- * @return
+ /* (non-Javadoc)
+ * @see jalview.datamodel.SearchResultsI#getResultEnd(int)
*/
+ @Override
public int getResultEnd(int i)
{
return matches.get(i).end;
}
- /**
- * Returns true if no search result matches are held.
- *
- * @return
+ /* (non-Javadoc)
+ * @see jalview.datamodel.SearchResultsI#isEmpty()
*/
+ @Override
public boolean isEmpty()
{
return matches.isEmpty();
}
- /**
- * Returns the list of matches.
- *
- * @return
+ /* (non-Javadoc)
+ * @see jalview.datamodel.SearchResultsI#getResults()
*/
+ @Override
public List<Match> getResults()
{
return matches;
public String toString()
{
StringBuilder result = new StringBuilder(256);
- for (Match m : matches)
+ for (SearchResultMatchI m : matches)
{
result.append(m.toString());
}
public String getCharacters()
{
StringBuilder result = new StringBuilder(256);
- for (Match m : matches)
+ for (SearchResultMatchI m : matches)
{
result.append(m.getCharacters());
}
--- /dev/null
+package jalview.datamodel;
+
+import jalview.datamodel.SearchResults.Match;
+
+import java.util.List;
+
+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
+ *
+ * @param seq
+ * Sequence
+ * @param start
+ * int
+ * @param end
+ * int
+ */
+ public abstract void addResult(SequenceI seq, int start, int end);
+
+ /**
+ * Quickly check if the given sequence is referred to in the search results
+ *
+ * @param sequence
+ * (specific alignment sequence or a dataset sequence)
+ * @return true if the results involve sequence
+ */
+ public abstract 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
+ */
+ 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
+ */
+ public abstract int getResultStart(int i);
+
+ /**
+ * Returns the end position of the i'th match in the search results.
+ *
+ * @param i
+ * @return
+ */
+ public abstract int getResultEnd(int i);
+
+ /**
+ * Returns true if no search result matches are held.
+ *
+ * @return
+ */
+ public abstract boolean isEmpty();
+
+ /**
+ * Returns the list of matches.
+ *
+ * @return
+ */
+ public abstract List<Match> getResults();
+
+}
\ No newline at end of file
import jalview.datamodel.ColumnSelection;
import jalview.datamodel.PDBEntry;
import jalview.datamodel.SearchResults;
+import jalview.datamodel.SearchResultsI;
import jalview.datamodel.Sequence;
import jalview.datamodel.SequenceGroup;
import jalview.datamodel.SequenceI;
* there is no complement, or it is not following highlights, or no mapping
* is found, the result will be empty.
*/
- SearchResults sr = new SearchResults();
+ SearchResultsI sr = new SearchResults();
int verticalOffset = findComplementScrollTarget(sr);
if (!sr.isEmpty())
{
import jalview.api.AlignmentViewPanel;
import jalview.bin.Cache;
import jalview.datamodel.AlignmentI;
-import jalview.datamodel.SearchResults;
+import jalview.datamodel.SearchResultsI;
import jalview.datamodel.SequenceFeature;
import jalview.datamodel.SequenceGroup;
import jalview.datamodel.SequenceI;
* Highlight the given results on the alignment.
*
*/
- public void highlightSearchResults(SearchResults results)
+ public void highlightSearchResults(SearchResultsI results)
{
scrollToPosition(results);
getSeqPanel().seqCanvas.highlightSearchResults(results);
*
* @param results
*/
- public boolean scrollToPosition(SearchResults results)
+ public boolean scrollToPosition(SearchResultsI results)
{
return scrollToPosition(results, 0, true, false);
}
* @param redrawOverview
* @return
*/
- public boolean scrollToPosition(SearchResults searchResults,
+ public boolean scrollToPosition(SearchResultsI searchResults,
boolean redrawOverview)
{
return scrollToPosition(searchResults, 0, redrawOverview, false);
* if true, try to centre the search results horizontally in the view
* @return false if results were not found
*/
- public boolean scrollToPosition(SearchResults results,
+ public boolean scrollToPosition(SearchResultsI results,
int verticalOffset, boolean redrawOverview, boolean centre)
{
int startv, endv, starts, ends;
* @param verticalOffset
* the number of visible sequences to show above the mapped region
*/
- public void scrollToCentre(SearchResults sr, int verticalOffset)
+ public void scrollToCentre(SearchResultsI sr, int verticalOffset)
{
/*
* To avoid jumpy vertical scrolling (if some sequences are gapped or not
import jalview.api.FeatureColourI;
import jalview.datamodel.SearchResults;
+import jalview.datamodel.SearchResultsI;
import jalview.datamodel.SequenceFeature;
import jalview.datamodel.SequenceI;
import jalview.schemes.FeatureColour;
start.setValue(new Integer(features[index].getBegin()));
end.setValue(new Integer(features[index].getEnd()));
- SearchResults highlight = new SearchResults();
+ SearchResultsI highlight = new SearchResults();
highlight.addResult(sequences[0], features[index].getBegin(),
features[index].getEnd());
*/
package jalview.gui;
-import jalview.datamodel.SearchResults;
+import jalview.datamodel.SearchResultsI;
import jalview.datamodel.SequenceFeature;
import jalview.datamodel.SequenceI;
import jalview.jbgui.GFinder;
int resIndex = -1;
- SearchResults searchResults;
+ SearchResultsI searchResults;
/**
* Creates a new Finder object with no associated viewport or panel.
package jalview.gui;
import jalview.datamodel.AlignmentI;
-import jalview.datamodel.SearchResults;
+import jalview.datamodel.SearchResultsI;
import jalview.datamodel.SequenceGroup;
import jalview.datamodel.SequenceI;
import jalview.renderer.ScaleRenderer;
AlignViewport av;
- SearchResults searchResults = null;
+ SearchResultsI searchResults = null;
boolean fastPaint = false;
* @param results
* DOCUMENT ME!
*/
- public void highlightSearchResults(SearchResults results)
+ public void highlightSearchResults(SearchResultsI results)
{
img = null;
import jalview.commands.EditCommand.Edit;
import jalview.datamodel.AlignmentI;
import jalview.datamodel.ColumnSelection;
+import jalview.datamodel.SearchResultMatchI;
import jalview.datamodel.SearchResults;
-import jalview.datamodel.SearchResults.Match;
+import jalview.datamodel.SearchResultsI;
import jalview.datamodel.Sequence;
import jalview.datamodel.SequenceFeature;
import jalview.datamodel.SequenceGroup;
StructureSelectionManager ssm;
- SearchResults lastSearchResults;
+ SearchResultsI lastSearchResults;
/**
* Creates a new SeqPanel object.
* the start of the highlighted region.
*/
@Override
- public void highlightSequence(SearchResults results)
+ public void highlightSequence(SearchResultsI results)
{
if (results == null || results.equals(lastSearchResults))
{
*
* @param results
*/
- private void setStatusMessage(SearchResults results)
+ private void setStatusMessage(SearchResultsI results)
{
AlignmentI al = this.av.getAlignment();
int sequenceIndex = al.findIndex(results);
return;
}
SequenceI ds = al.getSequenceAt(sequenceIndex).getDatasetSequence();
- for (Match m : results.getResults())
+ for (SearchResultMatchI m : results.getResults())
{
SequenceI seq = m.getSequence();
if (seq.getDatasetSequence() != null)
if (features != null && features.size() > 0)
{
- SearchResults highlight = new SearchResults();
+ SearchResultsI highlight = new SearchResults();
highlight.addResult(sequence, features.get(0).getBegin(), features
.get(0).getEnd());
seqCanvas.highlightSearchResults(highlight);
*/
package jalview.structure;
+import jalview.datamodel.SearchResultsI;
import jalview.datamodel.SequenceI;
public interface SequenceListener
// TODO remove this? never called on SequenceListener type
public void mouseOverSequence(SequenceI sequence, int index, int pos);
- public void highlightSequence(jalview.datamodel.SearchResults results);
+ public void highlightSequence(SearchResultsI results);
// TODO remove this? never called
public void updateColours(SequenceI sequence, int index);
import jalview.datamodel.Annotation;
import jalview.datamodel.PDBEntry;
import jalview.datamodel.SearchResults;
+import jalview.datamodel.SearchResultsI;
import jalview.datamodel.SequenceI;
import jalview.ext.jmol.JmolParser;
import jalview.gui.IProgressIndicator;
return;
}
- SearchResults results = new SearchResults();
+ SearchResultsI results = new SearchResults();
for (AtomSpec atom : atoms)
{
SequenceI lastseq = null;
{
boolean hasSequenceListeners = handlingVamsasMo
|| !seqmappings.isEmpty();
- SearchResults results = null;
+ SearchResultsI results = null;
if (seqPos == -1)
{
seqPos = seq.findPosition(indexpos);
import jalview.datamodel.AlignmentI;
import jalview.datamodel.AlignmentOrder;
import jalview.datamodel.ColumnSelection;
+import jalview.datamodel.SearchResultMatchI;
import jalview.datamodel.SearchResults;
-import jalview.datamodel.SearchResults.Match;
+import jalview.datamodel.SearchResultsI;
import jalview.datamodel.Sequence;
import jalview.datamodel.SequenceGroup;
import jalview.datamodel.SequenceI;
/*
* Determine all mappings from this position to mapped sequences.
*/
- SearchResults sr = buildSearchResults(seq, seqpos, mappings);
+ SearchResultsI sr = buildSearchResults(seq, seqpos, mappings);
if (!sr.isEmpty())
{
* @param seqmappings
* @return
*/
- public static SearchResults buildSearchResults(SequenceI seq, int index,
+ public static SearchResultsI buildSearchResults(SequenceI seq, int index,
List<AlignedCodonFrame> seqmappings)
{
- SearchResults results = new SearchResults();
+ SearchResultsI results = new SearchResults();
addSearchResults(results, seq, index, seqmappings);
return results;
}
* @param index
* @param seqmappings
*/
- public static void addSearchResults(SearchResults results, SequenceI seq,
+ public static void addSearchResults(SearchResultsI results, SequenceI seq,
int index, List<AlignedCodonFrame> seqmappings)
{
if (index >= seq.getStart() && index <= seq.getEnd())
*/
List<AlignedCodonFrame> mapping = Arrays
.asList(new AlignedCodonFrame[] { acf });
- SearchResults sr = buildSearchResults(selected,
+ SearchResultsI sr = buildSearchResults(selected,
startResiduePos, mapping);
- for (Match m : sr.getResults())
+ for (SearchResultMatchI m : sr.getResults())
{
mappedStartResidue = m.getStart();
mappedEndResidue = m.getEnd();
}
sr = buildSearchResults(selected, endResiduePos, mapping);
- for (Match m : sr.getResults())
+ for (SearchResultMatchI m : sr.getResults())
{
mappedStartResidue = Math.min(mappedStartResidue,
m.getStart());
* Get the residue position and find the mapped position.
*/
int residuePos = fromSeq.findPosition(col);
- SearchResults sr = buildSearchResults(fromSeq, residuePos, mappings);
- for (Match m : sr.getResults())
+ SearchResultsI sr = buildSearchResults(fromSeq, residuePos, mappings);
+ for (SearchResultMatchI m : sr.getResults())
{
int mappedStartResidue = m.getStart();
int mappedEndResidue = m.getEnd();
import jalview.datamodel.CigarArray;
import jalview.datamodel.ColumnSelection;
import jalview.datamodel.HiddenSequences;
-import jalview.datamodel.SearchResults;
+import jalview.datamodel.SearchResultsI;
import jalview.datamodel.Sequence;
import jalview.datamodel.SequenceCollectionI;
import jalview.datamodel.SequenceGroup;
* the SearchResults to add to
* @return the offset (below top of visible region) of the matched sequence
*/
- protected int findComplementScrollTarget(SearchResults sr)
+ protected int findComplementScrollTarget(SearchResultsI sr)
{
final AlignViewportI complement = getCodingComplement();
if (complement == null || !complement.isFollowHighlight())
import jalview.datamodel.Annotation;
import jalview.datamodel.DBRefEntry;
import jalview.datamodel.Mapping;
-import jalview.datamodel.SearchResults;
-import jalview.datamodel.SearchResults.Match;
+import jalview.datamodel.SearchResultMatchI;
+import jalview.datamodel.SearchResultsI;
import jalview.datamodel.Sequence;
import jalview.datamodel.SequenceFeature;
import jalview.datamodel.SequenceI;
assertEquals(1, mappings.size());
// map G to GGG
- SearchResults sr = MappingUtils.buildSearchResults(pep1, 1, mappings);
+ SearchResultsI sr = MappingUtils.buildSearchResults(pep1, 1, mappings);
assertEquals(1, sr.getResults().size());
- Match m = sr.getResults().get(0);
+ SearchResultMatchI m = sr.getResults().get(0);
assertSame(cds1Dss, m.getSequence());
assertEquals(1, m.getStart());
assertEquals(3, m.getEnd());
List<AlignedCodonFrame> pep1CdsMappings = MappingUtils
.findMappingsForSequence(cds.getSequenceAt(0), pep1Mappings);
assertEquals(1, pep1CdsMappings.size());
- SearchResults sr = MappingUtils.buildSearchResults(pep1, 1,
+ SearchResultsI sr = MappingUtils.buildSearchResults(pep1, 1,
pep1CdsMappings);
assertEquals(1, sr.getResults().size());
- Match m = sr.getResults().get(0);
+ SearchResultMatchI m = sr.getResults().get(0);
assertEquals(cds.getSequenceAt(0).getDatasetSequence(), m.getSequence());
assertEquals(1, m.getStart());
assertEquals(3, m.getEnd());
assertEquals(1, mappings.size());
// map G to GGG
- SearchResults sr = MappingUtils.buildSearchResults(pep3, 1, mappings);
+ SearchResultsI sr = MappingUtils.buildSearchResults(pep3, 1, mappings);
assertEquals(1, sr.getResults().size());
- Match m = sr.getResults().get(0);
+ SearchResultMatchI m = sr.getResults().get(0);
assertSame(cds.getSequenceAt(0).getDatasetSequence(), m.getSequence());
assertEquals(1, m.getStart());
assertEquals(3, m.getEnd());
public void testToString()
{
SequenceI seq = new Sequence("", "abcdefghijklm");
- Match m = new SearchResults().new Match(seq, 3, 5);
+ SearchResultMatchI m = new SearchResults().new Match(seq, 3, 5);
assertEquals("2cde", m.toString());
}
public void testGetCharacters()
{
SequenceI seq = new Sequence("", "abcdefghijklm");
- Match m = new SearchResults().new Match(seq, 3, 5);
+ SearchResultMatchI m = new SearchResults().new Match(seq, 3, 5);
assertEquals("cde", m.getCharacters());
}
{
SequenceI seq1 = new Sequence("", "abcdefghijklm");
SequenceI seq2 = new Sequence("", "abcdefghijklm");
- SearchResults sr1 = new SearchResults();
- SearchResults sr2 = new SearchResults();
+ SearchResultsI sr1 = new SearchResults();
+ SearchResultsI sr2 = new SearchResults();
assertFalse(sr1.equals(null));
assertFalse(sr1.equals(seq1));
/*
* same match but on different sequences - not equal
*/
- SearchResults sr3 = new SearchResults();
+ SearchResultsI sr3 = new SearchResults();
sr3.addResult(seq2, 1, 1);
assertFalse(sr1.equals(sr3));
assertFalse(sr3.equals(sr1));
public void testToString()
{
SequenceI seq = new Sequence("", "abcdefghijklm");
- SearchResults sr = new SearchResults();
+ SearchResultsI sr = new SearchResults();
sr.addResult(seq, 1, 1);
assertEquals("0a", sr.toString());
sr.addResult(seq, 3, 5);
public void testEquals()
{
SequenceI seq1 = new Sequence("", "abcdefghijklm");
- SearchResults sr1 = new SearchResults();
- SearchResults sr2 = new SearchResults();
+ SearchResultsI sr1 = new SearchResults();
+ SearchResultsI sr2 = new SearchResults();
assertFalse(sr1.equals(null)); // null object
assertFalse(sr1.equals(seq1)); // wrong type
{
SequenceI seq1 = new Sequence("", "abcdefghijklm");
SequenceI seq2 = new Sequence("", "abcdefghijklm");
- SearchResults sr1 = new SearchResults();
- SearchResults sr2 = new SearchResults();
+ SearchResultsI sr1 = new SearchResults();
+ SearchResultsI sr2 = new SearchResults();
sr1.addResult(seq1, 1, 1);
sr2.addResult(seq2, 1, 1);
public void testEquals_orderDiffers()
{
SequenceI seq1 = new Sequence("", "abcdefghijklm");
- SearchResults sr1 = new SearchResults();
- SearchResults sr2 = new SearchResults();
+ SearchResultsI sr1 = new SearchResults();
+ SearchResultsI sr2 = new SearchResults();
sr1.addResult(seq1, 1, 1);
sr1.addResult(seq1, 2, 2);
public void testHashcode()
{
SequenceI seq1 = new Sequence("", "abcdefghijklm");
- SearchResults sr1 = new SearchResults();
- SearchResults sr2 = new SearchResults();
+ SearchResultsI sr1 = new SearchResults();
+ SearchResultsI sr2 = new SearchResults();
/*
* both empty
public void testMatchConstructor()
{
SequenceI seq1 = new Sequence("", "abcdefghijklm");
- Match m = new SearchResults().new Match(seq1, 2, 5);
+ SearchResultMatchI m = new SearchResults().new Match(seq1, 2, 5);
assertSame(seq1, m.getSequence());
assertEquals(2, m.getStart());
assertEquals(5, m.getEnd());
import jalview.datamodel.Alignment;
import jalview.datamodel.AlignmentI;
import jalview.datamodel.ColumnSelection;
-import jalview.datamodel.SearchResults;
-import jalview.datamodel.SearchResults.Match;
+import jalview.datamodel.SearchResultMatchI;
+import jalview.datamodel.SearchResultsI;
import jalview.datamodel.Sequence;
import jalview.datamodel.SequenceGroup;
import jalview.datamodel.SequenceI;
/*
* Check protein residue 12 maps to codon 5-7, 13 to codon 8-10
*/
- SearchResults sr = MappingUtils.buildSearchResults(aseq1, 12, acfList);
+ SearchResultsI sr = MappingUtils.buildSearchResults(aseq1, 12, acfList);
assertEquals(1, sr.getResults().size());
- Match m = sr.getResults().get(0);
+ SearchResultMatchI m = sr.getResults().get(0);
assertEquals(seq1.getDatasetSequence(), m.getSequence());
assertEquals(5, m.getStart());
assertEquals(7, m.getEnd());
/*
* Check protein residue 8 maps to [6, 8, 9]
*/
- SearchResults sr = MappingUtils.buildSearchResults(aseq1, 8, acfList);
+ SearchResultsI sr = MappingUtils.buildSearchResults(aseq1, 8, acfList);
assertEquals(2, sr.getResults().size());
- Match m = sr.getResults().get(0);
+ SearchResultMatchI m = sr.getResults().get(0);
assertEquals(seq1.getDatasetSequence(), m.getSequence());
assertEquals(6, m.getStart());
assertEquals(6, m.getEnd());