org.peace_tools.workspace
Class Filter

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

public class Filter
extends java.lang.Object

This class is meant to encapsulate the information and parameters for various filters used to filter out ESTs that may negatively impact 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 Filter class that is used to store information regarding all the filters used within a Job element.


Nested Class Summary
static class Filter.FilterType
          Different enumerations defining the different types of Filters that are currently supported.
 
Field Summary
private  Filter.FilterType filterType
          The name/type of this filter.
private  java.util.ArrayList<Param> parameters
          The list of parameters that are simply managed as a name-value pair within this class.
 
Constructor Summary
Filter(Filter.FilterType filterType)
          The only constructor for this class.
 
Method Summary
 void addParameter(Param p)
          Add a parameter to the filter.
static Filter create(org.w3c.dom.Element filter)
          Helper method to utilize data from a DOM tree to create a suitable Filter entry.
 java.lang.String getName()
          Obtain the type of filter represented by this class.
 java.util.ArrayList<Param> getParameters()
          Obtain the full list of parameters passed to this filter.
 java.lang.String getSummary()
          Provides a multi-line information about this filter.
 void marshall(org.w3c.dom.Element filterList)
          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

filterType

private final Filter.FilterType filterType
The name/type of this filter. 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

Filter

public Filter(Filter.FilterType filterType)
The only constructor for this class.

Parameters:
filterType - The type of filter that this object is expected to represent.
Method Detail

create

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

Parameters:
filter - The DOM element to be used for creating the entry and populating with the needed data.
Returns:
The newly created filter 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 type of filter represented by this class. This method provides the name in a form that can be readily dispatched to the PEACE clustering engine.

Returns:
This method returns the type of filter represented by this class.

getParameters

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

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 filter. This method may be used to add a parameter to the filter. 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 filter. 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 filterList)
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 FilterList node in the DOM tree.

Parameters:
filterList - The DOM element corresponding to the "FilterList" 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.