org.peace_tools.workspace
Class Heuristic

java.lang.Object
  extended by org.peace_tools.workspace.Heuristic

public class Heuristic
extends java.lang.Object

This class is meant to encapsulate the information and parameters for various heuristics used to accelerate clustering. Similar to many of the other classes, this class provides a convenient interface to marshall, unmarshall, and use work space configuration information. This class is a generic Heuristic class that is used to store information regarding all the heuristics used within a Job element.


Field Summary
private  java.lang.String name
          The name of the heuristic.
private  java.util.ArrayList<Param> parameters
          The list of parameters that are simply managed as a name-value pair within this class.
 
Constructor Summary
Heuristic(java.lang.String name)
          The only constructor for this class.
 
Method Summary
 void addParameter(Param p)
          Add a parameter to the heuristic.
static Heuristic create(org.w3c.dom.Element heuristic)
          Helper method to utilize data from a DOM tree to create a suitable Heuristic entry.
 java.lang.String getName()
          Obtain the name of the heuristic associated with this class.
 java.util.ArrayList<Param> getParameters()
          Obtain the full list of parameters passed to this heuristic.
 java.lang.String getSummary()
          Provides a multi-line information about this heuristic.
 void marshall(org.w3c.dom.Element heurList)
          Method to marshall the data stored in this object to become part of a DOM tree element passed in.
 void marshall(java.io.PrintWriter out)
          Method to marshall the data stored in this object directly to a XML fragment.
 java.lang.String toCmdLine()
          Return the information in the form of a partial PEACE command line parameter.
 java.lang.String toString()
          Provides a one line information about this heuristics.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

name

private final java.lang.String name
The name of the heuristic. This value is set when this class is instantiated and is never changed.


parameters

private java.util.ArrayList<Param> parameters
The list of parameters that are simply managed as a name-value pair within this class.

Constructor Detail

Heuristic

public Heuristic(java.lang.String name)
The only constructor for this class.

Parameters:
name - The name of the heuristic with which this class is associated.
Method Detail

create

public static Heuristic create(org.w3c.dom.Element heuristic)
                        throws java.lang.Exception
Helper method to utilize data from a DOM tree to create a suitable Heuristic entry. This method is typically used to create a suitable entry when loading a Work space into the GUI.

Parameters:
heuristic - The DOM element to be used for creating the entry and populating with the needed data.
Returns:
The newly created Heuristic entry based on the DOM data.
Throws:
java.lang.Exception - This method throws an exception when errors occur during reading and processing elements from the DOM node.

getName

public java.lang.String getName()
Obtain the name of the heuristic associated with this class.

Returns:
This method returns the name of the heuristic associated with this class.

getParameters

public java.util.ArrayList<Param> getParameters()
Obtain the full list of parameters passed to this heuristic.

Returns:
This method returns the full list of parameters supplied to this heuristic to fine tune its runtime operations.

addParameter

public void addParameter(Param p)
Add a parameter to the heuristic. This method may be used to add a parameter to the heuristic. The name of the parameter must be one of the command line parameters in PEACE. The value must be suitably set to be compatible with the parameter. This method does not perform any special checks (at least not yet, maybe it should be) to verify that the parameter is valid.

Parameters:
p - The parameter to be added to the list. This value must not be null.

toString

public java.lang.String toString()
Provides a one line information about this heuristics. Parameters are included on the line as comma separated list of values.

Overrides:
toString in class java.lang.Object

getSummary

public java.lang.String getSummary()
Provides a multi-line information about this heuristic. Parameters are displayed on separate lines with each line indented by a single tab. This is usually used to display summary information to the user.


toCmdLine

public java.lang.String toCmdLine()
Return the information in the form of a partial PEACE command line parameter. This method can be used to obtain the information needed to generate MST data while applying this heuristic.

Returns:
Return the information as a command line parameter.

marshall

public final void marshall(org.w3c.dom.Element heurList)
Method to marshall the data stored in this object to become part of a DOM tree element passed in. This method assumes that the element passed in corresponds to the parent HeuristicList node in the DOM tree.

Parameters:
heurList - The DOM element corresponding to the "HeuristicList" node that contains this entry.

marshall

public final void marshall(java.io.PrintWriter out)
Method to marshall the data stored in this object directly to a XML fragment. The XML fragment is guaranteed to be compatible with the PEACE work space configuration data.

Parameters:
out - The stream to which the XML must be serialized.