org.biojava.bio.program.tagvalue
Class ChangeTable

java.lang.Object
  extended by org.biojava.bio.program.tagvalue.ChangeTable

public class ChangeTable
extends Object

A mapping between keys and actions to turn old values into new values.

Since:
1.3
Author:
Matthew Pocock

Nested Class Summary
static class ChangeTable.ChainedChanger
          An implementation of Changer that applies a list of Changer instances to the value in turn.
static interface ChangeTable.Changer
          Callback used to produce a new value from an old one.
static interface ChangeTable.Splitter
          Callback used to produce a list of values from a single old one.
 
Field Summary
static ChangeTable.Changer STRING_TO_INT
           
 
Constructor Summary
ChangeTable()
           
 
Method Summary
 Object change(Object tag, Object value)
           
 ChangeTable.Changer getChanger(Object tag)
          Get the Changer currently registered to handle a tag.
 ChangeTable.Splitter getSplitter(Object tag)
          Get the Splitter currently registered to handle a tag.
 void setChanger(Object tag, ChangeTable.Changer changer)
          Set the Changer to be used for all values of a particular tag.
 void setSplitter(Object tag, ChangeTable.Splitter splitter)
          Set the Splitter to be used for all values of a particular tag.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

STRING_TO_INT

public static final ChangeTable.Changer STRING_TO_INT
Constructor Detail

ChangeTable

public ChangeTable()
Method Detail

setChanger

public void setChanger(Object tag,
                       ChangeTable.Changer changer)
Set the Changer to be used for all values of a particular tag.

Parameters:
tag - the tag Object which will have all values changed
changer - the Changer used to change the values

setSplitter

public void setSplitter(Object tag,
                        ChangeTable.Splitter splitter)
Set the Splitter to be used for all values of a particular tag.

Parameters:
tag - the tag Object which will have all values split
splitter - the Splitter used to split the values

getChanger

public ChangeTable.Changer getChanger(Object tag)
Get the Changer currently registered to handle a tag.

Parameters:
tag - the tag Object for which values would be changed
Returns:
the associated Changer or null

getSplitter

public ChangeTable.Splitter getSplitter(Object tag)
Get the Splitter currently registered to handle a tag.

Parameters:
tag - the tag Object for which values would be split
Returns:
the associated Splitter or null

change

public Object change(Object tag,
                     Object value)
              throws ParserException
Throws:
ParserException