|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectchemaxon.struc.CGraph
public abstract class CGraph
Chemical graph.
CNode,
CEdge,
Serialized Form| Field Summary | |
|---|---|
protected int[][] |
btab
Bond table. |
static int |
CACHE_REMOVE_ALL
Cache removal option for clearing all cached info. |
static int |
CACHE_REMOVE_CACHEMEMORY
Cache removal option for cacheMemory. |
protected java.util.List |
cacheMemory
|
protected int[][] |
cssr
CSSR ring node indexes. |
protected int[][] |
ctab
Connection table. |
protected int |
edgeCount
The number of edges. |
protected CEdge[] |
edges
The edges (bonds). |
protected int[] |
fragIds
Fragment identifiers. |
protected int[] |
grinv
Graph invariants. |
protected long |
grinvCC
Graph invariant change count. |
protected int |
grinvOptions
Options used to last calculate grinv. |
protected static int |
INITIAL_CAPACITY
Initial capacity of the nodes and edges vectors. |
protected int |
nFrags
Number of disconnected fragments. |
protected int |
nGrinv
Number of different graph invariants. |
protected int |
nodeCount
The number of nodes. |
protected CNode[] |
nodes
The nodes (atoms). |
protected CGraph |
parentGraph
The structure that contains this graph as a substructure. |
static int |
RMCLEANUP_ALL
Perform all clean-up methods when removing a node or an edge. |
static int |
RMCLEANUP_EDGES
When removing a node or an edge, also remove the edge(s) from the node object(s). |
protected static int |
RMCLEANUP_FIXCOMPONENT
Remove called from RxnMolecule.fixComponent. |
static int |
RMCLEANUP_NONE
Do not perform any clean-up methods when removing a node or an edge. |
protected int[][] |
sssr
SSSR ring node indexes. |
protected int[][] |
sssr2idx
|
protected int[] |
sssrl2idx
|
protected CGraph |
superGraph
Parent of all parents. |
| Constructor Summary | |
|---|---|
protected |
CGraph(CGraph p,
int n,
int e)
Constructs a fragment with the specified number of nodes and edges |
| Method Summary | |
|---|---|
void |
add(CEdge edge)
Adds an edge to the graph. |
void |
add(CNode node)
Adds a node to the graph. |
protected void |
addEdge0(CEdge edge)
Adds an edge. |
protected int |
addEdgeWithoutChangingIt(CEdge edge)
Adds an edge without setting its parentGraph and index fields. |
protected void |
addNode0(CNode node)
Adds a node. |
protected int |
addNodeWithoutChangingIt(CNode node)
Adds a node without setting its parentGraph and index fields. |
void |
checkConsistency()
Checks the internal consistency of the structure. |
protected void |
checkEdgeConsistency()
|
void |
clearCachedInfo(int options)
Deletes the cached information depending on the given options. |
abstract java.lang.Object |
clone()
Makes an identical copy of the molecule. |
protected void |
clonecopy(CGraph graph)
Copies the clones of nodes and edges of this graph to another one. |
protected boolean |
clonecopyCGraphWithoutSgroups(int[] cnodes,
CEdge[] cedges,
int nb,
CGraph graph)
Copies the specified nodes and edges of this graph to another one. |
void |
clonelesscopy(CGraph graph)
Copy to selection. |
boolean |
contains(CEdge edge)
Checks if the graph contains the specified edge. |
boolean |
contains(CGraph graph)
Does the graph contain the specified fragment? |
boolean |
contains(CNode node)
Checks if the graph contains the specified node. |
CGraph[] |
findBasicFrags(java.lang.Class cl)
Determines the disconnected fragments and puts them into an array. |
int[] |
findComponentIds()
Assigns a component ID to each connected component. |
int[] |
findComponentIds(int[] inds)
Assigns a component ID to each connected component formed by the specified atom indexes. |
protected int |
findEdge(CEdge edge)
Finds an edge in the edgess array. |
void |
findFrag(int i,
CGraph frag)
Determines the subgraph connected to the specified node. |
void |
findFragById(int fragId,
CGraph frag)
Determines the subgraph corresponding to the specific fragment ID. |
CGraph[] |
findFrags(java.lang.Class cl)
Determines the disconnected fragments and puts them into an array. |
protected static int |
findInArray(java.lang.Object[] array,
int[] indices,
int n,
java.lang.Object o)
Finds an object in an array. |
protected int |
findNode(CNode node)
Finds a node in the nodes array. |
void |
fuse(CGraph graph)
Adds those nodes and edges of a graph to this one that are not already elements. |
void |
fuse(CGraph graph,
boolean check)
Adds nodes and edges of a graph to this one. |
protected void |
fuse0(CGraph graph)
Adds those nodes and edges of a graph to this one that are not already elements. |
protected void |
fuse0(CGraph graph,
boolean check)
Adds nodes and edges of a graph to this one. |
int[][] |
getBtab()
Gets the edge (bond) table. |
int[][] |
getCSSR()
Gets the Complete Set of Smallest Ring node indexes array. |
int[][] |
getCtab()
Gets the connection table. |
CEdge |
getEdge(int i)
Gets an edge. |
CEdge[] |
getEdgeArray()
Creates an array of edges. |
int |
getEdgeCount()
Gets the number of edges. |
protected static java.util.List |
getEdgeList(CNode[] nodes,
int na)
Gets the list of edges for the specified nodes. |
java.util.Vector |
getEdgeVector()
Gets the edges. |
CGraph |
getForefather()
Gets the first parent. |
int |
getFragCount()
Returns the number of fragments. |
int[] |
getFragIds()
Gets an array containing the fragment id for each node. |
protected int[] |
getGrinv()
Gets the graph invariants array. |
int |
getGrinv(int[] gi)
Gets the graph invariants. |
long |
getGrinvCC()
Gets the graph invariant change count. |
java.lang.Object |
getLock()
Gets the lock object for synchronization. |
CNode |
getNode(int i)
Gets a node. |
int |
getNodeCount()
Gets the number of nodes. |
java.util.Vector |
getNodeVector()
Gets the nodes. |
CGraph |
getParent()
Gets the parent graph that contains this substructure. |
int[] |
getSmallestRingSizeForIdx()
Get the smallest ring size in which the atom (specified with it's index) can be located. |
int[][] |
getSSSR()
Gets the Smallest Set of Smallest Ring node indexes array. |
int[][] |
getSSSREdges()
Gets the Smallest Set of Smallest Ring edge indexes array. |
int[][] |
getSSSRIdxesForAtoms()
Get the sssr ring indexes in which the atom (specified with it's index) can be located. |
protected void |
incGrinvCC()
Increases the graph invariant change count and sets grinv to null. |
void |
incGrinvCCOnly()
Increases the graph invariant change count, but does not change grinv. |
int |
indexOf(CEdge edge)
Gets the index of the specified edge. |
int |
indexOf(CNode node)
Gets the index of the specified node. |
void |
insertEdge(int i,
CEdge edge)
Inserts the edge at the specified index. |
void |
insertEdgeInOrder(CEdge e,
CEdge[] order)
Insert an edge in the order specified as the second argument. |
void |
insertNode(int i,
CNode node)
Inserts the node at the specified index. |
protected void |
insertNullEdges(int i,
int count)
Insert nulls into the bond array. |
protected void |
insertNullNodes(int i,
int count)
Insert nulls into the atom array. |
boolean |
isEmpty()
Tests whether the graph is empty. |
protected boolean |
isGrinvCCValid()
Tests whether the graph invariant change count is valid. |
protected void |
isolate(CEdge edge)
Isolates edge: a more efficient way of removing an edge than removeEdge(chemaxon.struc.CEdge), especially for large graphs. |
protected void |
isolate(CNode node)
Isolates node: a more efficient way of removing a node than removeNode(chemaxon.struc.CNode), especially for large graphs. |
protected boolean |
isRealNodeParent()
Can it be a real node parent? |
boolean |
isRing()
Tests whether the graph represents a ring. |
boolean |
isSimilarTo(CGraph g)
Checks if the graph is similar to another graph. |
boolean |
isSymmetric()
Tests whether the graph is symmetric. |
protected void |
makeItSimilar(CGraph g)
Empty method. |
protected int |
mergeFrags(int fragId1,
int fragId2)
Merges two fragments. |
void |
mergeNodes(CNode that,
CNode a)
Merges edges of a node with another node, then adds the node to the molecule. |
abstract CGraph |
newInstance()
Creates a new CGraph object. |
void |
pack()
Reduce memory usage. |
protected void |
regenCtabs()
Regenerates connection table and edge table. |
void |
regenEdges()
Regenerates the edge vector: remove its elements, then put the edge objects from the nodes into it. |
protected void |
regenFragIds()
Searches the disconnected fragments. |
void |
removeAll()
Removes all the nodes and edges. |
void |
removeAllEdges()
Removes all edges. |
void |
removeEdge(CEdge edge)
Removes an edge by reference. |
protected void |
removeEdge(CEdge edge,
int cleanupFlags)
Removes an edge by reference. |
void |
removeEdge(int i)
Removes an edge from the graph. |
protected void |
removeEdge(int i,
int cleanupFlags)
Removes an edge from the graph. |
protected void |
removeIsolatedEdges()
Removes the null edge entries in the edges array
and sets the index fields appropriately. |
protected void |
removeIsolatedNodes()
Removes the null node entries in the nodes array
and sets the index fields appropriately. |
void |
removeNode(CNode node)
Removes a node and its edges. |
void |
removeNode(CNode node,
int cleanupFlags)
Removes a node and its edges with extra clean-up options. |
void |
removeNode(int i)
Removes a node and its edges from the graph. |
void |
removeNode(int i,
int cleanupFlags)
Removes a node and its edges with extra clean-up options. |
void |
replaceEdge(CEdge olde,
CEdge newe)
Replaces an edge by another one. |
protected void |
resetCtab()
An operation performed that changed the connection table and the graph invariants. |
protected void |
resetGrinvInParents()
Graph invariants must be recalculated for this graph and all parent graphs. |
protected java.lang.Object[] |
restoreCache(int n)
Restores caches like connection table, bond table, etc. |
protected java.lang.Object[] |
saveCache(int n)
Saves caches like connection table, bond table, etc. |
void |
setEdge(int i,
CEdge edge)
Sets the edge at the specified index. |
protected void |
setGrinvCC(long g)
Sets the graph invariant change count. |
void |
setNode(int i,
CNode node)
Sets the node at the specified index. |
protected void |
setNode0(int i,
CNode node)
Sets the node at the specified index. |
void |
sortEdgesAccordingTo(CEdge[] order)
Sorts edges in the same order as they appear in another chemical graph. |
java.lang.String |
toString()
Overrides Object.toString() to ease debugging. |
| Methods inherited from class java.lang.Object |
|---|
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
protected static final int INITIAL_CAPACITY
public static final int RMCLEANUP_NONE
removeNode(CNode, int),
removeNode(int, int),
removeEdge(CEdge, int),
removeEdge(int, int),
Constant Field Valuesprotected static final int RMCLEANUP_FIXCOMPONENT
RMCLEANUP_ALL,
Constant Field Valuespublic static final int RMCLEANUP_ALL
removeNode(CNode, int),
removeNode(int, int),
removeEdge(CEdge, int),
removeEdge(int, int),
Constant Field Valuespublic static final int RMCLEANUP_EDGES
removeNode(CNode, int),
removeNode(int, int),
removeEdge(CEdge, int),
removeEdge(int, int),
Constant Field Valuespublic static final int CACHE_REMOVE_ALL
clearCachedInfo(int),
Constant Field Valuespublic static final int CACHE_REMOVE_CACHEMEMORY
cacheMemory,
clearCachedInfo(int),
Constant Field Valuesprotected transient CGraph superGraph
protected transient CGraph parentGraph
protected transient CNode[] nodes
protected transient int nodeCount
protected transient CEdge[] edges
protected transient int edgeCount
protected transient int[][] sssr
protected transient int[][] cssr
protected transient int[][] ctab
protected transient int[][] btab
protected transient int[] fragIds
protected transient int nFrags
protected transient int[] grinv
protected int grinvOptions
grinv.
protected transient int nGrinv
protected transient long grinvCC
protected transient java.util.List cacheMemory
protected transient int[] sssrl2idx
protected transient int[][] sssr2idx
| Constructor Detail |
|---|
protected CGraph(CGraph p,
int n,
int e)
p - the parent graph or nulln - no reallocation needed until the number of nodes is less than
this valuee - no reallocation needed until the number of edges is less than
this value| Method Detail |
|---|
protected boolean isRealNodeParent()
public java.util.Vector getNodeVector()
public java.util.Vector getEdgeVector()
public int getNodeCount()
public CNode getNode(int i)
i - node index
public void setNode(int i,
CNode node)
i - node indexnode - new node reference
public final void insertNode(int i,
CNode node)
i - node indexnode - new node reference
protected void insertNullNodes(int i,
int count)
i - starting indexcount - number of new entries
public final void insertEdge(int i,
CEdge edge)
i - edge indexedge - new edge reference
public void insertEdgeInOrder(CEdge e,
CEdge[] order)
e - the edge to insertorder - array of edges defining the order
protected void insertNullEdges(int i,
int count)
i - starting indexcount - number of new entriespublic int getEdgeCount()
public CEdge getEdge(int i)
i - edge index
public void setEdge(int i,
CEdge edge)
i - edge indexedge - the edge reference
public void replaceEdge(CEdge olde,
CEdge newe)
olde - the old edgenewe - the new edgepublic void add(CNode node)
node - the node objectpublic void add(CEdge edge)
edge - the edge objectpublic void removeNode(CNode node)
node - the nodepublic void removeNode(int i)
i - the node indexpublic void removeEdge(CEdge edge)
edge - the edgepublic void removeEdge(int i)
i - the edge indexpublic void removeAllEdges()
public void removeAll()
protected void isolate(CNode node)
removeNode(chemaxon.struc.CNode), especially for large graphs.
Removes the node but instead of shifting the nodes array,
simply sets the corresponding entry to null.
After isolating some nodes, call removeIsolatedNodes() to get a valid graph.
node - the nodeprotected void isolate(CEdge edge)
removeEdge(chemaxon.struc.CEdge), especially for large graphs.
Removes the edge but instead of shifting the edges array,
simply sets the corresponding entry to null.
After isolating some edges, call removeIsolatedEdges() to get a valid graph.
edge - the edgeprotected void removeIsolatedNodes()
null node entries in the nodes array
and sets the index fields appropriately. Clean-up method after
calling isolate(chemaxon.struc.CNode) for some nodes.
protected void removeIsolatedEdges()
null edge entries in the edges array
and sets the index fields appropriately. Clean-up method after
calling isolate(chemaxon.struc.CEdge) for some edges.
public void regenEdges()
protected static java.util.List getEdgeList(CNode[] nodes,
int na)
nodes - the nodesna - the number of nodes
public CEdge[] getEdgeArray()
public void sortEdgesAccordingTo(CEdge[] order)
order - the edges in the other graphpublic int indexOf(CNode node)
node - the node
public int indexOf(CEdge edge)
edge - the edge
public boolean contains(CNode node)
node - the node object
public boolean contains(CEdge edge)
edge - the edge object
public boolean isEmpty()
true if the graph does not contain any nodes or
edges, false otherwisepublic boolean isSimilarTo(CGraph g)
true if the graphs are similar,
false otherwiseCNode.haveEqualProperties(CNode),
CNode.haveSimilarEdges(CNode)public boolean isRing()
public boolean isSymmetric()
public void removeNode(CNode node,
int cleanupFlags)
removeNode(CNode)
instead unless you are sure what you are doing.
node - the nodecleanupFlags - extra clean-up methodsRMCLEANUP_NONE,
RMCLEANUP_ALL,
RMCLEANUP_EDGES
public void removeNode(int i,
int cleanupFlags)
removeNode(int)
instead unless you are sure what you are doing.
i - the node indexcleanupFlags - extra clean-up methodsRMCLEANUP_NONE,
RMCLEANUP_ALL,
RMCLEANUP_EDGES
protected void removeEdge(CEdge edge,
int cleanupFlags)
edge - the edgecleanupFlags - extra clean-up methodsRMCLEANUP_NONE,
RMCLEANUP_ALL,
RMCLEANUP_EDGES
protected void removeEdge(int i,
int cleanupFlags)
i - the edge indexcleanupFlags - extra clean-up methodsRMCLEANUP_NONE,
RMCLEANUP_ALL,
RMCLEANUP_EDGESprotected final void fuse0(CGraph graph)
fuse0(chemaxon.struc.CGraph, boolean) instead.
graph - the graph
protected void fuse0(CGraph graph,
boolean check)
graph - the graphcheck - true if a containment check should be performed to ensure that
only those nodes and edges are added that are not already elements -
false if the graph is known to be disjoint from this graph and
this check can be safely skippedpublic final void fuse(CGraph graph)
fuse(chemaxon.struc.CGraph, boolean) instead.
graph - the other graph
public void fuse(CGraph graph,
boolean check)
graph - the graphcheck - true if a containment check should be performed to ensure that
only those nodes and edges are added that are not already elements -
false if the graph is known to be disjoint from this graph and
this check can be safely skipped
public void mergeNodes(CNode that,
CNode a)
that - the nodea - the other nodepublic boolean contains(CGraph graph)
graph - the fragment
protected void clonecopy(CGraph graph)
graph - the target graph
protected boolean clonecopyCGraphWithoutSgroups(int[] cnodes,
CEdge[] cedges,
int nb,
CGraph graph)
cnodes - array of node indices to copy or nullcedges - array of edges to copy
or null to copy edges in cnodes onlynb - number of edgesgraph - the target graph
false if the nodes array contains all edge end
points, true if there is at least one external
bondpublic void clonelesscopy(CGraph graph)
graph - the target graph (the selection)public abstract java.lang.Object clone()
clone in class java.lang.Objectpublic java.lang.String toString()
@', and the unsigned
hexadecimal representation of the hash code of the object.
If the graph is not empty, then the string also contains the
number of nodes and edges in "[Na,Mb]" form.
toString in class java.lang.Objectpublic final int[][] getSSSR()
public final int[][] getCSSR()
public final int[][] getSSSREdges()
public int[][] getCtab()
public int[][] getBtab()
public int getGrinv(int[] gi)
gi - the output array
protected int[] getGrinv()
public final long getGrinvCC()
protected final void setGrinvCC(long g)
g - graph invariant change countprotected final void incGrinvCC()
public final void incGrinvCCOnly()
protected final void resetGrinvInParents()
public final int[] findComponentIds()
i)public final int[] findComponentIds(int[] inds)
inds - node index array, null means all nodes
inds[i]
or node i if the node index array is null)public final int getFragCount()
public final int[] getFragIds()
public final CGraph[] findBasicFrags(java.lang.Class cl)
cl - create fragment objects of this class
public CGraph[] findFrags(java.lang.Class cl)
cl - create fragment objects of this class
public final void findFrag(int i,
CGraph frag)
i - node indexfrag - add the nodes and edges to this CGraph
public final void findFragById(int fragId,
CGraph frag)
fragId - fragment IDfrag - add the nodes and edges to this CGraphgetFragIds()public final java.lang.Object getLock()
public final CGraph getParent()
public final CGraph getForefather()
public void pack()
public abstract CGraph newInstance()
protected void makeItSimilar(CGraph g)
g - a CGraph objectprotected void resetCtab()
protected final int findNode(CNode node)
protected final int findEdge(CEdge edge)
protected void regenCtabs()
protected void regenFragIds()
protected final int mergeFrags(int fragId1,
int fragId2)
fragId1 - first fragmentfragId2 - second fragment
protected void addNode0(CNode node)
node - the node referenceprotected final int addNodeWithoutChangingIt(CNode node)
node - the node reference
protected void setNode0(int i,
CNode node)
i - node indexnode - new node referenceprotected void addEdge0(CEdge edge)
edge - the edge referenceprotected final int addEdgeWithoutChangingIt(CEdge edge)
edge - the edge reference
protected java.lang.Object[] saveCache(int n)
protected java.lang.Object[] restoreCache(int n)
public void checkConsistency()
java.lang.RuntimeException - if inconsistency foundprotected void checkEdgeConsistency()
protected static final int findInArray(java.lang.Object[] array,
int[] indices,
int n,
java.lang.Object o)
array - the arrayindices - array indices or nulln - the number of elements
public void clearCachedInfo(int options)
options - options for the cache clearingCACHE_REMOVE_ALL,
CACHE_REMOVE_CACHEMEMORYpublic int[] getSmallestRingSizeForIdx()
public int[][] getSSSRIdxesForAtoms()
protected boolean isGrinvCCValid()
true
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||