org.expasy.jpl.commons.collection.symbol
Class AbstractDataSymbolRegister<T>

java.lang.Object
  extended by org.expasy.jpl.commons.collection.symbol.AbstractDataSymbolRegister<T>
Type Parameters:
T -
All Implemented Interfaces:
Serializable, AlphabetView<T>, DataSymbolRegister<T>

public abstract class AbstractDataSymbolRegister<T>
extends Object
implements DataSymbolRegister<T>

Generic data symbol manager to include in jpl.

Version:
1.0
Author:
nikitin
See Also:
Serialized Form

Field Summary
protected  Map<Symbol<T>,T> sym2data
           
 
Constructor Summary
protected AbstractDataSymbolRegister(Symbol.SymbolType<T> type)
           
 
Method Summary
abstract  Map<Character,T> createDataMap()
           
 Set<Character> getLetters()
           
 String getRegEx()
           
 int getSymbolNumber()
           
 boolean hasSymbol(char symbol)
           
abstract  void link(Symbol<T> symbol, T data)
          link a symbol to its data
abstract  T lookupData(char name)
           
 T lookupData(Symbol<T> symbol)
           
 Symbol<T> lookupSymbol(char name)
           
 TreeView<? extends Symbol<T>> lookupSymbolNode(char name)
           
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

sym2data

protected Map<Symbol<T>,T> sym2data
Constructor Detail

AbstractDataSymbolRegister

protected AbstractDataSymbolRegister(Symbol.SymbolType<T> type)
Method Detail

lookupData

public T lookupData(Symbol<T> symbol)
Specified by:
lookupData in interface DataSymbolRegister<T>
Returns:
the T-data mapped by the terminal symbol

hasSymbol

public boolean hasSymbol(char symbol)
Specified by:
hasSymbol in interface AlphabetView<T>
Returns:
true if symbol exists

getSymbolNumber

public int getSymbolNumber()
Specified by:
getSymbolNumber in interface AlphabetView<T>
Returns:
the number of symbols

lookupSymbol

public Symbol<T> lookupSymbol(char name)
Specified by:
lookupSymbol in interface AlphabetView<T>
Returns:
a symbol of type T

lookupSymbolNode

public TreeView<? extends Symbol<T>> lookupSymbolNode(char name)
Specified by:
lookupSymbolNode in interface AlphabetView<T>
Returns:
a tree node over symbol of type T

getLetters

public Set<Character> getLetters()
Specified by:
getLetters in interface AlphabetView<T>
Returns:
the set of letters.

getRegEx

public String getRegEx()
Specified by:
getRegEx in interface AlphabetView<T>
Returns:
the pattern that match this alphabet

toString

public String toString()
Overrides:
toString in class Object

lookupData

public abstract T lookupData(char name)
Specified by:
lookupData in interface DataSymbolRegister<T>
Returns:
the T-data mapped by the terminal named symbol

link

public abstract void link(Symbol<T> symbol,
                          T data)
Description copied from interface: DataSymbolRegister
link a symbol to its data

Specified by:
link in interface DataSymbolRegister<T>

createDataMap

public abstract Map<Character,T> createDataMap()
Specified by:
createDataMap in interface DataSymbolRegister<T>
Returns:
a map data char -> T-data object


Copyright (c) 2012 Swiss Institute of Bioinformatics. All rights reserved.