Class: MoleculeGroup

MoleculeGroup

new MoleculeGroup()

A group of molecule.
Source:

Extends

Methods

appendChild(obj) → {Int}

Append obj to children list. If obj already inside, nothing will be done.
Parameters:
Name Type Description
obj Object
Inherited From:
Source:
Returns:
Index of obj after appending.
Type
Int

appendItem(item)

Append an attrib-object pair item in group.
Parameters:
Name Type Description
item Hash
Inherited From:
Source:

appendLinkedConnector(connector)

Link a connector to this node.
Parameters:
Name Type Description
connector Kekule.ChemStructureConnector
Inherited From:
Source:

appendObj(obj, attributes)

Add object to group. If object already in group, nothing will be done.
Parameters:
Name Type Description
obj Kekule.ChemStructureObject
attributes Hash Additional attributes of this object. Can be null.
Inherited From:
Source:

clearStructureFlags()

Clear all flags of structure object that should be changed when structure is changed. Descendants may override this method.
Inherited From:
Source:

compareStructure(targetObj, options) → {Int}

Explicit set compare method to chem structure and compare to targetObj.
Parameters:
Name Type Description
targetObj Kekule.ChemObject
options Hash
Inherited From:
Source:
Returns:
Type
Int

equalStructure(targetObj, options) → {Bool}

Check if this object and targetObj has equivalent chem structure.
Parameters:
Name Type Description
targetObj Kekule.ChemObject
options Hash
Inherited From:
Source:
Returns:
Type
Bool

getAllObjs() → {Array}

Returns an array containing the child objects (without attribute).
Inherited From:
Source:
Returns:
Type
Array

getChildAt(index) → {Variant}

Get child object at index.
Parameters:
Name Type Description
index Int
Inherited From:
Source:
Returns:
Type
Variant

getChildCount() → {Int}

Get count of child objects in root.
Inherited From:
Source:
Returns:
Type
Int

getConnectorTo(obj) → {Kekule.ChemStructureConnector}

Get connector between this object and another object.
Parameters:
Name Type Description
obj Kekule.ChemStructureObject
Inherited From:
Source:
Returns:
Type
Kekule.ChemStructureConnector

getCurrConnectableObj() → {Kekule.ChemStructureObject}

Returns self or child object that can directly linked to a connector. For atom or other simple chem objetc, this function should just returns self, for structure fragment, this function need to returns an anchor node.
Inherited From:
Source:
Returns:
Type
Kekule.ChemStructureObject

getItemAt(index) → {Object}

Get item at index of items array.
Parameters:
Name Type Description
index Int
Inherited From:
Source:
Returns:
Type
Object

getItemCount() → {Int}

Get count of items in group.
Inherited From:
Source:
Returns:
Type
Int

getLinkedConnectorAt(index) → {Kekule.ChemStructureConnector}

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

getLinkedHydrogenAtoms() → {Array}

Returns linked hydrogen atoms.
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(child) → {Hash}

Returns next sibling item to child item or object.
Parameters:
Name Type Description
child Variant Item or object.
Inherited From:
Source:
Returns:
Type
Hash

getObjAt(index) → {Object}

Get object stored in item at index.
Parameters:
Name Type Description
index Int
Inherited From:
Source:
Returns:
Type
Object

getParentFragment() → {Kekule.StructureFragment}

If Kekule.ChemStructureObject#parent is a Kekule.StructureFragment, returns this fragment.
Inherited From:
Source:
Returns:
Type
Kekule.StructureFragment

getRootFragment() → {Kekule.StructureFragment}

Returns the root parent of Kekule.StructureFragment, rather than subgroups.
Inherited From:
Source:
Returns:
Type
Kekule.StructureFragment

hasObj(obj) → {Bool}

Check if obj exists in items.
Parameters:
Name Type Description
obj Object
Inherited From:
Source:
Returns:
Type
Bool

indexOfChild(obj) → {Int}

Get the index of obj (object or object-attribute item) in children list of root.
Parameters:
Name Type Description
obj Variant
Inherited From:
Source:
Returns:
Index of obj or -1 when not found.
Type
Int

indexOfItem(item) → {Int}

Get index of item in items array.
Parameters:
Name Type Description
item Object
Inherited From:
Source:
Returns:
Index of item in array. If not found, returns -1.
Type
Int

indexOfLinkedConnector(connector) → {Int}

Returns index of connector connected to node.
Parameters:
Name Type Description
connector Kekule.ChemStructureConnector
Inherited From:
Source:
Returns:
Type
Int

indexOfObj(obj) → {Int}

Get index of obj in items array.
Parameters:
Name Type Description
obj Object
Inherited From:
Source:
Returns:
Index of object in array. If not found, returns -1.
Type
Int

insertBefore(item, refItem)

Insert attrib-object pair item before refChild in group. If refChild is null or does not exists, item will be append to tail of list.
Parameters:
Name Type Description
item Hash
refItem Hash
Inherited From:
Source:

insertChild(obj, index) → {Int}

Insert obj to index of children list. If obj already inside, its position will be changed.
Parameters:
Name Type Description
obj Object
index Object
Inherited From:
Source:
Returns:
Index of obj after inserting.
Type
Int

insertItem(item, index)

Insert an attrib-object pair item in group at index.
Parameters:
Name Type Description
item Hash
index Int
Inherited From:
Source:

insertObj(item, index, attributes)

Insert an attrib-object pair item in group at index.
Parameters:
Name Type Description
item Hash
index Int
attributes Hash Additional attributes of this object. Can be null.
Inherited From:
Source:

notifyItemsChanged()

Notify Kekule.ChemStructureObjectGroup#objs property has been changed
Inherited From:
Source:

removeChild(obj)

Remove an object or attrib-object pair item from group.
Parameters:
Name Type Description
obj Variant
Inherited From:
Source:

removeChildAt(index) → {Variant}

Remove a child at index.
Parameters:
Name Type Description
index Int
Inherited From:
Source:
Returns:
Child object removed.
Type
Variant

removeItem(obj)

Remove an attrib-object pair item in group.
Parameters:
Name Type Description
obj Kekule.ChemStructureObject
Inherited From:
Source:

removeItemAt(index)

Remove an attrib-object pair item at index in group.
Parameters:
Name Type Description
index Int
Inherited From:
Source:

removeLinkedConnector(connector)

Remove a connector in linkedContainer.
Parameters:
Name Type Description
connector Kekule.ChemStructureConnector
Inherited From:
Source:

removeLinkedConnectorAt(index)

Remove connector at index of linkedConnectors.
Parameters:
Name Type Description
index Int
Inherited From:
Source:

removeObj(obj)

Remove an object in group.
Parameters:
Name Type Description
obj Kekule.ChemStructureObject
Inherited From:
Source:

removeObjAt(index)

Remove object at index in group.
Parameters:
Name Type Description
index Int
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:

setAttributesAt(index, attributes)

Set additional fields of item at index.
Parameters:
Name Type Description
index Object
attributes Object
Inherited From:
Source:

Events

structureChange

Invoked when object is changed and the change is related with structure (e.g. modify a bond, change a atomic number...). Event has field: {origin: the change source object (may be a child of event.target}.
Inherited From:
Source: