public abstract class Notation
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
protected int |
cnt
the number of unread/pushed back characters
|
protected TypeMgr |
edgemgr
the manager for the edge types
|
protected TypeMgr |
nodemgr
the manager for the node types
|
protected java.io.Reader |
reader
the reader from which to read the graph description
|
protected int[] |
stack
the stack of unread/pushed back characters
|
Constructor and Description |
---|
Notation() |
Modifier and Type | Method and Description |
---|---|
static Notation |
createNotation(java.lang.String name)
Create a graph notation corresponding to a given name.
|
abstract java.lang.String |
describe(Graph graph)
Create a string description of a graph.
|
int |
getDelim()
Get the delimiter character.
|
TypeMgr |
getEdgeMgr()
Get the edge type manager.
|
TypeMgr |
getNodeMgr()
Get the node type manager.
|
abstract boolean |
hasFixedTypes()
Whether this notation has a fixed set of (node and edge) types.
|
abstract boolean |
isLine()
Whether this is a line notation (single line description).
|
protected static void |
mark(Node node)
Mark the visits of each node.
|
abstract Graph |
parse(java.io.Reader reader)
Parse a description of an attributed graph.
|
protected int |
read()
Read the next character.
|
void |
setEdgeMgr(TypeMgr edgemgr)
Set the edge type manager.
|
void |
setNodeMgr(TypeMgr nodemgr)
Set the node type manager.
|
protected void |
setReader(java.io.Reader reader)
Set the reader to read from.
|
void |
setTypeMgrs(Notation ntn)
Set the type managers from another notation.
|
protected static void |
unmark(Node node)
Unmark a connected component.
|
protected void |
unread(int c)
Unread/push back a character.
|
abstract void |
write(Graph graph,
java.io.Writer writer)
Write a description of an attributed graph.
|
protected TypeMgr nodemgr
protected TypeMgr edgemgr
protected java.io.Reader reader
protected int[] stack
protected int cnt
public abstract boolean isLine()
A notation that describes an attributed graph in a single line
(like SMILES or SLN) returns true
, a notation that
needs multiple lines (like Ctab) returns false
.
public abstract boolean hasFixedTypes()
public TypeMgr getNodeMgr()
public void setNodeMgr(TypeMgr nodemgr)
This function should only have an effect if the function
hasFixedTyes()
returns false
.
nodemgr
- the new node type managerhasFixedTypes()
public TypeMgr getEdgeMgr()
public void setEdgeMgr(TypeMgr edgemgr)
This function should only have an effect if the function
hasFixedTyes()
returns false
.
edgemgr
- the new edge type managerhasFixedTypes()
public void setTypeMgrs(Notation ntn)
ntn
- the notation of which to copy the type managersprotected void setReader(java.io.Reader reader)
Also create a small stack to handle pushed back characters.
reader
- the reader to read fromprotected int read() throws java.io.IOException
java.io.IOException
protected void unread(int c)
c
- the character to push backpublic abstract Graph parse(java.io.Reader reader) throws java.io.IOException
reader
- the reader from which to read the descriptionjava.io.IOException
- if a parse error or an i/o error occurspublic int getDelim()
The delimiter character is the character at which parsing stopped, but which was not processed by the parser anymore.
public abstract java.lang.String describe(Graph graph)
graph
- the graph to describepublic abstract void write(Graph graph, java.io.Writer writer) throws java.io.IOException
graph
- the graph to writewriter
- the writer to write tojava.io.IOException
protected static void mark(Node node)
In this function the marker of a node is used to determine the number of labels needed for a node: 1 means that the node has not been visited yet, 0 means that it has been visited only once (and thus needs no label) -n, n > 0, means that it has been visited n+1 times and therefore needs n labels (for n "backward connections"). The procedure is a depth-first search and assumes that all nodes have been marked with the value 1 before.
node
- the current node in the depth-first searchprotected static void unmark(Node node)
With this function a connected component is unmarked after it has been described. The procedure is a simple depth-first search.
node
- the current node in the depth-first searchpublic static Notation createNotation(java.lang.String name)
name
- the name of the notation