uk.ac.ebi.intenz.tools.sib.translator.rules
Class UnorderedRules

java.lang.Object
  extended by uk.ac.ebi.intenz.tools.sib.translator.rules.UnorderedRules
All Implemented Interfaces:
RuleGroup

public class UnorderedRules
extends Object
implements RuleGroup

This singleton class stores regular expression rules to be used to transform text.

Each rule consists of a regular expression pattern and a replacement string. The rules will be applied in an arbitrary order.

Version:
$Revision: 1.3 $ $Date: 2009/05/14 15:02:28 $
Author:
Michael Darsow

Method Summary
 String applyRules(String text)
          Applies the rules.
static UnorderedRules getInstance()
          Returns the sole instance of this class.
 String reverseRules(String text)
          Applies the reverse rules.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getInstance

public static UnorderedRules getInstance()
Returns the sole instance of this class.

If no instance is available yet then it will be created.

Returns:
the class's sole instance.

applyRules

public String applyRules(String text)
Applies the rules.

Specified by:
applyRules in interface RuleGroup
Parameters:
text - The text to be translated.
Returns:
the translated text.
Throws:
NullPointerException - if text is null.

reverseRules

public String reverseRules(String text)
Applies the reverse rules. This rule also capitalises the first letter of the given text since all affected line types start with a capital letter.

Specified by:
reverseRules in interface RuleGroup
Parameters:
text - The text to be translated.
Returns:
the translated text.
Throws:
NullPointerException - if text is null.


Copyright © 2013 EMBL-EBI. All Rights Reserved.