|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectweka.gui.graphvisualizer.DotParser
This class parses input in DOT format, and builds the datastructures that are passed to it. It is NOT 100% compatible with the DOT format. The GraphNode and GraphEdge classes do not have any provision for dealing with different colours or shapes of nodes, there can however, be a different label and ID for a node. It also does not do anything for labels for edges. However, this class won't crash or throw an exception if it encounters any of the above attributes of an edge or a node. This class however, won't be able to deal with things like subgraphs and grouping of nodes.
Field Summary | |
protected FastVector |
m_edges
These holds the nodes and edges of the graph |
protected java.lang.String |
m_graphName
This holds the name of the graph if there is any otherwise it is null |
protected java.io.Reader |
m_input
This is the input containing DOT stream to be parsed |
protected FastVector |
m_nodes
These holds the nodes and edges of the graph |
Fields inherited from interface weka.gui.graphvisualizer.GraphConstants |
DIRECTED, DOUBLE, NORMAL, PLURAL_DUMMY, REVERSED, SINGULAR_DUMMY |
Constructor Summary | |
DotParser(java.io.Reader input,
FastVector nodes,
FastVector edges)
Dot parser Constructor |
Method Summary | |
protected void |
edgeAttrib(java.io.StreamTokenizer tk,
GraphEdge e)
|
protected void |
edgeStmt(java.io.StreamTokenizer tk,
int nindex)
|
protected void |
graph(java.io.StreamTokenizer tk)
Following methods parse the DOT input and mimic the DOT language's grammar in their structure |
protected void |
nodeID(java.io.StreamTokenizer tk)
|
protected void |
nodeStmt(java.io.StreamTokenizer tk,
int nindex)
|
java.lang.String |
parse()
This method parses the string or the InputStream that we passed in through the constructor and builds up the m_nodes and m_edges vectors |
protected void |
setSyntax(java.io.StreamTokenizer tk)
This method sets the syntax of the StreamTokenizer. |
protected void |
stmt(java.io.StreamTokenizer tk)
|
protected void |
stmtList(java.io.StreamTokenizer tk)
|
static void |
writeDOT(java.lang.String filename,
java.lang.String graphName,
FastVector nodes,
FastVector edges)
This method saves a graph in a file in DOT format. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
protected FastVector m_nodes
protected FastVector m_edges
protected java.io.Reader m_input
protected java.lang.String m_graphName
Constructor Detail |
public DotParser(java.io.Reader input, FastVector nodes, FastVector edges)
input
- - The input, if passing in a string then
encapsulate that in String reader objectnodes
- - Vector to put in GraphNode objects,
corresponding to the nodes parsed in from
the inputedges
- - Vector to put in GraphEdge objects,
corresponding to the edges parsed in from
the inputMethod Detail |
public java.lang.String parse()
protected void setSyntax(java.io.StreamTokenizer tk)
protected void graph(java.io.StreamTokenizer tk)
protected void stmtList(java.io.StreamTokenizer tk) throws java.lang.Exception
java.lang.Exception
protected void stmt(java.io.StreamTokenizer tk)
protected void nodeID(java.io.StreamTokenizer tk) throws java.lang.Exception
java.lang.Exception
protected void nodeStmt(java.io.StreamTokenizer tk, int nindex) throws java.lang.Exception
java.lang.Exception
protected void edgeStmt(java.io.StreamTokenizer tk, int nindex) throws java.lang.Exception
java.lang.Exception
protected void edgeAttrib(java.io.StreamTokenizer tk, GraphEdge e) throws java.lang.Exception
java.lang.Exception
public static void writeDOT(java.lang.String filename, java.lang.String graphName, FastVector nodes, FastVector edges)
filename
- - The name of the file to write in. (will overwrite)graphName
- - The name of the graphnodes
- - Vector containing all the nodesedges
- - Vector containing all the edges
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |