|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.biojava.bio.symbol.AlphabetManager
The first port of call for retrieving standard alphabets.
The alphabet interfaces themselves don't give you a lot of help in actualy getting an alphabet instance. This is where the AlphabetManager comes in handy. It helps out in serialization, generating derived alphabets and building CrossProductAlphabet instances. It also contains limited support for parsing complex alphabet names back into the alphabets.
Inner Class Summary | |
static class |
AlphabetManager.ListWrapper
Simple wrapper to assist in list-comparisons. |
Constructor Summary | |
AlphabetManager()
|
Method Summary | |
static Alphabet |
alphabetForName(java.lang.String name)
Retrieve the alphabet for a specific name. |
static java.util.Iterator |
alphabets()
Get an iterator over all alphabets known. |
static CrossProductAlphabet |
generateCrossProductAlphaFromName(java.lang.String name)
Generates a new CrossProductAlphabet from the give name. |
static Symbol |
getAmbiguitySymbol(char token,
java.lang.String name,
Annotation ann,
java.util.Collection syms)
Create a specific ambiguity symbol for a collection of symbols. |
static Symbol |
getAmbiguitySymbol(java.util.Collection syms)
Obtain the default ambiguity symbol to represent the symbols passed in as parameters e.g. |
static CrossProductAlphabet |
getCrossProductAlphabet(java.util.List aList)
Retrieve a CrossProductAlphabet instance over the alphabets in aList. |
static CrossProductAlphabet |
getCrossProductAlphabet(java.util.List aList,
CrossProductAlphabet parent)
Retrieve a CrossProductAlphabet instance over the alphabets in aList. |
static CrossProductSymbol |
getCrossProductSymbol(char token,
java.util.List symList)
Generates a new CrossProductSymbol instance. |
static CrossProductSymbol |
getCrossProductSymbol(char token,
java.util.List symList,
CrossProductAlphabet parent)
Generates a new CrossProductSymbol instance. |
static CrossProductSymbol |
getGapSymbol()
Get the special `gap' Symbol. |
static AlphabetManager |
instance()
Deprecated. all AlphabetManager methods have become static |
static void |
registerAlphabet(java.lang.String name,
Alphabet alphabet)
Register an alphabet by name. |
static Symbol |
symbolForName(java.lang.String name)
Retrieve the symbol represented a String object |
Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
Constructor Detail |
public AlphabetManager()
Method Detail |
public static AlphabetManager instance()
public static Alphabet alphabetForName(java.lang.String name) throws java.util.NoSuchElementException
name
- the name of the alphabetpublic static Symbol symbolForName(java.lang.String name) throws java.util.NoSuchElementException
name
- of the string whose symbol you want to getpublic static void registerAlphabet(java.lang.String name, Alphabet alphabet)
name
- the name by which it can be retrievedalphabet
- the Alphabet to storepublic static java.util.Iterator alphabets()
public static CrossProductSymbol getGapSymbol()
public static CrossProductSymbol getCrossProductSymbol(char token, java.util.List symList)
This factory method hides some complexity about exactly what to make. If symList contains only gaps, then the gap symbol is returned. If it contains only AtomicSymbol instances, then a CrossProductSymbol implementing AtomicSymbol will be returned. Otherwise, a plain-old CrossProductSymbol will be returned.
This method makes no attempt to force singleton-ness upon the returned symbol. This method will normaly be invoked by methods within alphabet implementations, not by client code.
symList
- a list of Symbol objectspublic static CrossProductSymbol getCrossProductSymbol(char token, java.util.List symList, CrossProductAlphabet parent)
This factory method hides some complexity about exactly what to make. If symList contains only gaps, then the gap symbol is returned. If it contains only AtomicSymbol instances, then a CrossProductSymbol implementing AtomicSymbol will be returned. Otherwise, a plain-old CrossProductSymbol will be returned.
This method makes no attempt to force singleton-ness upon the returned symbol. This method will normaly be invoked by methods within alphabet implementations, not by client code.
symList
- a list of Symbol objectsparent
- a parental CrossProductAlphabet instancepublic static CrossProductAlphabet generateCrossProductAlphaFromName(java.lang.String name)
name
- the name to parsepublic static CrossProductAlphabet getCrossProductAlphabet(java.util.List aList)
If all of the alphabets in aList implements FiniteAlphabet then the method will return a FiniteAlphabet. Otherwise, it returns a non-finite alphabet.
If you call this method twice with a list containing the same alphabets, it will return the same alphabet. This promotes the re-use of alphabets and helps to maintain the 'flyweight' principal for finite alphabet symbols.
The resulting alphabet cpa will be retrievable via AlphabetManager.alphabetForName(cpa.getName())
aList
- a list of Alphabet objectspublic static CrossProductAlphabet getCrossProductAlphabet(java.util.List aList, CrossProductAlphabet parent)
If all of the alphabets in aList implements FiniteAlphabet then the method will return a FiniteAlphabet. Otherwise, it returns a non-finite alphabet.
If you call this method twice with a list containing the same alphabets, it will return the same alphabet. This promotes the re-use of alphabets and helps to maintain the 'flyweight' principal for finite alphabet symbols.
The resulting alphabet cpa will be retrievable via AlphabetManager.alphabetForName(cpa.getName())
aList
- a list of Alphabet objectsparent
- a parent alphabetpublic static Symbol getAmbiguitySymbol(java.util.Collection syms) throws IllegalSymbolException
syms
- the collection of symbolspublic static Symbol getAmbiguitySymbol(char token, java.lang.String name, Annotation ann, java.util.Collection syms) throws IllegalSymbolException
token
- the ambiguity character's designated tokenname
- a name for this ambiguity symbol.ann
- Annotation to associate with the ambiguity symbolsyms
- the collection of symbols which will be represented by this ambiguity symbol
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |