Package moss
Class MoleculeNtn
java.lang.Object
moss.Notation
moss.MoleculeNtn
- All Implemented Interfaces:
Serializable
Class for (linear) notations for molecules.
A molecule is represented as a graph with atoms as nodes and bonds as edges.
General grammar for (linear) molecule descriptions:
Molecule ::= Atom Branch Branch ::= \epsilon | Bond Atom Branch | Bond Label Branch | "(" Branch ")" Branch Atom ::= Element LabelDef LabelDef ::= \epsilon | Label LabelDef
The definitions of the terms "Element", "Bond", and "Label" depend on the chosen description language. For the SMILES language it is:
Element ::= "[H]" | "[He]" | "[Li]" | "[Be]" | ... | "B" | "C" | "N" | "O" | "F" | ... Bond ::= \epsilon | "-" | "=" | "#" | ":" Label ::= [0-9] | "%" [0-9] [0-9]
- Since:
- 2006.08.12
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected StringBuilder
the buffer for creating molecule descriptions -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected int
Read shorthand hydrogen atoms.protected static int
Get the number of adjacent hydrogen atoms (and mark them).boolean
Whether this notation has a fixed set of (node and edge) types.void
setEdgeMgr
(TypeMgr edgemgr) Set the edge type manager.void
setNodeMgr
(TypeMgr nodemgr) Set the node type manager.void
Write a description of a molecule.Methods inherited from class moss.Notation
createNotation, describe, getDelim, getEdgeMgr, getNodeMgr, isLine, mark, parse, read, setReader, setTypeMgrs, unmark, unread
-
Field Details
-
desc
the buffer for creating molecule descriptions
-
-
Constructor Details
-
MoleculeNtn
public MoleculeNtn()Create a molecule notation.- Since:
- 2023.07.31 (Christian Borgelt)
-
-
Method Details
-
hasFixedTypes
public boolean hasFixedTypes()Whether this notation has a fixed set of (node and edge) types.- Specified by:
hasFixedTypes
in classNotation
- Returns:
true
, because types are atoms and bonds- Since:
- 2007.06.29 (Christian Borgelt)
-
setNodeMgr
Set the node type manager.This function has no effect, because node types are fixed.
- Overrides:
setNodeMgr
in classNotation
- Parameters:
nodemgr
- the new node type manager- Since:
- 2007.06.29 (Christian Borgelt)
- See Also:
-
setEdgeMgr
Set the edge type manager.This function has no effect, because edge types are fixed.
- Overrides:
setEdgeMgr
in classNotation
- Parameters:
edgemgr
- the new edge type manager- Since:
- 2007.06.29 (Christian Borgelt)
- See Also:
-
getHydros
Read shorthand hydrogen atoms.- Returns:
- the number of shorthand hydrogen atoms
- Throws:
IOException
- if a read error occurred- Since:
- 2006.08.12 (Christian Borgelt)
-
getHydros
Get the number of adjacent hydrogen atoms (and mark them).- Parameters:
atom
- the atom for which to get the adjacent hydrogenscoder
- the recoder for the atom types (if any)- Returns:
- the number of shorthand hydrogen atoms
- Since:
- 2006.08.12 (Christian Borgelt)
-
write
Write a description of a molecule.- Specified by:
write
in classNotation
- Parameters:
graph
- the molecule to writewriter
- the writer to write to- Throws:
IOException
- if a read error occurred- Since:
- 2007.06.22 (Christian Borgelt)
-