|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.biojava.bio.symbol.AllTokensAlphabet
An implementation of FiniteAlphabet that grows the alphabet to accomodate all the characters seen while parsing a file.
The contains and validate methods will still work as for other alphabets, but the parsers will generate new symbol objects for each token or name seen.
This is particularly useful when reading in arbitrary alphabet files where you don't want to invest the time and effort writing a formal alphabet.
Inner classes inherited from class org.biojava.bio.symbol.Alphabet |
Alphabet.EmptyAlphabet |
Fields inherited from interface org.biojava.bio.symbol.Alphabet |
EMPTY_ALPHABET |
Constructor Summary | |
AllTokensAlphabet(java.lang.String name)
|
Method Summary | |
protected void |
addSymbol(Symbol r)
|
boolean |
contains(Symbol r)
Returns whether or not this Alphabet contains the symbol. |
Annotation |
getAnnotation()
Should return the associated annotation object. |
java.lang.String |
getName()
Get the name of the alphabet. |
SymbolParser |
getParser(java.lang.String name)
Get a parser by name. |
java.util.Iterator |
iterator()
Retrieve an Iterator over the Symbols in this FiniteAlphabet. |
int |
size()
The number of symbols in the alphabet. |
SymbolList |
symbols()
A list of symbols that make up this alphabet. |
void |
validate(Symbol r)
Throws a precanned IllegalSymbolException if the symbol is not contained within this Alphabet. |
Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
Constructor Detail |
public AllTokensAlphabet(java.lang.String name)
Method Detail |
protected void addSymbol(Symbol r)
public java.util.Iterator iterator()
Each AtomicSymbol as for which this.contains(as) is true will be returned exactly once by this iterator in no specified order.
public Annotation getAnnotation()
public boolean contains(Symbol r)
An alphabet contains an ambiguity symbol iff the ambiguity symbol's getMemberAlphabet() returns an alphabe that is a propper sub-set of this alphabet. That means that every one of the symbols that could mach the ambiguity symbol is also a member of this alphabet.
r
- the Symbol to checkpublic java.lang.String getName()
public SymbolParser getParser(java.lang.String name) throws java.util.NoSuchElementException
The parser returned is guaranteed to return Symbols and SymbolLists that conform to this alphabet.
Every alphabet should have a SymbolParser under the name 'token' that uses the symbol token characters to translate a string into a SymbolList. Likewise, there should be a SymbolParser under the name 'name' that uses symbol names to identify symbols. Any other names may also be defined, but the behaviour of that parser is not defined here.
name
- the name of the parserpublic SymbolList symbols()
Subsequent calls to this method are not required to return either the same symbol list, or even a symbol list with the symbols in the same order.
public int size()
public void validate(Symbol r) throws IllegalSymbolException
This function is used all over the code to validate symbols as they enter a method. Also, the code is littered with catches for IllegalSymbolException. There is a preferred style of handling this, which should be covererd in the package documentation.
r
- the Symbol to validate
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |