Class SingletonAlphabet
- java.lang.Object
-
- org.biojava.utils.AbstractChangeable
-
- org.biojava.bio.symbol.AbstractAlphabet
-
- org.biojava.bio.symbol.SingletonAlphabet
-
- All Implemented Interfaces:
Serializable,Annotatable,Alphabet,FiniteAlphabet,Changeable
public class SingletonAlphabet extends AbstractAlphabet implements FiniteAlphabet, Serializable
An alphabet that contains a single atomic symbol.- Author:
- Matthew Pocock
- See Also:
- Serialized Form
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.biojava.bio.Annotatable
Annotatable.AnnotationForwarder
-
-
Field Summary
-
Fields inherited from class org.biojava.bio.symbol.AbstractAlphabet
serialVersionUID
-
Fields inherited from interface org.biojava.bio.symbol.Alphabet
EMPTY_ALPHABET, PARSERS, SYMBOLS
-
Fields inherited from interface org.biojava.bio.Annotatable
ANNOTATION
-
-
Constructor Summary
Constructors Constructor Description SingletonAlphabet(AtomicSymbol sym)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddSymbolImpl(AtomicSymbol sym)protected booleancontainsImpl(AtomicSymbol s)ListgetAlphabets()Return an ordered List of the alphabets which make up a compound alphabet.AnnotationgetAnnotation()Should return the associated annotation object.StringgetName()Get the name of the alphabet.protected AtomicSymbolgetSymbolImpl(List symList)SymbolTokenizationgetTokenization(String name)Get a SymbolTokenization by name.Iteratoriterator()Retrieve an Iterator over the AtomicSymbols in this FiniteAlphabet.voidremoveSymbol(Symbol sym)Remove a symbol from this alphabet.intsize()The number of symbols in the alphabet.-
Methods inherited from class org.biojava.bio.symbol.AbstractAlphabet
addSymbol, contains, getAmbiguity, getAmbiguityImpl, getGapSymbol, getSymbol, putTokenization, readResolve, toString, validate
-
Methods inherited from class org.biojava.utils.AbstractChangeable
addChangeListener, addChangeListener, generateChangeSupport, getChangeSupport, hasListeners, hasListeners, isUnchanging, removeChangeListener, removeChangeListener
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.biojava.bio.symbol.Alphabet
contains, getAmbiguity, getGapSymbol, getSymbol, validate
-
Methods inherited from interface org.biojava.utils.Changeable
addChangeListener, addChangeListener, isUnchanging, removeChangeListener, removeChangeListener
-
Methods inherited from interface org.biojava.bio.symbol.FiniteAlphabet
addSymbol
-
-
-
-
Constructor Detail
-
SingletonAlphabet
public SingletonAlphabet(AtomicSymbol sym)
-
-
Method Detail
-
getAlphabets
public List getAlphabets()
Description copied from interface:AlphabetReturn an ordered List of the alphabets which make up a compound alphabet. For simple alphabets, this will return a singleton list of itself. The returned list should be immutable.- Specified by:
getAlphabetsin interfaceAlphabet- Returns:
- a List of alphabets
-
containsImpl
protected boolean containsImpl(AtomicSymbol s)
- Specified by:
containsImplin classAbstractAlphabet
-
getName
public String getName()
Description copied from interface:AlphabetGet the name of the alphabet.
-
getTokenization
public SymbolTokenization getTokenization(String name) throws NoSuchElementException
Description copied from interface:AlphabetGet a SymbolTokenization by name.
The parser returned is guaranteed to return Symbols and SymbolLists that conform to this alphabet.
Every alphabet should have a SymbolTokenzation under the name 'token' that uses the symbol token characters to translate a string into a SymbolList. Likewise, there should be a SymbolTokenization under the name 'name' that uses symbol names to identify symbols. Any other names may also be defined, but the behavior of the returned SymbolTokenization is not defined here.
A SymbolTokenization under the name 'default' should be defined for all sequences, that determines the behavior when printing out a sequence. Standard behavior is to define the 'token' SymbolTokenization as default if it exists, else to define the 'name' SymbolTokenization as the default, but others are possible.
- Specified by:
getTokenizationin interfaceAlphabet- Overrides:
getTokenizationin classAbstractAlphabet- Parameters:
name- the name of the parser- Returns:
- a parser for that name
- Throws:
NoSuchElementException- if the name is unknown
-
iterator
public Iterator iterator()
Description copied from interface:FiniteAlphabetRetrieve an Iterator over the AtomicSymbols in this FiniteAlphabet.Each AtomicSymbol as for which this.contains(as) is true will be returned exactly once by this iterator in no specified order.
- Specified by:
iteratorin interfaceFiniteAlphabet- Returns:
- an Iterator over the contained AtomicSymbol objects
-
size
public int size()
Description copied from interface:FiniteAlphabetThe number of symbols in the alphabet.- Specified by:
sizein interfaceFiniteAlphabet- Returns:
- the size of the alphabet
-
getAnnotation
public Annotation getAnnotation()
Description copied from interface:AnnotatableShould return the associated annotation object.- Specified by:
getAnnotationin interfaceAnnotatable- Returns:
- an Annotation object, never null
-
addSymbolImpl
public void addSymbolImpl(AtomicSymbol sym) throws IllegalSymbolException
- Specified by:
addSymbolImplin classAbstractAlphabet- Throws:
IllegalSymbolException
-
removeSymbol
public void removeSymbol(Symbol sym) throws IllegalSymbolException
Description copied from interface:FiniteAlphabetRemove a symbol from this alphabet.If the symbol matches multiple AtomicSymbols, then each matching symbol it will be removed.
- Specified by:
removeSymbolin interfaceFiniteAlphabet- Parameters:
sym- the Symbol to removeintGot- Throws:
IllegalSymbolException- if the symbol is null, or if for any reason it can't be removed
-
getSymbolImpl
protected AtomicSymbol getSymbolImpl(List symList) throws IllegalSymbolException
- Specified by:
getSymbolImplin classAbstractAlphabet- Throws:
IllegalSymbolException
-
-