Hi every one,
I have an abstract class and its constructer must take two
String as instance varable (content,description) and it contain two method the first one is an abstract method called validLetters() this method will be implement in two subclass and it must returns a certain letters such as ("A","T","C","G")in a set (collection) of DNA subclass.
The second method is validate() this method must called by constructer of superclass and it goes through the content string and checks that each letter is valid. If it finds one that isn't it creates an Exception with the content and the duff letter index, and throws it. In order to deal with different sequences having different valid letters we declare an abstract method validLetters() which returns the relevant letters as to be checked in validate().
I try to understand how can I use validLetters() in side the validate()
and I try this :
public abstract char[] validLetters();
public void validate() throws InvalidSequenceException
{
char[] letters = letters .getContent();
for(int i=0;i < letters.length;i++)
if (letters[i]==validLetters() )
{ system.out.println("sequence is in fasta");
}
else throw(new InvalidSequenceException());
I think this method full of mistaks
and how can I call validate by constructer is it correct to w
private String description , content ;
public Sequence (String description ,String content)
{ // instructor
this.description = description;
this.content = content;
validate();
}
thanks
alot sara