Class Notation
- All Implemented Interfaces:
Serializable
- Direct Known Subclasses:
FreeNtn
,MoleculeNtn
- Since:
- 2006.08.12
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected int
the number of unread/pushed back charactersprotected TypeMgr
the manager for the edge typesprotected TypeMgr
the manager for the node typesprotected Reader
the reader from which to read the graph descriptionprotected int[]
the stack of unread/pushed back characters -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic Notation
createNotation
(String name) Create a graph notation corresponding to a given name.abstract String
Create a string description of a graph.int
getDelim()
Get the delimiter character.Get the edge type manager.Get the node type manager.abstract boolean
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 the visits of each node.abstract Graph
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
Set the reader to read from.void
setTypeMgrs
(Notation ntn) Set the type managers from another notation.protected static void
Unmark a connected component.protected void
unread
(int c) Unread/push back a character.abstract void
Write a description of an attributed graph.
-
Field Details
-
nodemgr
the manager for the node types -
edgemgr
the manager for the edge types -
reader
the reader from which to read the graph description -
stack
protected int[] stackthe stack of unread/pushed back characters -
cnt
protected int cntthe number of unread/pushed back characters
-
-
Constructor Details
-
Notation
public Notation()Create a notation.- Since:
- 2023.07.31 (Christian Borgelt)
-
-
Method Details
-
isLine
public abstract boolean isLine()Whether this is a line notation (single line description).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) returnsfalse
.- Returns:
- whether this is a line notation
- Since:
- 2007.03.04 (Christian Borgelt)
-
hasFixedTypes
public abstract boolean hasFixedTypes()Whether this notation has a fixed set of (node and edge) types.- Returns:
- whether this notation has a fixed set of types
- Since:
- 2007.06.29 (Christian Borgelt)
-
getNodeMgr
Get the node type manager.- Returns:
- the node type manager
- Since:
- 2007.06.21 (Christian Borgelt)
-
setNodeMgr
Set the node type manager.This function should only have an effect if the function
hasFixedTyes()
returnsfalse
.- Parameters:
nodemgr
- the new node type manager- Since:
- 2007.06.29 (Christian Borgelt)
- See Also:
-
getEdgeMgr
Get the edge type manager.- Returns:
- the edge type manager
- Since:
- 2007.06.21 (Christian Borgelt)
-
setEdgeMgr
Set the edge type manager.This function should only have an effect if the function
hasFixedTyes()
returnsfalse
.- Parameters:
edgemgr
- the new edge type manager- Since:
- 2007.06.29 (Christian Borgelt)
- See Also:
-
setTypeMgrs
Set the type managers from another notation.- Parameters:
ntn
- the notation of which to copy the type managers- Since:
- 2007.07.01 (Christian Borgelt)
-
setReader
Set the reader to read from.Also create a small stack to handle pushed back characters.
- Parameters:
reader
- the reader to read from- Since:
- 2007.06.23 (Christian Borgelt)
-
read
Read the next character.- Returns:
- the character read
- Throws:
IOException
- if reading the next character failed- Since:
- 2007.06.23 (Christian Borgelt)
-
unread
protected void unread(int c) Unread/push back a character.- Parameters:
c
- the character to push back- Since:
- 2007.06.23 (Christian Borgelt)
-
parse
Parse a description of an attributed graph.- Parameters:
reader
- the reader from which to read the description- Returns:
- the parsed graph
- Throws:
IOException
- if a parse error or an i/o error occurs- Since:
- 2006.08.12 (Christian Borgelt)
-
getDelim
public int getDelim()Get the delimiter character.The delimiter character is the character at which parsing stopped, but which was not processed by the parser anymore.
- Returns:
- the delimiter character or -1 if no delimiter character was read
- Since:
- 2007.06.26 (Christian Borgelt)
-
describe
Create a string description of a graph.- Parameters:
graph
- the graph to describe- Returns:
- the created string description
- Since:
- 2006.08.12 (Christian Borgelt)
-
write
Write a description of an attributed graph.- Parameters:
graph
- the graph to writewriter
- the writer to write to- Throws:
IOException
- if a read error occurred- Since:
- 2007.06.22 (Christian Borgelt)
-
mark
Mark the visits of each 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.
- Parameters:
node
- the current node in the depth-first search- Since:
- 2006.08.12 (Christian Borgelt)
-
unmark
Unmark a connected component.With this function a connected component is unmarked after it has been described. The procedure is a simple depth-first search.
- Parameters:
node
- the current node in the depth-first search- Since:
- 2006.08.12 (Christian Borgelt)
-
createNotation
Create a graph notation corresponding to a given name.- Parameters:
name
- the name of the notation- Returns:
- the created notation
- Since:
- 2007.03.02 (Christian Borgelt)
-