chemaxon.struc
Class CNode

java.lang.Object
  extended bychemaxon.struc.CNode
All Implemented Interfaces:
java.lang.Cloneable, java.io.Serializable
Direct Known Subclasses:
MolAtom

public abstract class CNode
extends java.lang.Object
implements java.lang.Cloneable, java.io.Serializable

Node in a chemical graph.

Version:
3.1.4, 06/05/2003
Author:
Peter Csizmadia
See Also:
CGraph, Serialized Form

Field Summary
protected  CEdge[] edges
          The edges.
protected  int nedges
          Number of edges.
 
Constructor Summary
CNode()
           
 
Method Summary
protected  void add(CEdge edge)
          Add an edge if it had not been already added.
abstract  java.lang.Object clone()
          Clones the node.
 CEdge getEdge(int i)
          Gets the i-th edge.
 int getEdgeCount()
          Gets the number of edges/ligands.
 CNode getLigand(int i)
          Get the i-th ligand.
protected  java.lang.Object getLock()
          Get lock object for synchronization.
 CGraph getParent()
          Return the graph that contains this node.
 int indexOf(CEdge edge)
          Returns the index of the specified edge in this node.
 boolean isBoundTo(CNode other)
          Checks if this bond is connected to another one or not.
 void pack()
          Reduce memory usage.
protected  void removeAllEdges()
          Remove all edges.
protected  void removeEdge(CEdge edge)
          Remove an edge by reference.
protected  void removeEdge(int i)
          Remove an edge.
protected static void setNode1(CEdge edge, CNode newnode)
          Sets the first node of an edge.
protected static void setNode2(CEdge edge, CNode newnode)
          Sets the second node of an edge.
 int sringsize()
          Calculate the size of smallest ring containing this atom.
 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

nedges

protected transient int nedges
Number of edges.


edges

protected transient CEdge[] edges
The edges.

Constructor Detail

CNode

public CNode()
Method Detail

getParent

public final CGraph getParent()
Return the graph that contains this node.

Returns:
the parent graph

getEdgeCount

public final int getEdgeCount()
Gets the number of edges/ligands.

Returns:
the number of edges
Since:
2.6

getEdge

public final CEdge getEdge(int i)
Gets the i-th edge.

Parameters:
i - edge index
Returns:
the edge object
Since:
2.6

getLigand

public final CNode getLigand(int i)
Get the i-th ligand.

Parameters:
i - edge index
Returns:
the node at the other end of the edge
Since:
2.6

indexOf

public final int indexOf(CEdge edge)
Returns the index of the specified edge in this node.

Parameters:
edge - edge reference
Returns:
the edge index

isBoundTo

public final boolean isBoundTo(CNode other)
Checks if this bond is connected to another one or not.

Parameters:
other - the other node
Returns:
true if the two nodes are connected with a bound, false otherwise

sringsize

public final int sringsize()
Calculate the size of smallest ring containing this atom.

Returns:
the SRS or Integer.MAX_VALUE if ring not found

pack

public void pack()
Reduce memory usage.


clone

public abstract java.lang.Object clone()
Clones the node.

Returns:
a node object with the same properties

toString

public java.lang.String toString()
Overrides Object.toString() to ease debugging. Returns a string consisting of the classname (without the package name!), the at-sign character `@', and the unsigned hexadecimal representation of the hash code of the object.

Returns:
a string representation of the object

add

protected void add(CEdge edge)
Add an edge if it had not been already added.

Parameters:
edge - the edge to add

removeAllEdges

protected void removeAllEdges()
Remove all edges.


removeEdge

protected void removeEdge(int i)
Remove an edge.

Parameters:
i - edge index

removeEdge

protected void removeEdge(CEdge edge)
Remove an edge by reference.

Parameters:
edge - edge reference to remove

getLock

protected final java.lang.Object getLock()
Get lock object for synchronization.

Returns:
reference to the top parent graph

setNode1

protected static void setNode1(CEdge edge,
                               CNode newnode)
Sets the first node of an edge. Use it from derived classes.

Parameters:
edge - the edge
newnode - the new node value

setNode2

protected static void setNode2(CEdge edge,
                               CNode newnode)
Sets the second node of an edge. Use it from derived classes.

Parameters:
edge - the edge
newnode - the new node value