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 sigleton.
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, AlgorithmParamChangeListener

Method Summary
 void addListener(ParamEventListener l)
          Add a ParamEventListener object to EventListenerList
 void changeValue(java.lang.String key, java.lang.String val)
          Set the value of the algorithm option.
static AlgorithmParams getInstance()
           
 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()

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 an ParamEvent to notify the value is changed.

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

changeValue

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

Parameters:
key - HashMap key which is algorithm option
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 added

loadParamsFromFile

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

Returns:
true if the reading is successful, otherwise it will throw Exception

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 save, otherwise throw IOExeption.
Throws:
java.io.IOException