-
appendAnchorNode(node)
-
Add anchor node of container. If node not in nodes container, nothing will be done.
Parameters:
- Inherited From:
- Source:
-
appendBond(nodesOrIndexes, bondOrder, bondType) → {Kekule.Bond}
-
A util method to create a new bond object connected with nodes and append to current connection table.
Parameters:
Name |
Type |
Description |
nodesOrIndexes |
Array
|
Array of connected nodes or indexes of those nodes |
bondOrder |
Int
|
Order of bond. |
bondType |
Int
|
Type of bond. |
- Inherited From:
- Source:
Returns:
-
Type
-
Kekule.Bond
-
appendConnector(connector)
-
Add connector to container.
Parameters:
- Inherited From:
- Source:
-
appendLinkedConnector(connector)
-
Link a connector to this node.
Parameters:
- Inherited From:
- Source:
-
appendNode(node)
-
Add node to container. If node already in container, nothing will be done.
Parameters:
- Inherited From:
- Source:
-
-
Calculate molecular formula from this connection table.
- Inherited From:
- Source:
Returns:
-
Type
-
Kekule.MolecularFormula
-
clean(options)
-
Clean the structure in ctab, removing illegal nodes and connectors.
Parameters:
Name |
Type |
Description |
options |
Hash
|
An option hash, can including fields: {orphanChemNode, hangingChemConnector}. |
- Inherited From:
- Source:
-
clear()
-
Clear all CTab and formula struuctures.
- Inherited From:
- Source:
-
clearAnchorNodes()
-
Remove all anchor nodes.
- Inherited From:
- Source:
-
clearConnectors()
-
Remove all connectors.
- Inherited From:
- Source:
-
clearNodes()
-
Remove all nodes.
- Inherited From:
- Source:
-
compareStructure(targetObj, options) → {Int}
-
Explicit set compare method to chem structure and compare to targetObj.
Parameters:
- Inherited From:
- Source:
Returns:
-
Type
-
Int
-
equalStructure(targetObj, options) → {Bool}
-
Check if this object and targetObj has equivalent chem structure.
Parameters:
- Inherited From:
- Source:
Returns:
-
Type
-
Bool
-
-
Get charge marker of node. If no such a marker currently and canCreate is true, a new marker will be created.
- Inherited From:
- Source:
Returns:
-
Type
-
Kekule.ChemMarker.ChemPropertyMarker
-
-
Get radical marker of node. If no such a marker currently and canCreate is true, a new marker will be created.
- Inherited From:
- Source:
Returns:
-
Type
-
Kekule.ChemMarker.ChemPropertyMarker
-
-
Returns the direct node/substructure that contains originObj.
originObj may be a child node or connector of substructure in this structure fragment.
If originObj is actually not in this ctab, null will be returned.
Parameters:
- Inherited From:
- Source:
Returns:
-
Type
-
Kekule.ChemStructureNode
-
getAllChildConnectors() → {Array}
-
Return all bonds in structure as well as in sub structure.
- Inherited From:
- Source:
Returns:
Array of {Kekule.ChemStructureConnector}.
-
Type
-
Array
-
getAllContainingConnectors() → {Array}
-
Return all bonds in structure as well as in sub structure.
- Inherited From:
- Source:
Returns:
Array of {Kekule.ChemStructureConnector}.
-
Type
-
Array
-
-
Get anchor node at index.
Parameters:
Name |
Type |
Description |
index |
Int
|
|
- Inherited From:
- Source:
Returns:
-
Type
-
Kekule.ChemStructureNode
-
getAnchorNodeCount() → {Int}
-
Return count of anchorNodes.
- Inherited From:
- Source:
Returns:
-
Type
-
Int
-
getChildAt(index) → {Variant}
-
Get child object (including both nodes and connectors) at index.
Parameters:
Name |
Type |
Description |
index |
Int
|
|
- Inherited From:
- Source:
Returns:
-
Type
-
Variant
-
getChildCount() → {Int}
-
Get count of child objects (including both nodes and connectors).
- Inherited From:
- Source:
Returns:
-
Type
-
Int
-
-
Get connector at index.
Parameters:
Name |
Type |
Description |
index |
Int
|
|
- Inherited From:
- Source:
Returns:
-
Type
-
Kekule.ChemStructureConnector
-
-
Get a structure connector object with a specified id.
Parameters:
Name |
Type |
Description |
id |
String
|
|
- Inherited From:
- Source:
Returns:
-
Type
-
Kekule.ChemStructureConnector
-
getConnectorCount() → {Int}
-
Return count of connectors.
- Inherited From:
- Source:
Returns:
-
Type
-
Int
-
-
Get connector between this object and another object.
Parameters:
- Inherited From:
- Source:
Returns:
-
Type
-
Kekule.ChemStructureConnector
-
getContainerBox(coordMode, allowCoordBorrow) → {Hash}
-
Calculate the box to fit all sub molecule.
Parameters:
Name |
Type |
Description |
coordMode |
Int
|
Determine to calculate 2D or 3D box. Value from Kekule.CoordMode. |
allowCoordBorrow |
Bool
|
|
- Inherited From:
- Source:
Returns:
Box information. {x1, y1, z1, x2, y2, z2} (in 2D mode z1 and z2 will not be set).
-
Type
-
Hash
-
getContainerBox2D(allowCoordBorrow) → {Hash}
-
Calculate the 2D box to contain the object.
Parameters:
Name |
Type |
Description |
allowCoordBorrow |
Bool
|
|
- Inherited From:
- Source:
Returns:
Box information. {x1, y1, z1, x2, y2, z2} (in 2D mode z1 and z2 will not be set).
-
Type
-
Hash
-
getContainerBox3D(allowCoordBorrow) → {Hash}
-
Calculate the 3D box to contain the object.
Parameters:
Name |
Type |
Description |
allowCoordBorrow |
Bool
|
|
- Inherited From:
- Source:
Returns:
Box information. {x1, y1, z1, x2, y2, z2} (in 2D mode z1 and z2 will not be set).
-
Type
-
Hash
-
-
Returns direct child object of ctab which hold node as nested child.
- Inherited From:
- Source:
Returns:
-
Type
-
Kekule.StructureFragment
-
-
Returns the shadow fragment with all subgroups unmarshalled
Parameters:
Name |
Type |
Description |
autoCreate |
Bool
|
Whether allow to create new one when the shadow does not exists. |
- Inherited From:
- Source:
Returns:
-
Type
-
Kekule.StructureFragment
-
-
Returns the flatterned shadowed object of source.
Parameters:
- Inherited From:
- Source:
Returns:
-
Type
-
Kekule.ChemStructureObject
-
getFlatternedShadowShadowObjs(srcObjs) → {Array}
-
Returns the flatterned shadowed objects of source.
Parameters:
Name |
Type |
Description |
srcObjs |
Array
|
|
- Inherited From:
- Source:
Returns:
-
Type
-
Array
-
-
Returns the source object from flatterned shadow.
Parameters:
- Inherited From:
- Source:
Returns:
-
Type
-
Kekule.ChemStructureObject
-
getFlatternedShadowSourceObjs(shadowObjs) → {Array}
-
Returns the source objects from flatterned shadow.
Parameters:
Name |
Type |
Description |
shadowObjs |
Array
|
|
- Inherited From:
- Source:
Returns:
-
Type
-
Array
-
getLeafNodes() → {Array}
-
Get all leaf nodes (node that do not have children, usually atom).
Note if a sub group has no children, it will be regarded as leaf node too.
- Inherited From:
- Source:
Returns:
-
Type
-
Array
-
getLinkedBonds(bondType) → {Array}
-
Parameters:
Name |
Type |
Description |
bondType |
Int
|
|
- Inherited From:
- Source:
Returns:
-
Type
-
Array
-
getLinkedChemNodes(ignoreHydrogenAtoms) → {Array}
-
Returns neighbor nodes linked to this node through proper connectors.
Parameters:
Name |
Type |
Description |
ignoreHydrogenAtoms |
Bool
|
Whether explicit hydrogen atoms are returned. Default is false. |
- Inherited From:
- Source:
Returns:
-
Type
-
Array
-
-
Get linked connector object at index.
Parameters:
Name |
Type |
Description |
index |
Int
|
|
- Inherited From:
- Source:
Returns:
-
Type
-
Kekule.ChemStructureConnector
-
getLinkedConnectorCount() → {Int}
-
Return count of linkedConnectors.
- Inherited From:
- Source:
Returns:
-
Type
-
Int
-
getLinkedDoubleBonds() → {Array}
-
Returns linked double covalent bond to this node.
- Inherited From:
- Source:
Returns:
-
Type
-
Array
-
getLinkedHydrogenAtoms() → {Array}
-
Returns linked hydrogen atoms.
- Inherited From:
- Source:
Returns:
-
Type
-
Array
-
getLinkedMultipleBonds() → {Array}
-
Returns linked multiple covalent bond to this node.
- Inherited From:
- Source:
Returns:
-
Type
-
Array
-
getLinkedNonHydrogenConnectors() → {Array}
-
Returns connectors that connected to a non hydrogen node.
- Inherited From:
- Source:
Returns:
-
Type
-
Array
-
getLinkedNonHydrogenObjs() → {Array}
-
Returns linked objects except hydrogen atoms.
- Inherited From:
- Source:
Returns:
-
Type
-
Array
-
getLinkedObjsOnConnector() → {Array}
-
Returns other objects connected to this one through connector.
- Inherited From:
- Source:
Returns:
-
Type
-
Array
-
getNextSiblingOfChild(childObj) → {Variant}
-
Returns next sibling node or connector to childObj.
Parameters:
Name |
Type |
Description |
childObj |
Variant
|
Node or connector. |
- Inherited From:
- Source:
Returns:
-
Type
-
Variant
-
-
Get node at index.
Parameters:
Name |
Type |
Description |
index |
Int
|
|
- Inherited From:
- Source:
Returns:
-
Type
-
Kekule.ChemStructureNode
-
-
Get node at indexStack.
For example, indexStack is [2, 3, 1], then this.getNodeAt(2).getNodeAt(3).getNodeAt(1) will be returned.
Parameters:
Name |
Type |
Description |
indexStack |
Array
|
Array of integers. |
- Inherited From:
- Source:
Returns:
-
Type
-
Kekule.ChemStructureNode
-
-
Get a structure node object with a specified id.
Parameters:
Name |
Type |
Description |
id |
String
|
|
- Inherited From:
- Source:
Returns:
-
Type
-
Kekule.ChemStructureNode
-
getNodeCount() → {Int}
-
Return count of nodes.
- Inherited From:
- Source:
Returns:
-
Type
-
Int
-
-
Get a structure node or connector object with a specified id.
Parameters:
Name |
Type |
Description |
id |
String
|
|
- Inherited From:
- Source:
Returns:
-
Type
-
Kekule.ChemStructureObject
-
-
- Inherited From:
- Source:
Returns:
-
Type
-
Kekule.StructureFragment
-
-
Returns the most possible isotope of node.
To
Kekule.Atom, this should be simplely the isotope of atom
while variable atom or pseudoatom may has its own implementation.
This method returns null if isotope is uncertain to this node.
Descendants need to override this method.
- Inherited From:
- Source:
Returns:
-
Type
-
Kekule.Isotope
-
-
- Inherited From:
- Source:
Returns:
-
Type
-
Kekule.StructureFragment
-
getSubFragments() → {Array}
-
Get all sub fragments (node that have children, usually SubGroup).
Note if a sub group has no children, it will not be regarded as sub fragment.
- Inherited From:
- Source:
Returns:
-
Type
-
Array
-
hasChildObj(childObj) → {Bool}
-
Check if childObj is a child node or connector of this fragment's ctab.
Parameters:
- Inherited From:
- Source:
Returns:
-
Type
-
Bool
-
hasConnector(connector, checkNestedStructure) → {Bool}
-
Check if a connector exists in structure.
Parameters:
Name |
Type |
Description |
connector |
Kekule.ChemStructureConnector
|
Connector to seek. |
checkNestedStructure |
Bool
|
If true the nested sub groups will also be checked. |
- Inherited From:
- Source:
Returns:
-
Type
-
Bool
-
hasCtab()
-
Check whether a connection table is used to represent this fragment.
- Inherited From:
- Source:
-
-
Check whether a formula is used to represent this fragment.
- Inherited From:
- Source:
-
hasNode(node, checkNestedStructure) → {Bool}
-
Check if a node exists in structure.
Parameters:
Name |
Type |
Description |
node |
Kekule.ChemStructureNode
|
Node to seek. |
checkNestedStructure |
Bool
|
If true the nested sub groups will also be checked. |
- Inherited From:
- Source:
Returns:
-
Type
-
Bool
-
hasSubFragments() → {Bool}
-
Returns whether there are sub fragment(s) (node that have children, usually SubGroup) in this fragment.
Note if a sub group has no children, it will not be regarded as sub fragment.
- Inherited From:
- Source:
Returns:
-
Type
-
Bool
-
indexOfAnchorNode(node) → {Int}
-
Get index of anchor node.
Parameters:
- Inherited From:
- Source:
Returns:
-
Type
-
Int
-
indexOfChild(obj) → {Int}
-
Get the index of obj in children list.
Parameters:
Name |
Type |
Description |
obj |
Variant
|
|
- Inherited From:
- Source:
Returns:
Index of obj or -1 when not found.
-
Type
-
Int
-
indexOfConnector(connector) → {Int}
-
Get index of connector inside fragment.
Parameters:
- Inherited From:
- Source:
Returns:
-
Type
-
Int
-
indexOfLinkedConnector(connector) → {Int}
-
Returns index of connector connected to node.
Parameters:
- Inherited From:
- Source:
Returns:
-
Type
-
Int
-
indexOfNode(node) → {Int}
-
Get index of node.
Parameters:
- Inherited From:
- Source:
Returns:
-
Type
-
Int
-
indexStackOfNode(node) → {Variant}
-
Returns index of node. If node exists in nested sub group, index in sub group will be pushed to stack as well.
Parameters:
- Inherited From:
- Source:
Returns:
If node is the direct child of this structure, returns {Int}, otherwise stack {Array} will be returned.
-
Type
-
Variant
-
insertBefore(obj, refChild) → {Int}
-
Insert obj before refChild in node or connector list of ctab.
If refChild is null or does not exists, obj will be append to tail of list.
Parameters:
Name |
Type |
Description |
obj |
Variant
|
A node or connector. |
refChild |
Variant
|
Ref node or connector |
- Inherited From:
- Source:
Returns:
Index of obj after inserting.
-
Type
-
Int
-
insertConnectorAt(connector, index)
-
Insert connector to index. If index is not set, node will be inserted as the first connector of ctab.
Parameters:
- Inherited From:
- Source:
-
insertNodeAt(node, index)
-
Insert node to index. If index is not set, node will be inserted as the first node of ctab.
Parameters:
- Inherited From:
- Source:
-
isConnectorInAromaticRing(connector) → {Bool}
-
Check if a connector is in aromatic ring stored in aromaticRings property.
Parameters:
- Inherited From:
- Source:
Returns:
-
Type
-
Bool
-
isCtabEmpty() → {Bool}
-
Returns if the ctab of this structure fragment has no nodes or connectors.
- Inherited From:
- Source:
Returns:
-
Type
-
Bool
-
isEmpty() → {Bool}
-
Returns if this fragment has no formula or ctab, or ctab has no nodes or connectors.
- Inherited From:
- Source:
Returns:
-
Type
-
Bool
-
isHydrogenAtom() → {Bool}
-
Returns whether this node is a H atom (but not D or T).
- Inherited From:
- Source:
Returns:
-
Type
-
Bool
-
isNodeInAromaticRing(node) → {Bool}
-
Check if a node is in aromatic ring stored in aromaticRings property.
Parameters:
- Inherited From:
- Source:
Returns:
-
Type
-
Bool
-
isSubFragment(node) → {Bool}
-
Check if a node has a sub structure (has child nodes).
Note if a sub group has no children, it will not be regarded as sub fragment.
Parameters:
- Inherited From:
- Source:
Returns:
-
Type
-
Bool
-
-
Parameters:
- Inherited From:
- Source:
Returns:
-
Type
-
Kekule.StructureFragment
-
nodesHasCoord2D(allowCoordBorrow) → {Bool}
-
Check if child nodes has 2D coord.
Parameters:
Name |
Type |
Description |
allowCoordBorrow |
Bool
|
|
- Inherited From:
- Source:
Returns:
-
Type
-
Bool
-
nodesHasCoord3D(allowCoordBorrow) → {Bool}
-
Check if child nodes has 3D coord.
Parameters:
Name |
Type |
Description |
allowCoordBorrow |
Bool
|
|
- Inherited From:
- Source:
Returns:
-
Type
-
Bool
-
recalcCoords()
-
Recalculate coords of group and child notes.
The coords of child nodes are based on group coord, while group coord is calculated
by anchorNodes. So those value may need to be recalculate when anchor nodes changed.
- Inherited From:
- Source:
-
removeAnchorNode(node)
-
Remove a node in anchorNodes.
Parameters:
- Inherited From:
- Source:
-
removeAnchorNodeAt(index)
-
Remove node at index of anchorNodes.
Parameters:
Name |
Type |
Description |
index |
Int
|
|
- Inherited From:
- Source:
-
removeChild(childObj)
-
Remove child obj directly from connection table.
Parameters:
Name |
Type |
Description |
childObj |
Variant
|
A child node or connector. |
- Inherited From:
- Source:
-
removeChildObj(childObj, cascadeRemove, freeRemoved)
-
Remove childObj from connection table.
Parameters:
Name |
Type |
Description |
childObj |
Variant
|
A child node or connector. |
cascadeRemove |
Bool
|
Whether remove related objects (e.g., bond connected to an atom). |
freeRemoved |
Bool
|
Whether free all removed objects. |
- Inherited From:
- Source:
-
removeConnector(connector, preserveConnectedObjs)
-
Remove a connector in container.
Parameters:
Name |
Type |
Description |
connector |
Kekule.ChemStructureConnector
|
|
preserveConnectedObjs |
Bool
|
Whether delte relations between this connector and related nodes. |
- Inherited From:
- Source:
-
removeConnectorAt(index, preserveConnectedObjs)
-
Remove connector at index of connectors.
Parameters:
Name |
Type |
Description |
index |
Int
|
|
preserveConnectedObjs |
Bool
|
Whether delte relations between this connector and related nodes. |
- Inherited From:
- Source:
-
removeCtab()
-
Delete ctab info from this fragment.
- Inherited From:
- Source:
-
-
Delete formula info from this fragment.
- Inherited From:
- Source:
-
removeLinkedConnector(connector)
-
Remove a connector in linkedContainer.
Parameters:
- Inherited From:
- Source:
-
removeLinkedConnectorAt(index)
-
Remove connector at index of linkedConnectors.
Parameters:
Name |
Type |
Description |
index |
Int
|
|
- Inherited From:
- Source:
-
removeNode(node, preserveLinkedConnectors)
-
Remove a node in container.
Parameters:
Name |
Type |
Description |
node |
Kekule.ChemStructureNode
|
|
preserveLinkedConnectors |
Bool
|
Whether remove relations between this node and linked connectors. |
- Inherited From:
- Source:
-
removeNodeAt(index, preserveLinkedConnectors)
-
Remove node at index in container.
Parameters:
Name |
Type |
Description |
index |
Int
|
|
preserveLinkedConnectors |
Bool
|
Whether remove relations between this node and linked connectors. |
- Inherited From:
- Source:
-
removeThisFromLinkedConnector()
-
Remove this node from all linked connectors.
Ths method should be called before a object is removed from a structure.
- Inherited From:
- Source:
-
replaceNode(oldNode, newNode)
-
Replace oldNode with new one, preserve coords and all linked connectors.
Parameters:
- Inherited From:
- Source:
-
sortConnectors(sortFunc)
-
Sort direct child connectors in structure fragment.
Parameters:
Name |
Type |
Description |
sortFunc |
function
|
Function to determine the priority of nodes. |
- Inherited From:
- Source:
-
sortNodes(sortFunc)
-
Sort direct child nodes in structure fragment.
Parameters:
Name |
Type |
Description |
sortFunc |
function
|
Function to determine the priority of nodes. |
- Inherited From:
- Source:
-
traverse(callback, startingNode, breadthFirst, partialNodes) → {Hash}
-
Traverse the nodes in connection tab through a depth or breadth first spanning tree algorithm.
Parameters:
Name |
Type |
Description |
callback |
Func
|
Function called when meet a new node or connector, has two params: callback(currNodeOrConnector, isConnector) |
startingNode |
Kekule.StructureNode
|
Starting position of travers. |
breadthFirst |
Bool
|
Set to true to use breadth first algorithm or false to use depth first algorithm. |
partialNodes |
Array
|
If this param is set, only part of the structure will be traversed. |
- Inherited From:
- Source:
Returns:
A hash object containing all the nodes and connectors sequence traversed. {nodes, connectors}.
Note that all nodes but not all connectors (e.g., the one in ring) may be traversed.
If the structure has no ctab, null will be returned.
-
Type
-
Hash
-
unmarshalAllSubFragments(cascade)
-
Parameters:
Name |
Type |
Description |
cascade |
Bool
|
If subfragments should also unmarshal their children fragments. |
- Inherited From:
- Source:
-
unmarshalSubFragment(subFragment, cascade)
-
Parameters:
Name |
Type |
Description |
subFragment |
Kekule.StructureFragment
|
Sub fragment to be ungrouped. |
cascade |
Bool
|
If subfragment should also unmarshal its children fragments. |
- Inherited From:
- Source: