org.peace_tools.workspace
Class MSTData

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

public class MSTData
extends java.lang.Object

This class encapsulates all the data necessary to use a given Minimum Spanning Tree (MST) data file. A MST data file essentially contains the MST structure with closely related ESTs on the same subtree of the MST. Constructing the MST is the most computationally intensive part of the clustering algorithm supported by PEACE. This element contains meta data about the MST file. The MSTData class is created each time a new Job is run to build a MST on a given EST data set. The EST data is the primary input from which the MST data is derived.

In addition to encapsulating the data this class also provides convenient interfaces for marshalling and unmarshalling XML data compatible with the PEACE GUI configuration XML file format.


Nested Class Summary
static class MSTData.MSTBuilderType
          Different enumerations defining the different approaches that PEACE currently supports for building a MST.
 
Field Summary
private  FWAnalyzer analyzer
          Information about the distance/similarity analyzer that was used to create this MST data set.
private  DataSet dataSet
          Reference to the data set that logically contains this MSTData element.
private  java.lang.String description
          A user defined description for this file.
protected  java.lang.String id
          The unique generated data set ID value for this data.
private  JobSummary jobSummary
          The core/useful information about the job that was run to compute the MST.
private  java.lang.String path
          The path to the actual MST file (on the local machine) that is referred by this entry.
private  MSTData.MSTBuilderType type
          The type of MST building approach supported by PEACE that was used to obtain the MST referred by this class.
 
Constructor Summary
MSTData(java.lang.String id, MSTData.MSTBuilderType type, java.lang.String path, java.lang.String description, FWAnalyzer analyzer, JobSummary summary)
          The constructor to create a fully populated MSTData object that contains all the meta data regarding a MST file that has been generated from a given EST file.
 
Method Summary
static MSTData create(org.w3c.dom.Element mstData)
          Helper method to utilize data from a DOM tree to create a suitable MSTData entry.
 DataSet getDataSet()
          Obtain the data set that logically contains this MST Data.
 java.lang.String getDescription()
          Obtain the user supplied description for this this data.
 FWAnalyzer getFWAnalyzer()
          Obtain meta data about the frame/word analyzer that was used to generate metrics (may it be similarity or distance values) that were used to build the MST.
 java.lang.String getID()
          Obtain the work space wide unique identifier set for this data set.
 JobSummary getJobSummary()
          Obtain meta data about the job that was run to generate the MST.
 java.lang.String getPath()
          Obtain the complete file name and path where the actual MST file is located.
 java.lang.String getSummary(java.lang.String indent)
          Provides a textual multi-line summary for this element.
 MSTData.MSTBuilderType getType()
          The type of MST building approach supported by PEACE that was used to obtain the MST referred by this class.
 void marshall(org.w3c.dom.Element dataset)
          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.
protected  void setDataSet(DataSet dataSet)
          Set the data set that this object logically belongs to.
 java.lang.String toCmdLine()
          Return the information in the form of a partial PEACE command line parameter.
 java.lang.String toString()
          Overrides the default implementation in the base class to simply return the last part of the MST file associated with this entry.
 void updateJobSummary(Job job)
          Set revised updated information about the job associated with this MSTData entry.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

dataSet

private DataSet dataSet
Reference to the data set that logically contains this MSTData element. This element is not serialized to XML format (and consequently is flagged transient).


id

protected final java.lang.String id
The unique generated data set ID value for this data. This value is typically created when a new job is scheduled. This value is persisted in the work space configuration.


type

private final MSTData.MSTBuilderType type
The type of MST building approach supported by PEACE that was used to obtain the MST referred by this class.


path

private final java.lang.String path
The path to the actual MST file (on the local machine) that is referred by this entry.


description

private final java.lang.String description
A user defined description for this file. This description is set when a new job is scheduled and persisted in the work space configuration for future references.


analyzer

private final FWAnalyzer analyzer
Information about the distance/similarity analyzer that was used to create this MST data set.


jobSummary

private JobSummary jobSummary
The core/useful information about the job that was run to compute the MST.

Constructor Detail

MSTData

public MSTData(java.lang.String id,
               MSTData.MSTBuilderType type,
               java.lang.String path,
               java.lang.String description,
               FWAnalyzer analyzer,
               JobSummary summary)
The constructor to create a fully populated MSTData object that contains all the meta data regarding a MST file that has been generated from a given EST file.

Parameters:
id - The unique generated data set ID value for this data.
type - he type of MST building approach supported by PEACE that was used to obtain the MST referred by this class.
path - The path to the actual MST file (on the local machine) that is referred by this entry.
description - A user defined description for this file.
analyzer - Information about the distance/similarity analyzer that was used to create this MST data set.
summary - The core/useful information about the job that was run to compute the MST.
Method Detail

create

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

Parameters:
mstData - The DOM element to be used for creating the MSTData entry and populating with the needed data.
Returns:
The newly created data 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.

getID

public java.lang.String getID()
Obtain the work space wide unique identifier set for this data set. The ID value is created when new jobs are scheduled to create MST data. These IDs are persisted in the work space configuration file and loaded when a work space is opened in the GUI.

Returns:
This method returns the unique identifier set for this data set.

getType

public MSTData.MSTBuilderType getType()
The type of MST building approach supported by PEACE that was used to obtain the MST referred by this class.

Returns:
The type of approach used to build the MST.

getPath

public java.lang.String getPath()
Obtain the complete file name and path where the actual MST file is located. This value is set when a new job to generate this MST data is scheduled. The path for the job is persisted in the work space configuration file and loaded when a work space is opened in the GUI.

Returns:
This method returns the path to the MST file.

getDescription

public java.lang.String getDescription()
Obtain the user supplied description for this this data. The value is set when new jobs are scheduled. The description is persisted in the work space configuration file and loaded when a work space is opened in the GUI.

Returns:
This method returns the user supplied description set for this job.

getFWAnalyzer

public FWAnalyzer getFWAnalyzer()
Obtain meta data about the frame/word analyzer that was used to generate metrics (may it be similarity or distance values) that were used to build the MST.

Returns:
This method returns information about the analyzer that was used to generate the MST.

getJobSummary

public JobSummary getJobSummary()
Obtain meta data about the job that was run to generate the MST. The JobID in the job summary can be used to look up additional information about the job. Similarly, the serverID value in the job summary can be used to look up information about the server on which the job was run.

Returns:
This method returns information about the job that was run to generate the MST.

marshall

public final void marshall(org.w3c.dom.Element dataset)
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 DataSet node in the DOM tree.

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

getSummary

public java.lang.String getSummary(java.lang.String indent)
Provides a textual multi-line summary for this element. This method is typically used by GUI to display a simple representation of the data stored in this element.

Parameters:
indent - The leading spaces to be used for indenting each line. This parameter cannnot be null.
Returns:
A textual multi-line summary of the data in this element.

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 the MST based on the supplied information in the form of a command line parameter.

Returns:
Return the information as a command line parameter.

toString

public java.lang.String toString()
Overrides the default implementation in the base class to simply return the last part of the MST file associated with this entry.

Overrides:
toString in class java.lang.Object
Returns:
A short string representation that is easy to display primarily in a tree view of the work space.

setDataSet

protected void setDataSet(DataSet dataSet)
Set the data set that this object logically belongs to.

Note: This method is used by the DataSet. Use DataSet.add(MSTData) method to add a MSTData object to a data set.

Parameters:
dataSet - The data set to which this object has been added.

getDataSet

public DataSet getDataSet()
Obtain the data set that logically contains this MST Data.

Returns:
The data set that logically contains this object. This value is set only after this object has been added to a data set.

updateJobSummary

public void updateJobSummary(Job job)
Set revised updated information about the job associated with this MSTData entry.

Parameters:
job - The job from where the necessary information is to be copied.