Class AlgorithmParams

java.lang.Object
  extended byAlgorithmParams

public class AlgorithmParams
extends java.lang.Object

It is a data model holding all information needed to lauch a c++ executable.
It is a singleton.
Important: Use AlgorithmParamsChangeListener to make a change of its value without triggering any ParamEvent. Use AlgorithmParamsListener to make a change of its value whose value needs to trigger any ParamEvent.

Author:
Lulin Song
See Also:
AlgorithmParamsListener, ParamEventListener

Method Summary
 void addListener(ParamEventListener l)
          Add a ParamEventListener object to EventListenerList
 void changeValue(java.lang.String key, java.lang.String val)
          Change the value of the algorithm option.
static AlgorithmParams getInstance()
          Get this only AlgorithmParams object
 java.lang.String getValue(java.lang.String key)
          Get the value of the algorithm option.
 boolean loadParamsFromFile(java.lang.String fileName)
          Get algorithm options from a file.
 void removeListener(ParamEventListener l)
          Remove a ParamEventListener object from EventListenerList
 boolean saveParamsToFile(java.lang.String fileName)
          Save the algorithm options to a file.
 void setValue(java.lang.String key, java.lang.String val)
          Set the value of the algorithm option.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getInstance

public static AlgorithmParams getInstance()
Get this only AlgorithmParams object


getValue

public java.lang.String getValue(java.lang.String key)
Get the value of the algorithm option.

Parameters:
key - HashMap key
Returns:
value of the key

setValue

public void setValue(java.lang.String key,
                     java.lang.String val)
Set the value of the algorithm option. Fire a ParamEvent to notify the value is changed.

Parameters:
key - key which is the algorithm option name
val - value of the algorithm option

changeValue

public void changeValue(java.lang.String key,
                        java.lang.String val)
Change the value of the algorithm option. Will not fire a ParamEvent.

Parameters:
key - key which is the algorithm option name
val - value of the algorithm option

addListener

public void addListener(ParamEventListener l)
Add a ParamEventListener object to EventListenerList

Parameters:
l - the listener object to be added

removeListener

public void removeListener(ParamEventListener l)
Remove a ParamEventListener object from EventListenerList

Parameters:
l - the listener object to be removed

loadParamsFromFile

public boolean loadParamsFromFile(java.lang.String fileName)
Get algorithm options from a file.

Parameters:
fileName - name of the file.
Returns:
true if options are read successfully, otherwise return false.

saveParamsToFile

public boolean saveParamsToFile(java.lang.String fileName)
                         throws java.io.IOException
Save the algorithm options to a file.

Parameters:
fileName - name of the file
Returns:
true if the options are saved successfully, otherwise return false and throw IOException.
Throws:
java.io.IOException