sbrt.shell.text.chem
Class CatalystFormatV1

java.lang.Object
  extended by sbrt.shell.text.chem.CatalystFormatV1
All Implemented Interfaces:
CatalystFormat, Format, Formatter<java.lang.String>, Parser<java.lang.String>, SimpleFormat<java.lang.String>

public final class CatalystFormatV1
extends java.lang.Object
implements CatalystFormat

This class is a concrete implementation of CatalystFormat. This format considers catalyts to be String objects, which are referred to as catalyst names. Catalyst names cannot contain any whitespace characters (spaces, tabs, or newlines) and their length must be greater than 0.

Author:
This class was written and documented by Jeremiah Wright while in the Wagner lab.

Constructor Summary
CatalystFormatV1()
           
 
Method Summary
 java.lang.String format(java.lang.String catalystName)
          Returns the provided catalyst name after ensuring it conforms to this format.
 java.lang.String parse(java.lang.String catalystName)
          Parses the provided string and returns its corresponding catalyst name.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CatalystFormatV1

public CatalystFormatV1()
Method Detail

format

public java.lang.String format(java.lang.String catalystName)
Returns the provided catalyst name after ensuring it conforms to this format.

Specified by:
format in interface Formatter<java.lang.String>
Parameters:
catalystName - the catalyst name to be checked.
Returns:
the provided catalyst name.
Throws:
java.lang.IllegalArgumentException - if the provided catalyst name does not conform to this format.
java.lang.NullPointerException - if the provided string is null.

parse

public java.lang.String parse(java.lang.String catalystName)
Parses the provided string and returns its corresponding catalyst name.

Specified by:
parse in interface Parser<java.lang.String>
Parameters:
catalystName - the string to be parsed.
Returns:
a copy of the provided string with leading and trailing white space removed, or the provided string if it has no leading or trailing white space.
Throws:
FormatException - if the provided string is not a valid catalyst name.
java.lang.NullPointerException - if the provided string is null.