Class: Reaction

Reaction

new Reaction()

A chemical reaction. Including information on reactants, products, substances and conditions. All informations are organized in a role-object form using Kekule.RoleMap. Property reactants, products and substances should be maps of role-Kekule.Molecule. Property conditions can be of role-Object.
Properties:
Name Type Description
name String Name of reaction.
title String Title of reaction.
reactionType String Type of reaction.
yield Float Yield of reaction. 0 <= Value <= 1.
reactants Array Reactants of reaction, each item in array should be a role map based hash.
products Array Products of reaction, each item in array should be a role map based hash.
substances Array Substances related but not evolved in reaction, such as solvent. Each item in array should be a a role map based hash.
conditions Array Conditions of reaction, including temperature, pressure and so on.
Source:

Extends

Methods

appendCondition(item, role, additionalInfo) → {Int}

Append condition, role, amount information to Kekule.Reaction#conditions array.
Parameters:
Name Type Description
item Variant
role String Can be null to indicate with no explicit role.
additionalInfo Hash Any addition information need to be inserted.
Source:
Returns:
Index of map in array after appending.
Type
Int

appendConditionMap(map) → {Int}

Append map to the Kekule.Reaction#conditions array. If already exists, append will not be done.
Parameters:
Name Type Description
map Hash Map object to append.
Source:
Returns:
Index of map in array after appending.
Type
Int

appendItem(component, item, role, additionalInfo) → {Int}

Combine item and role to a map object and append it to the array of component. If the same item and role already exists, append will not be done.
Parameters:
Name Type Description
component String Component name, value from Kekule.ReactionComponent.
item Variant
role String Can be null to indicate with no explicit role.
additionalInfo Hash Additional fields and values need to add to role map.
Source:
Returns:
Index of map in array after appending.
Type
Int

appendMap(component, map) → {Int}

Append map to the array of component. If already exists, append will not be done.
Parameters:
Name Type Description
component String Component name, value from Kekule.ReactionComponent.
map Hash Map to find.
Source:
Returns:
Index of map in array after appending.
Type
Int

appendMarker(marker)

Attach a marker to this object. If marker already exists, nothing will be done.
Parameters:
Name Type Description
marker Kekule.ChemObject
Inherited From:
Source:

appendProduct(item, role, amount, additionalInfo) → {Int}

Append product, role, amount information to Kekule.Reaction#products array.
Parameters:
Name Type Description
item Variant
role String Can be null to indicate with no explicit role.
amount Num Coefficients of product in reaction.
additionalInfo Hash Any addition information need to be inserted.
Source:
Returns:
Index of map in array after appending.
Type
Int

appendProductMap(map) → {Int}

Append map to the Kekule.Reaction#products array. If already exists, append will not be done.
Parameters:
Name Type Description
map Hash Map object to append.
Source:
Returns:
Index of map in array after appending.
Type
Int

appendReactant(item, role, amount, additionalInfo) → {Int}

Append reactant, role, amount information to Kekule.Reaction#reactants array.
Parameters:
Name Type Description
item Variant
role String Can be null to indicate with no explicit role.
amount Num Coefficients of reactant in reaction.
additionalInfo Hash Any addition information need to be inserted.
Source:
Returns:
Index of map in array after appending.
Type
Int

appendReactantMap(map) → {Int}

Append map to the Kekule.Reaction#reactants array. If already exists, append will not be done.
Parameters:
Name Type Description
map Hash Map object to append.
Source:
Returns:
Index of map in array after appending.
Type
Int

appendSubstance(item, role, amount, additionalInfo) → {Int}

Append substance, role, amount information to Kekule.Reaction#substances array.
Parameters:
Name Type Description
item Variant
role String Can be null to indicate with no explicit role.
amount Num Amount of substances.
additionalInfo Hash Any addition information need to be inserted.
Source:
Returns:
Index of map in array after appending.
Type
Int

appendSubstanceMap(map) → {Int}

Append map to the Kekule.Reaction#substances array. If already exists, append will not be done.
Parameters:
Name Type Description
map Hash Map object to append.
Source:
Returns:
Index of map in array after appending.
Type
Int

clearAll()

Clear all molecule/condition info from reaction.
Source:

clearComponent(component)

Clear array of component.
Parameters:
Name Type Description
component String Component name, value from Kekule.ReactionComponent.
Source:

clearConditions()

Clear all conditions from reaction.
Source:

clearMarkers()

Remove all attached markers.
Inherited From:
Source:

clearProducts()

Clear all products from reaction.
Source:

clearReactants()

Clear all reactants from reaction.
Source:

clearSubstance()

Clear all substances from reaction.
Source:

componentToPropName(component) → {String}

Get property name corresponding to values in Kekule.ReactionComponent
Parameters:
Name Type Description
component String
Source:
Returns:
Property name or null (if not found).
Type
String

fetchMarkerOfType(classType, canCreate, exactMatch, defProps) → {Kekule.ChemObject}

Get attached marker of classType. If no such a marker currently and canCreate is true, a new marker will be created.
Parameters:
Name Type Description
classType Class
canCreate Bool
exactMatch Bool If true, only marker of classType (not its descendants) should be returned.
defProps Hash If create a new marker, those prop values will be applied.
Inherited From:
Source:
Returns:
Type
Kekule.ChemObject

getAllContainingConnectors() → {Array}

Return all bonds in structure as well as in sub structure.
Source:
Returns:
Array of {Kekule.ChemStructureConnector}.
Type
Array

getComponentArray(component, canCreate) → {Array}

Get component array.
Parameters:
Name Type Description
component String Component name, value from Kekule.ReactionComponent.
canCreate Bool Whether create a new array if component array is not set.
Source:
Returns:
Corresponding array to component or null on failure.
Type
Array

getComponentItemCount(component) → {Int}

Get item count of a component array.
Parameters:
Name Type Description
component String Component name, value from Kekule.ReactionComponent.
Source:
Returns:
Length of array or null on failure.
Type
Int

getConditionCount() → {Int}

Get item count of Kekule.Reaction#conditions array.
Source:
Returns:
Length of array or null on failure.
Type
Int

getConditionItemAt(index) → {Variant}

Get map item at index of a Kekule.Reaction#conditions array.
Parameters:
Name Type Description
index Int Index in array.
Source:
Returns:
Item in map object or null on failure.
Type
Variant

getConditionMapAt(index) → {Hash}

Get role map at index of Kekule.Reaction#conditions.
Parameters:
Name Type Description
index Int Index in array.
Source:
Returns:
Map object in array. Return null if not found.
Type
Hash

getMapAt(component, index) → {Hash}

Get item at index of a component array.
Parameters:
Name Type Description
component String Component name, value from Kekule.ReactionComponent.
index Int Index in array.
Source:
Returns:
Map in array. Return null if not found.
Type
Hash

getMapItemAt(component, index) → {Variant}

Get map.item at index of a component array.
Parameters:
Name Type Description
component String Component name, value from Kekule.ReactionComponent.
index Int Index in array.
Source:
Returns:
Item in map object or null on failure.
Type
Variant

getMarkerAt(index) → {Kekule.ChemObject}

Get attached marker at index.
Parameters:
Name Type Description
index Int
Inherited From:
Source:
Returns:
Type
Kekule.ChemObject

getMarkerCount() → {Int}

Return count of attached markers.
Inherited From:
Source:
Returns:
Type
Int

getMarkerOfType(classType, exactMatch) → {Kekule.ChemObject}

Returns the first child marker of a specified class type.
Parameters:
Name Type Description
classType Class
exactMatch Bool If true, only marker of classType (not its descendants) should be returned.
Inherited From:
Source:
Returns:
Type
Kekule.ChemObject

getMarkersOfType(classType, exactMatch) → {Array}

Returns all child markers of a specified class type.
Parameters:
Name Type Description
classType Class
exactMatch Bool If true, only markers of classType (not its descendants) should be returned.
Inherited From:
Source:
Returns:
Type
Array

getProductAt(index) → {Object}

Get item at index of a Kekule.Reaction#products array. Same as {@like Kekule.Reaction#getProductItemAt}.
Parameters:
Name Type Description
index Int Index in array.
Source:
Returns:
Product or null.
Type
Object

getProductCount() → {Int}

Get item count of Kekule.Reaction#products array.
Source:
Returns:
Length of array or null on failure.
Type
Int

getProductItemAt(index) → {Variant}

Get map item at index of a Kekule.Reaction#products array.
Parameters:
Name Type Description
index Int Index in array.
Source:
Returns:
Item in map object or null on failure.
Type
Variant

getProductMapAt(index) → {Hash}

Get role map at index of Kekule.Reaction#products.
Parameters:
Name Type Description
index Int Index in array.
Source:
Returns:
Map object in array. Return null if not found.
Type
Hash

getReactantAt(index) → {Object}

Get item at index of a Kekule.Reaction#reactants array. Same as {@like Kekule.Reaction#getReactantItemAt}.
Parameters:
Name Type Description
index Int Index in array.
Source:
Returns:
Reactant or null.
Type
Object

getReactantCount() → {Int}

Get item count of Kekule.Reaction#reactants array.
Source:
Returns:
Length of array or null on failure.
Type
Int

getReactantItemAt(index) → {Variant}

Get map item at index of a Kekule.Reaction#reactants array.
Parameters:
Name Type Description
index Int Index in array.
Source:
Returns:
Item in map object or null on failure.
Type
Variant

getReactantMapAt(index) → {Hash}

Get role map at index of Kekule.Reaction#reactants.
Parameters:
Name Type Description
index Int Index in array.
Source:
Returns:
Map object in array. Return null if not found.
Type
Hash

getSubstanceAt(index) → {Object}

Get item at index of a Kekule.Reaction#substances array. Same as {@like Kekule.Reaction#getSubstanceItemAt}.
Parameters:
Name Type Description
index Int Index in array.
Source:
Returns:
Product or null.
Type
Object

getSubstanceItemAt(index) → {Variant}

Get map item at index of a Kekule.Reaction#substances array.
Parameters:
Name Type Description
index Int Index in array.
Source:
Returns:
Item in map object or null on failure.
Type
Variant

getSubstanceMapAt(index) → {Hash}

Get role map at index of Kekule.Reaction#substances.
Parameters:
Name Type Description
index Int Index in array.
Source:
Returns:
Map object in array. Return null if not found.
Type
Hash

getSubstancesCount() → {Int}

Get item count of Kekule.Reaction#substances array.
Source:
Returns:
Length of array or null on failure.
Type
Int

getUnplacedMarkers(coordMode) → {Array}

Returns markers that has no coord on coordMode
Parameters:
Name Type Description
coordMode Int
Inherited From:
Source:
Returns:
Type
Array

hasMarker(marker) → {Bool}

Check if a marker has been attached to this object.
Parameters:
Name Type Description
marker Kekule.ChemObject
Inherited From:
Source:
Returns:
Type
Bool

hasMarkerOfType(classType, exactMatch) → {Bool}

Returns whether there exists child markers of a specified class type.
Parameters:
Name Type Description
classType Class
exactMatch Bool If true, only markers of classType (not its descendants) should be considered.
Inherited From:
Source:
Returns:
Type
Bool

indexOfCondition(item, role) → {Int}

Get index of itemm in Kekule.Reaction#conditions array.
Parameters:
Name Type Description
item Variant Item to find.
role String Role of item, set it to undefined to ignore role in searching. Note: role can be null (not undefined) to search item with no explicit role.
Source:
Returns:
Index of item or -1 on failure.
Type
Int

indexOfConditionMap(map) → {Int}

Get index of map object in Kekule.Reaction#conditions array.
Parameters:
Name Type Description
map Hash Map to find.
Source:
Returns:
Index of map or -1 on failure.
Type
Int

indexOfItem(component, item, role) → {Int}

Get index of map.item in a component array.
Parameters:
Name Type Description
component String Component name, value from Kekule.ReactionComponent.
item Variant Item to find.
role String Role of item, set it to undefined to ignore role in searching. Note: role can be null (not undefined) to search item with no explicit role.
Source:
Returns:
Index of item or -1 on failure.
Type
Int

indexOfMap(component, map) → {Int}

Get index of map in array of component.
Parameters:
Name Type Description
component String Component name, value from Kekule.ReactionComponent.
map Hash Map object to find.
Source:
Returns:
Index of map or -1 on failure.
Type
Int

indexOfMarker(marker) → {Int}

Get index of attached marker in marker array.
Parameters:
Name Type Description
marker Kekule.ChemObject
Inherited From:
Source:
Returns:
Type
Int

indexOfProduct(item, role) → {Int}

Get index of itemm in Kekule.Reaction#products array.
Parameters:
Name Type Description
item Variant Item to find.
role String Role of item, set it to undefined to ignore role in searching. Note: role can be null (not undefined) to search item with no explicit role.
Source:
Returns:
Index of item or -1 on failure.
Type
Int

indexOfProductMap(map) → {Int}

Get index of map object in Kekule.Reaction#products array.
Parameters:
Name Type Description
map Hash Map to find.
Source:
Returns:
Index of map or -1 on failure.
Type
Int

indexOfReactant(item, role) → {Int}

Get index of itemm in Kekule.Reaction#reactants array.
Parameters:
Name Type Description
item Variant Item to find.
role String Role of item, set it to undefined to ignore role in searching. Note: role can be null (not undefined) to search item with no explicit role.
Source:
Returns:
Index of item or -1 on failure.
Type
Int

indexOfReactantMap(map) → {Int}

Get index of map object in Kekule.Reaction#reactants array.
Parameters:
Name Type Description
map Hash Map to find.
Source:
Returns:
Index of map or -1 on failure.
Type
Int

indexOfSubstance(item, role) → {Int}

Get index of itemm in Kekule.Reaction#substances array.
Parameters:
Name Type Description
item Variant Item to find.
role String Role of item, set it to undefined to ignore role in searching. Note: role can be null (not undefined) to search item with no explicit role.
Source:
Returns:
Index of item or -1 on failure.
Type
Int

indexOfSubstanceMap(map) → {Int}

Get index of map object in Kekule.Reaction#substances array.
Parameters:
Name Type Description
map Hash Map to find.
Source:
Returns:
Index of map or -1 on failure.
Type
Int

insertMarkerAt(marker, index)

Insert marker to index. If index is not set, marker will be inserted to the tail of the marker array.
Parameters:
Name Type Description
marker Kekule.ChemObject
index Int
Inherited From:
Source:

insertMarkerBefore(marker, refMarker) → {Int}

Insert marker before refMarker in marker list. If refMarker is null or does not exists, marker will be append to tail of list.
Parameters:
Name Type Description
marker Kekule.ChemObject
refMarker Kekule.ChemObject
Inherited From:
Source:
Returns:
Index of obj after inserting.
Type
Int

isAttachedMarker() → {Bool}

Returns whether current object is an attachedMarker of parent object.
Inherited From:
Source:
Returns:
Type
Bool

removeCondition(item, role) → {Hash}

Remove condition from Kekule.Reaction#conditions array.
Parameters:
Name Type Description
item Variant Item to find.
role String Role of item, set it to undefined to ignore role in searching. Note: role can be null (not undefined) to search item with no explicit role.
Source:
Returns:
Map object removed or null on failure.
Type
Hash

removeConditionAt(index) → {Hash}

remove condition at index of Kekule.Reaction#conditions array.
Parameters:
Name Type Description
index Int Index in array.
Source:
Returns:
Map object removed or null on failure.
Type
Hash

removeConditionMap(map) → {Hash}

Remove map object from Kekule.Reaction#conditions array.
Parameters:
Name Type Description
map Hash Map to remove.
Source:
Returns:
Map object removed or null on failure.
Type
Hash

removeItem(component, item, role) → {Hash}

Remove map of item/role from the array of component.
Parameters:
Name Type Description
component String Component name, value from Kekule.ReactionComponent.
item Variant Item to find.
role String Role of item, set it to undefined to ignore role in searching. Note: role can be null (not undefined) to search item with no explicit role.
Source:
Returns:
Map removed or null on failure.
Type
Hash

removeMap(component, map) → {Hash}

Remove map from the array of component.
Parameters:
Name Type Description
component String Component name, value from Kekule.ReactionComponent.
map Hash Map to find.
Source:
Returns:
map removed or null on failure.
Type
Hash

removeMapAt(component, index) → {Hash}

remove map at index of a component array.
Parameters:
Name Type Description
component String Component name, value from Kekule.ReactionComponent.
index Int Index in array.
Source:
Returns:
Item removed or null on failure.
Type
Hash

removeMarker(marker)

Remove an attached marker.
Parameters:
Name Type Description
marker Kekule.ChemObject
Inherited From:
Source:

removeMarkerAt(index)

Remove marker at index in attached marker list.
Parameters:
Name Type Description
index Int
Inherited From:
Source:

removeProduct(item, role) → {Hash}

Remove product from Kekule.Reaction#products array.
Parameters:
Name Type Description
item Variant Item to find.
role String Role of item, set it to undefined to ignore role in searching. Note: role can be null (not undefined) to search item with no explicit role.
Source:
Returns:
Map object removed or null on failure.
Type
Hash

removeProductAt(index) → {Hash}

remove product at index of Kekule.Reaction#products array.
Parameters:
Name Type Description
index Int Index in array.
Source:
Returns:
Map object removed or null on failure.
Type
Hash

removeProductMap(map) → {Hash}

Remove map object from Kekule.Reaction#products array.
Parameters:
Name Type Description
map Hash Map to remove.
Source:
Returns:
Map object removed or null on failure.
Type
Hash

removeReactant(item, role) → {Hash}

Remove reactant from Kekule.Reaction#reactants array.
Parameters:
Name Type Description
item Variant Item to find.
role String Role of item, set it to undefined to ignore role in searching. Note: role can be null (not undefined) to search item with no explicit role.
Source:
Returns:
Map object removed or null on failure.
Type
Hash

removeReactantAt(index) → {Hash}

remove reactant at index of Kekule.Reaction#reactants array.
Parameters:
Name Type Description
index Int Index in array.
Source:
Returns:
Map object removed or null on failure.
Type
Hash

removeReactantMap(map) → {Hash}

Remove map object from Kekule.Reaction#reactants array.
Parameters:
Name Type Description
map Hash Map to remove.
Source:
Returns:
Map object removed or null on failure.
Type
Hash

removeSubstance(item, role) → {Hash}

Remove substance from Kekule.Reaction#substances array.
Parameters:
Name Type Description
item Variant Item to find.
role String Role of item, set it to undefined to ignore role in searching. Note: role can be null (not undefined) to search item with no explicit role.
Source:
Returns:
Map object removed or null on failure.
Type
Hash

removeSubstanceAt(index) → {Hash}

remove substance at index of Kekule.Reaction#substances array.
Parameters:
Name Type Description
index Int Index in array.
Source:
Returns:
Map object removed or null on failure.
Type
Hash

removeSubstanceMap(map) → {Hash}

Remove map object from Kekule.Reaction#substances array.
Parameters:
Name Type Description
map Hash Map to remove.
Source:
Returns:
Map object removed or null on failure.
Type
Hash

replaceMarker(oldMarker, newMarker)

Replace oldMarker with new one.
Parameters:
Name Type Description
oldMarker Kekule.ChemObject
newMarker Kekule.ChemObject
Inherited From:
Source:

setMarkerIndex(marker, index)

Change index of marker.
Parameters:
Name Type Description
marker Kekule.ChemObject
index Int
Inherited From:
Source: