org.openscience.nmrshiftdb.util
Class ParseUtils

java.lang.Object
  extended by org.openscience.nmrshiftdb.util.ParseUtils

public class ParseUtils
extends java.lang.Object

This class contains utitilies for parsing input strings

Author:
shk3

Constructor Summary
ParseUtils()
           
 
Method Summary
static java.util.ArrayList parseSpectrum(java.lang.String input)
          Returns an ArrayList of ValueTriples out of an input string like 3,4\n5;6...
static java.util.ArrayList parseSpectrumFromSpecFile(java.lang.String spectrum)
          Returns an ArrayList of ValueTriples out of an input string like 3,4,1|5,6,2|..., as found in the specfile attribute of Spectrum in the database
static void removeDuplicates(java.util.List al)
          Removes duplicate entries from an ArrayList of ValueTriples
static java.lang.String toInputSpectrum(java.util.ArrayList v)
          Returns an array of ValueTriple in the format of the input String
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ParseUtils

public ParseUtils()
Method Detail

parseSpectrum

public static java.util.ArrayList parseSpectrum(java.lang.String input)
                                         throws java.lang.NumberFormatException
Returns an ArrayList of ValueTriples out of an input string like 3,4\n5;6...

Parameters:
input - The input
Returns:
An ArrayList of ValueTriples
Throws:
java.lang.NumberFormatException - User inputed non-numerical values

parseSpectrumFromSpecFile

public static java.util.ArrayList parseSpectrumFromSpecFile(java.lang.String spectrum)
                                                     throws java.lang.NumberFormatException
Returns an ArrayList of ValueTriples out of an input string like 3,4,1|5,6,2|..., as found in the specfile attribute of Spectrum in the database

Parameters:
spectrum - Description of Parameter
Returns:
An ArrayList of ValueTriples
Throws:
java.lang.NumberFormatException - User inputed non-numerical values

removeDuplicates

public static void removeDuplicates(java.util.List al)
Removes duplicate entries from an ArrayList of ValueTriples

Parameters:
al - The ArrayList to process

toInputSpectrum

public static java.lang.String toInputSpectrum(java.util.ArrayList v)
Returns an array of ValueTriple in the format of the input String

Parameters:
v - The valueTriples
Returns:
The input String