sbrt.shell.text.fba
Class FbaOptFileLineFormatV1

java.lang.Object
  extended by sbrt.shell.text.fba.FbaOptFileLineFormatV1
All Implemented Interfaces:
FbaOptFileLineFormat, Format, MapFormat<java.lang.String,java.lang.Double>

public final class FbaOptFileLineFormatV1
extends java.lang.Object
implements FbaOptFileLineFormat

This class is a concrete implementation of FbaOptFileLineFormat.

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

Constructor Summary
FbaOptFileLineFormatV1(Fluxome fluxome)
          Constructs a new FBA optimization file line format.
 
Method Summary
 java.lang.String formatKey(java.lang.String key)
          Returns a formatted string representation of the provided key.
 java.lang.String formatKeys(java.util.Set<? extends java.lang.String> keys)
          Returns a formatted string representation of the provided set of keys.
 java.lang.String formatPair(java.util.Map.Entry<? extends java.lang.String,? extends java.lang.Double> entry)
          Returns a formatted string representation of the provided map entry.
 java.lang.String formatPair(java.lang.String key, java.lang.Double value)
          Returns a string representation of the provided key-value pair.
 java.lang.String formatValue(java.lang.Double value)
          Returns a formatted string representation of the provided value.
 java.lang.String formatValues(java.util.List<? extends java.lang.Double> values)
          Returns a string representation of the provided list of values.
 java.lang.String formatValues(java.util.Map<? extends java.lang.String,? extends java.lang.Double> map)
          Returns a string representation of the values in the provided map formatted as a list.
 DoubleFormatV1 getDoubleFormat()
          Returns the format used for doubles.
 Fluxome getFluxome()
          Returns the fluxome used to verify reaction names.
 java.lang.String getObjValueHeader()
          Returns the header used to indicate the value of the objective function.
 boolean isObjValueHeader(java.lang.String s)
          Indicates if the provided string is the header used to indicate the value of the objective function.
 java.util.LinkedHashSet<java.lang.String> parseAllKeys(java.lang.String allKeys)
          Parses the provided string and returns its corresponding set of keys.
 java.util.Map<java.lang.String,java.lang.Double> parseAllPairs(java.lang.String allkeys, java.lang.String allValues)
          Parses the provided set of keys and list of values and returns a corresponding map of variable-value pairs.
 java.util.Map<java.lang.String,java.lang.Double> parseAllValues(java.util.LinkedHashSet<? extends java.lang.String> allkeys, java.lang.String allValues)
          Parses the provided string of values and returns a corresponding map of variable-value pairs using the provided set of keys.
 java.util.List<java.lang.Double> parseAllValues(java.lang.String allValues)
          Parses the provided string and returns its corresponding list of values.
 java.lang.String parseKey(java.lang.String key)
          Parses the provided string and returns its corresponding key.
 java.util.Map.Entry<java.lang.String,java.lang.Double> parsePair(java.lang.String mapEntry)
          Parses the provided map entry string, and returns its corresponding map entry.
 java.lang.Double parseValue(java.lang.String value)
          Parses the provided string and returns its corresponding value.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FbaOptFileLineFormatV1

public FbaOptFileLineFormatV1(Fluxome fluxome)
Constructs a new FBA optimization file line format.

Parameters:
fluxome - the fluxome used to verify reaction names.
Method Detail

isObjValueHeader

public boolean isObjValueHeader(java.lang.String s)
Indicates if the provided string is the header used to indicate the value of the objective function.

Specified by:
isObjValueHeader in interface FbaOptFileLineFormat
Parameters:
s - the string to compare.
Returns:
true if the provided string is equal to the string returned by getObjValueHeader(); false otherwise.

getObjValueHeader

public java.lang.String getObjValueHeader()
Returns the header used to indicate the value of the objective function.

Specified by:
getObjValueHeader in interface FbaOptFileLineFormat
Returns:
the header used to indicate the value of the objective function.

getDoubleFormat

public DoubleFormatV1 getDoubleFormat()
Returns the format used for doubles.

Returns:
the format used for doubles.

getFluxome

public Fluxome getFluxome()
Returns the fluxome used to verify reaction names.

Specified by:
getFluxome in interface FbaOptFileLineFormat
Returns:
the fluxome used to verify reaction names.

formatKey

public java.lang.String formatKey(java.lang.String key)
Returns a formatted string representation of the provided key.

Specified by:
formatKey in interface MapFormat<java.lang.String,java.lang.Double>
Parameters:
key - the key to be formatted.
Returns:
a formatted string representation of the provided key.

formatValue

public java.lang.String formatValue(java.lang.Double value)
Returns a formatted string representation of the provided value.

Specified by:
formatValue in interface MapFormat<java.lang.String,java.lang.Double>
Parameters:
value - the value to be formatted.
Returns:
a formatted string representation of the provided value.

formatKeys

public java.lang.String formatKeys(java.util.Set<? extends java.lang.String> keys)
Returns a formatted string representation of the provided set of keys.

Specified by:
formatKeys in interface MapFormat<java.lang.String,java.lang.Double>
Parameters:
keys - the set of keys to be formatted.
Returns:
a formatted string representation of the provided set of keys.

formatValues

public java.lang.String formatValues(java.util.List<? extends java.lang.Double> values)
Returns a string representation of the provided list of values.

Specified by:
formatValues in interface MapFormat<java.lang.String,java.lang.Double>
Parameters:
values - the list of values to be formatted.
Returns:
a formatted string representation of the provided list of values.

formatValues

public java.lang.String formatValues(java.util.Map<? extends java.lang.String,? extends java.lang.Double> map)
Returns a string representation of the values in the provided map formatted as a list. The order of occurrence of values in the returned string depends on the order of the map. See java.util.Map for further details.

Specified by:
formatValues in interface MapFormat<java.lang.String,java.lang.Double>
Parameters:
map - keys mapped to their respective values.
Returns:
a string representation of the values in the provided map formatted as a list.

formatPair

public java.lang.String formatPair(java.lang.String key,
                                   java.lang.Double value)
Returns a string representation of the provided key-value pair.

Specified by:
formatPair in interface MapFormat<java.lang.String,java.lang.Double>
Parameters:
key - the key.
value - the value.
Returns:
a string representation of the provided key-value pair.

formatPair

public java.lang.String formatPair(java.util.Map.Entry<? extends java.lang.String,? extends java.lang.Double> entry)
Returns a formatted string representation of the provided map entry.

Specified by:
formatPair in interface MapFormat<java.lang.String,java.lang.Double>
Parameters:
entry - the map entry.
Returns:
a formatted string representation of the provided map entry.

parseKey

public java.lang.String parseKey(java.lang.String key)
Parses the provided string and returns its corresponding key.

Specified by:
parseKey in interface MapFormat<java.lang.String,java.lang.Double>
Parameters:
key - a string representation of a key.
Returns:
the key corresponding to the provided string.

parseValue

public java.lang.Double parseValue(java.lang.String value)
Parses the provided string and returns its corresponding value.

Specified by:
parseValue in interface MapFormat<java.lang.String,java.lang.Double>
Parameters:
value - a string representation of a value.
Returns:
the value corresponding to the provided string.

parsePair

public java.util.Map.Entry<java.lang.String,java.lang.Double> parsePair(java.lang.String mapEntry)
Parses the provided map entry string, and returns its corresponding map entry.

Specified by:
parsePair in interface MapFormat<java.lang.String,java.lang.Double>
Parameters:
mapEntry - the string representation of a single map entry.
Returns:
a singleton map corresponding to the provided string.

parseAllKeys

public java.util.LinkedHashSet<java.lang.String> parseAllKeys(java.lang.String allKeys)
Parses the provided string and returns its corresponding set of keys.

Specified by:
parseAllKeys in interface MapFormat<java.lang.String,java.lang.Double>
Parameters:
allKeys - a string representation of a set of keys.
Returns:
a set of keys corresponding to the provided string.

parseAllValues

public java.util.List<java.lang.Double> parseAllValues(java.lang.String allValues)
Parses the provided string and returns its corresponding list of values.

Specified by:
parseAllValues in interface MapFormat<java.lang.String,java.lang.Double>
Parameters:
allValues - a string representation of a list of values.
Returns:
a list of values corresponding to the provided string.

parseAllValues

public java.util.Map<java.lang.String,java.lang.Double> parseAllValues(java.util.LinkedHashSet<? extends java.lang.String> allkeys,
                                                                       java.lang.String allValues)
Parses the provided string of values and returns a corresponding map of variable-value pairs using the provided set of keys. The association between keys and values is determined from their order of occurrence in their respective collection. In other words, the first variable returned by the set's iterator is associated with the first parsed value, and so on.

Specified by:
parseAllValues in interface MapFormat<java.lang.String,java.lang.Double>
Parameters:
allkeys - the set of keys with which to associate the parsed values.
allValues - a string representation of a list of values.
Returns:
keys mapped to their respective values.

parseAllPairs

public java.util.Map<java.lang.String,java.lang.Double> parseAllPairs(java.lang.String allkeys,
                                                                      java.lang.String allValues)
Parses the provided set of keys and list of values and returns a corresponding map of variable-value pairs. The association between keys and values is determined from their order of occurrence in their respective collection. In other words, the first parsed variable is associated with the first parsed value, and so on.

Specified by:
parseAllPairs in interface MapFormat<java.lang.String,java.lang.Double>
Parameters:
allkeys - a string representation of a set of keys.
allValues - a string representation of a list of values.
Returns:
keys mapped to their respective values.