org.expasy.jpl.core.mol
Class AbstractMolecularSymbolManager<T extends Molecule>

java.lang.Object
  extended by org.expasy.jpl.core.mol.AbstractMolecularSymbolManager<T>
All Implemented Interfaces:
Serializable, org.expasy.jpl.commons.collection.symbol.AlphabetView<T>, org.expasy.jpl.commons.collection.symbol.DataSymbolRegister<T>
Direct Known Subclasses:
AAManager, AATermManager, CTermManager, DeoxyRiboNucManager, NTermManager, RiboNucManager

public abstract class AbstractMolecularSymbolManager<T extends Molecule>
extends Object
implements org.expasy.jpl.commons.collection.symbol.DataSymbolRegister<T>

This abstract class proposes a mechanism to map a Symbol to its Molecule by coupling a table of molecular symbols with the molecular pool. Each subclasses symbol manager will have to implement 3 methods:

Version:
1.0
Author:
nikitin
See Also:
ChemicalFacade, Serialized Form

Field Summary
protected  Map<Character,T> molecularMap
          data molecular map
protected static org.expasy.jpl.commons.collection.symbol.SymbolTable SYMBOL_TABLE
          the table of molecular symbols
protected  Map<org.expasy.jpl.commons.collection.symbol.Symbol<T>,T> symbol2molecules
          map molecular symbols to their (pooled) molecule instance
 
Constructor Summary
protected AbstractMolecularSymbolManager(org.expasy.jpl.commons.collection.symbol.Symbol.SymbolType<T> type)
          Sole constructor.
 
Method Summary
 Set<Character> getLetters()
          
 String getRegEx()
           
 int getSymbolNumber()
           
static
<T extends Molecule>
org.expasy.jpl.commons.collection.symbol.Symbol.SymbolType<T>
getSymbolType(String name)
           
 boolean hasSymbol(char name)
           
 void link(org.expasy.jpl.commons.collection.symbol.Symbol<T> symbol, T molecule)
           
 T lookupData(char name)
           
 T lookupData(org.expasy.jpl.commons.collection.symbol.Symbol<T> symbol)
          Get the T-data linked to terminal symbol.
 Set<T> lookUpDataFromSymbols(Set<org.expasy.jpl.commons.collection.symbol.Symbol<T>> symbols)
           
 String lookUpRegex(char name)
           
 org.expasy.jpl.commons.collection.symbol.Symbol<T> lookupSymbol(char name)
           
 org.expasy.jpl.commons.collection.tree.TreeView<? extends org.expasy.jpl.commons.collection.symbol.Symbol<T>> lookupSymbolNode(char name)
           
protected static byte toByte(char c)
           
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.expasy.jpl.commons.collection.symbol.DataSymbolRegister
createDataMap
 

Field Detail

SYMBOL_TABLE

protected static org.expasy.jpl.commons.collection.symbol.SymbolTable SYMBOL_TABLE
the table of molecular symbols


symbol2molecules

protected Map<org.expasy.jpl.commons.collection.symbol.Symbol<T extends Molecule>,T extends Molecule> symbol2molecules
map molecular symbols to their (pooled) molecule instance


molecularMap

protected Map<Character,T extends Molecule> molecularMap
data molecular map

Constructor Detail

AbstractMolecularSymbolManager

protected AbstractMolecularSymbolManager(org.expasy.jpl.commons.collection.symbol.Symbol.SymbolType<T> type)
Sole constructor. Create and register symbols in table of molecular symbols for invocation by subclass constructors.)

Parameters:
type - the type of molecular symbol.
Method Detail

getSymbolType

public static <T extends Molecule> org.expasy.jpl.commons.collection.symbol.Symbol.SymbolType<T> getSymbolType(String name)

getLetters

public Set<Character> getLetters()

Specified by:
getLetters in interface org.expasy.jpl.commons.collection.symbol.AlphabetView<T extends Molecule>

link

public final void link(org.expasy.jpl.commons.collection.symbol.Symbol<T> symbol,
                       T molecule)
Specified by:
link in interface org.expasy.jpl.commons.collection.symbol.DataSymbolRegister<T extends Molecule>

lookupData

public final T lookupData(org.expasy.jpl.commons.collection.symbol.Symbol<T> symbol)
Get the T-data linked to terminal symbol.

Specified by:
lookupData in interface org.expasy.jpl.commons.collection.symbol.DataSymbolRegister<T extends Molecule>
Parameters:
symbol - the terminal symbol.

lookUpDataFromSymbols

public final Set<T> lookUpDataFromSymbols(Set<org.expasy.jpl.commons.collection.symbol.Symbol<T>> symbols)

lookupData

public final T lookupData(char name)
Specified by:
lookupData in interface org.expasy.jpl.commons.collection.symbol.DataSymbolRegister<T extends Molecule>

lookupSymbolNode

public final org.expasy.jpl.commons.collection.tree.TreeView<? extends org.expasy.jpl.commons.collection.symbol.Symbol<T>> lookupSymbolNode(char name)
Specified by:
lookupSymbolNode in interface org.expasy.jpl.commons.collection.symbol.AlphabetView<T extends Molecule>

getRegEx

public String getRegEx()
Specified by:
getRegEx in interface org.expasy.jpl.commons.collection.symbol.AlphabetView<T extends Molecule>

lookUpRegex

public final String lookUpRegex(char name)
Returns:
the regular expression defining the symbol

lookupSymbol

public final org.expasy.jpl.commons.collection.symbol.Symbol<T> lookupSymbol(char name)
Specified by:
lookupSymbol in interface org.expasy.jpl.commons.collection.symbol.AlphabetView<T extends Molecule>

hasSymbol

public final boolean hasSymbol(char name)
Specified by:
hasSymbol in interface org.expasy.jpl.commons.collection.symbol.AlphabetView<T extends Molecule>

getSymbolNumber

public final int getSymbolNumber()
Specified by:
getSymbolNumber in interface org.expasy.jpl.commons.collection.symbol.AlphabetView<T extends Molecule>

toByte

protected static final byte toByte(char c)

toString

public String toString()
Overrides:
toString in class Object


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