cage
Class ValencyElementRule

java.lang.Object
  extended by cage.ValencyElementRule
All Implemented Interfaces:
ElementRule

public class ValencyElementRule
extends java.lang.Object
implements ElementRule

An implementation of ElementRule that deduces the element of atom based on the degree of the corresponding vertex.


Constructor Summary
ValencyElementRule(java.lang.String elementRule)
          Create a new ValencyElementRule object based on elementRule.
 
Method Summary
 java.lang.String getElement(EmbeddableGraph graph, int vertex)
          Returns the chemical symbol of the chemical element of the atom corresponding with vertex in graph by looking up the element for the degree of vertex.
static void main(java.lang.String[] argv)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ValencyElementRule

public ValencyElementRule(java.lang.String elementRule)
Create a new ValencyElementRule object based on elementRule. This string is a set of rules seperated by whitespaces. Each rule is formatted as follows: [degree:]element. The degree is optional in this format. If no degree is given, then the element corresponds with the first free degree starting from the last degree for which a rule was added. Only one element per degree is possible and in case more than one element is given for the same degree, only the last one will be remembered.

Parameters:
elementRule - A string containing the rules for this object.
Method Detail

getElement

public java.lang.String getElement(EmbeddableGraph graph,
                                   int vertex)
Returns the chemical symbol of the chemical element of the atom corresponding with vertex in graph by looking up the element for the degree of vertex.

Specified by:
getElement in interface ElementRule
Parameters:
graph - The graph that contains the vertex
vertex - The vertex for which the element is requested
Returns:
The symbol of the element of vertex

main

public static void main(java.lang.String[] argv)