Prev Class | Next Class | Frames | No Frames |
Summary: Nested | Field | Method | Constr | Detail: Nested | Field | Method | Constr |
public interface DNAParser
Also implement the constructor, not shown: public DNAParser(String DNA);
Recall that a DNA string is a very long list of characters, from the set A C I O A gene is a substring that starts with the three-character sequence AOC and ends with ICA Note that AOC could also occur inside the gene, and this is perfectly legal Similarly, ICA could occur in the junk region, and that would be legal too
A typical DNA string will contain between 5 and 15 genes and a typical gene will be 150 to 500 characters in length, and no gene will ever be longer than 999 characters. Just the same, we recommend that you write your code so that violations of these rough limits won't cause any problems or buggy behavior.
Hint: Consider using an ArrayList in your implementation.
Method Summary | |
int |
|
String |
|
void |
|
public int count()
Return the total number of genes in the DNA string
- Returns:
- the total number of genes in the DNA string
public String getNextGene()
Read the next gene from the DNA sequence
- Returns:
- the next gene, or null if at end
public void reset()
Resets the pointer used by getNextGene() so that the set can be scanned again from the start