|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.peace_tools.data.ClusterFile
public class ClusterFile
The top-level class that encapsulates all the pertinent information
regarding a cluster data file. This class deserializes the information
in a cluster data file generated by PEACE and stores it in memory.
The in-memory storage format for the core cluster information is
achieved using an hierarchically nested set of ClusterNode objects.
In addition, this class also maintains any generated information
that is placed in the file by PEACE.
Note that the in-memory format represented by this class has been
primarily designed to provide more convenient access to the related
information and for display in a GUI. However, this class does
not directly perform any GUI related task. Instead, the GUI display
is organized using the MVC (Model-View-Controller) design pattern.
This class constitutes the "model" as in the MVC terminology.
Note: In order to create a valid ClusterFile use the
loadCluster(File)
static method in this class.
Field Summary | |
---|---|
private java.lang.String |
fileName
The file name from where the data has been read. |
private java.util.ArrayList<Pair> |
metadata
The set of meta data that was loaded from the cluster file. |
private java.lang.Object |
prevClusterList
This reference is used to track the object used to hold the list of DBClassifiers in the work space. |
private ClusterNode |
root
The root of the cluster node. |
Constructor Summary | |
---|---|
private |
ClusterFile(java.lang.String fileName)
The constructor creates an empty cluster object. |
Method Summary | |
---|---|
void |
classify(ESTList estList,
javax.swing.ProgressMonitor pm)
Method to recompute (as needed) the classification of ESTs in clusters. |
java.lang.String |
getFileName()
The absolute path to the file name from where the cluster data was originally loaded. |
java.util.ArrayList<Pair> |
getMetadata()
Obtain the meta data associated with this cluster file. |
ClusterNode |
getRoot()
Obtain the top-level root cluster for this cluster file. |
boolean |
isClassified()
Determine if the clusters are current with work space classifiers. |
static ClusterFile |
loadCluster(java.io.File clusterFile)
This method loads cluster data into an in-memory format. |
static ClusterFile |
loadCluster(java.lang.String fileName,
java.io.InputStream is)
This method loads cluster data into an in-memory format. |
protected static void |
makeClusterNode(java.util.ArrayList<ClusterNode> nodeList,
java.lang.String line)
Helper method to process a comma separated set of values representing a cluster node. |
protected static Pair |
makeMetadataEntry(java.lang.String line)
This is a helper method that is used to parse a line of meta data entry (line starts with a '#' character) and convert it to a a Pair containing a name, value pair and returns the meta data as a pair. |
void |
print(java.io.PrintStream out)
Method to print the cluster in a simple text-based format. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private java.lang.String fileName
private ClusterNode root
private java.util.ArrayList<Pair> metadata
private java.lang.Object prevClusterList
Constructor Detail |
---|
private ClusterFile(java.lang.String fileName)
fileName
- The absolute path to the file from where the
cluster data was loaded. This file name is used as an identifier
to locate the files.Method Detail |
---|
public java.lang.String getFileName()
public void print(java.io.PrintStream out)
out
- The output stream to which the cluster data is to be
written.public ClusterNode getRoot()
public java.util.ArrayList<Pair> getMetadata()
public static ClusterFile loadCluster(java.io.File clusterFile) throws java.lang.Exception
clusterFile
- The cluster file (generated by PEACE) from where the
data is to be loaded in the in-memory format.
java.lang.Exception
- This method throws an exception on errors.public static ClusterFile loadCluster(java.lang.String fileName, java.io.InputStream is) throws java.lang.Exception
fileName
- The absolute path to the file from where the data
is being read.is
- The input stream from where the data is to be read.
java.lang.Exception
- This method throws an exception on errors.public boolean isClassified()
public void classify(ESTList estList, javax.swing.ProgressMonitor pm)
Note: This method assumes that the classifications for the ESTs in the estList have already been computed.
estList
- The list of ESTs associated with this cluster file to
be used to classify the ESTs.pm
- An optional progress monitor to be updated to indicate
progress. This parameter can be null.protected static void makeClusterNode(java.util.ArrayList<ClusterNode> nodeList, java.lang.String line) throws java.io.IOException
nodeList
- The list of nodes that have been read so far.line
- The line containing node data to be processed and
converted to a clusterNode.
java.io.IOException
- This method throws an exception if the data
was invalid or not read.protected static Pair makeMetadataEntry(java.lang.String line)
line
- The line from the cluster file to be processed.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |