org.optimizationservices.oscommon.representationparser
Class OSsLReader

java.lang.Object
  extended by org.optimizationservices.oscommon.representationparser.OSgLReader
      extended by org.optimizationservices.oscommon.representationparser.OSsLReader

public class OSsLReader
extends OSgLReader

The OSsLReader class parses an OSsL instance into a DOM tree and provides a set of "get" methods that can be used to retrieve different pieces of information of the instance.

Since:
OS 1.0
Version:
1.0, 03/14/2004
Author:
Robert Fourer, Jun Ma, Kipp Martin

Field Summary
 
Fields inherited from class org.optimizationservices.oscommon.representationparser.OSgLReader
m_document
 
Constructor Summary
OSsLReader()
          Constructor.
OSsLReader(boolean validate)
          constructor.
 
Method Summary
 java.util.HashMap getInput()
          Get the hash map of the inputs of name-value pairs for the simulation.
 java.lang.String getInputByName(java.lang.String name)
          Get the string value from the input hash map of the simulation given the input name.
 java.lang.String[] getInputNames()
          Get the names of all the simulation inputs in an array of string.
 int getInputNumber()
          Get the number of inputs of the simulation.
 java.util.HashMap<java.lang.String,java.lang.String> getInputOrOutput(boolean input)
          Get the hash map of the input or output of name-value pairs for the simulation.
 java.lang.String[] getInputValues()
          Get the values of all the simulation inputs in an array of string.
 OSSimulation getOSSimulation()
          get the standard OSSimulation, a local interface for storing Optimization Services simulation.
 java.util.HashMap getOutput()
          Get the hash map of the outputs of name-value pairs for the simulation.
 java.lang.String getOutputByName(java.lang.String name)
          Get the string value from the output hash map of the simulation given the output name.
 java.lang.String[] getOutputNames()
          Get the names of all the simulation outputs in an array of string.
 int getOutputNumber()
          Get the number of outputs of the simulation.
 java.lang.String[] getOutputValues()
          Get the values of all the simulation outputs in an array of string.
 SimulationElement[] getSimulationInputElements()
          get simulation input elements.
 SimulationElement[] getSimulationOutputElements()
          get simulation output elements.
static void main(java.lang.String[] argv)
          main for test purposes.
 boolean replaceInputElementValue(java.lang.String name, java.lang.String value)
          Replace an input el element's value.
 boolean replaceOutputElementValue(java.lang.String name, java.lang.String value)
          Replace an output el element's value.
 void setInputOrOutput(boolean input, java.util.HashMap<java.lang.String,java.lang.String> hashMap)
          Set the hash map of the input or output of name-value pairs for the simulation.
 
Methods inherited from class org.optimizationservices.oscommon.representationparser.OSgLReader
getDocument, getRootElement, isValidate, readFile, readString, setDocument, setRootElement, setValidate, writeToFile, writeToSring, writeToStandardOutput
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

OSsLReader

public OSsLReader(boolean validate)
constructor.

Parameters:
validate - holds whether the reader should be validating against the schema or not.

OSsLReader

public OSsLReader()
Constructor.

Method Detail

getOSSimulation

public OSSimulation getOSSimulation()
                             throws java.lang.Exception
get the standard OSSimulation, a local interface for storing Optimization Services simulation.

Returns:
the OSSimulation.
Throws:
java.lang.Exception - if there are errors getting the OSSimulation.

getSimulationInputElements

public SimulationElement[] getSimulationInputElements()
get simulation input elements.

Returns:
an array of simulation input elements, null if none. Each member of array is a simulation element.
See Also:
SimulationElement

getSimulationOutputElements

public SimulationElement[] getSimulationOutputElements()
get simulation output elements.

Returns:
an array of simulation output elements, null if none. Each member of array is a simulation element.
See Also:
SimulationElement

getInputOrOutput

public java.util.HashMap<java.lang.String,java.lang.String> getInputOrOutput(boolean input)
Get the hash map of the input or output of name-value pairs for the simulation. If the value is from a link, it is encoded (base64) into a string and then stored. So to retrieve it, the value has to decoded first.

Parameters:
input - holds whether to get input or output of OSsL. If true, will get the input.
Returns:
the hash map of the input or output of name-value pairs for the simulation.

setInputOrOutput

public void setInputOrOutput(boolean input,
                             java.util.HashMap<java.lang.String,java.lang.String> hashMap)
Set the hash map of the input or output of name-value pairs for the simulation.

Parameters:
input - holds whether to set input or output of OSsL. If true, will set the input.
hashMap - holds the hash map to set.

getInput

public java.util.HashMap getInput()
Get the hash map of the inputs of name-value pairs for the simulation. If the value is from a link, it is encoded (base64) into a string and then stored. So to retrieve it, the value has to decoded first.

Returns:
the hash map of the inputs of name-value pairs for the simulation.

getInputNumber

public int getInputNumber()
Get the number of inputs of the simulation.

Returns:
the number of inputs of the simulation.

getInputByName

public java.lang.String getInputByName(java.lang.String name)
Get the string value from the input hash map of the simulation given the input name. If the value is from a link, it is encoded (base64) into a string and then stored. So to retrieve it, the value has to decoded first.

Parameters:
name - holds the input name of the simulation to be retrieved.
Returns:
the string value from the input hash map of the simulation given the input name.

getInputNames

public java.lang.String[] getInputNames()
Get the names of all the simulation inputs in an array of string.

Returns:
the names of all the simulation inputs in an array of string.

getInputValues

public java.lang.String[] getInputValues()
Get the values of all the simulation inputs in an array of string. If the value is from a link, it is encoded (base64) into a string and then stored. So to retrieve it, the value has to decoded first.

Returns:
the values of all the simulation inputs in an array of string.

replaceInputElementValue

public boolean replaceInputElementValue(java.lang.String name,
                                        java.lang.String value)
Replace an input el element's value.

Parameters:
name - holds the name of the input el element which value is to be replaced.
value - holds the new value of the input el element to replace.
Returns:
whether the input el element value is replaced successfully.

getOutput

public java.util.HashMap getOutput()
Get the hash map of the outputs of name-value pairs for the simulation. If the value is from a link, it is encoded (base64) into a string and then stored. So to retrieve it, the value has to decoded first.

Returns:
the hash map of the outputs of name-value pairs for the simulation.

getOutputNumber

public int getOutputNumber()
Get the number of outputs of the simulation.

Returns:
the number of outputs of the simulation.

getOutputByName

public java.lang.String getOutputByName(java.lang.String name)
Get the string value from the output hash map of the simulation given the output name. If the value is from a link, it is encoded (base64) into a string and then stored. So to retrieve it, the value has to decoded first.

Parameters:
name - holds the output name of the simulation to be retrieved.
Returns:
the string value from the output hash map of the simulation given the output name.

getOutputNames

public java.lang.String[] getOutputNames()
Get the names of all the simulation outputs in an array of string.

Returns:
the names of all the simulation outputs in an array of string.

getOutputValues

public java.lang.String[] getOutputValues()
Get the values of all the simulation outputs in an array of string. If the value is from a link, it is encoded (base64) into a string and then stored. So to retrieve it, the value has to decoded first.

Returns:
the values of all the simulation outputs in an array of string.

replaceOutputElementValue

public boolean replaceOutputElementValue(java.lang.String name,
                                         java.lang.String value)
Replace an output el element's value.

Parameters:
name - holds the name of the output el element which value is to be replaced.
value - holds the new value of the output el element to replace.
Returns:
whether the output el element value is replaced successfully.

main

public static void main(java.lang.String[] argv)
main for test purposes.

Parameters:
argv - command line arguments.