toxTree.tree
Class DecisionNode

java.lang.Object
  extended by java.util.Observable
      extended by toxTree.tree.DecisionNode
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable, java.util.Observer, IDecisionRule, IDecisionTransition
Direct Known Subclasses:
MultiLabelDecisionNode

public class DecisionNode
extends java.util.Observable
implements IDecisionRule, IDecisionTransition, java.util.Observer

A decision node to be used in UserDefinedTree. Implements IDecisionRule and IDecisionTransition.

A decision node consists of a rule IDecisionRule and decision nodes DecisionNode to be followed, or categories IDecisionCategory to be assigned if the rule provides YES or NO answer.

Version:
0.1, 2005-5-2
Author:
Nina Jeliazkova
See Also:
Serialized Form

Field Summary
protected  IDecisionCategory[] categories
           
protected  DecisionNode[] nodes
           
protected  IDecisionRule rule
           
protected  boolean visited
           
 
Constructor Summary
DecisionNode()
          Constructor
DecisionNode(IDecisionRule rule)
          Constructs a decision node with rule, null next nodes.
DecisionNode(IDecisionRule rule, DecisionNode nodeNo, DecisionNode nodeYes)
          Constructs a decision node with rule, nodeNo at branch NO and nodeYes at branch YES.
DecisionNode(IDecisionRule rule, DecisionNode nodeNo, DecisionNode nodeYes, IDecisionCategory categoryNo, IDecisionCategory categoryYes)
           
 
Method Summary
 void addPropertyChangeListener(java.beans.PropertyChangeListener l)
           
 void clearFlags(org.openscience.cdk.interfaces.IAtomContainer mol)
          When rules analyze a molecule, a set of properties are set.
 java.lang.Object clone()
           
 boolean equals(java.lang.Object obj)
           
 IDecisionRule getBranch(boolean answer)
          returns the decision rule at the branch No if answer==false or the decision rule at the branch Yes if answer =true
 IDecisionCategory[] getCategories()
           
 IDecisionCategory getCategory(boolean answer)
          returns the decision category at the branch No if answer==false or the category at the branch Yes if answer =true
 IDecisionRuleEditor getEditor()
          Each rule provides an editor, which is a class implementing IDecisionRuleEditor.
 org.openscience.cdk.interfaces.IMolecule getExampleMolecule(boolean ruleResult)
          if ruleResult is TRUE, returns the example molecule if the rule is answered YES if ruleResult is FALSE, returns the example molecule if the rule is answered NO
 java.lang.String getExplanation()
          Rule explanation is an arbitrary text, could be multiline and may contain html tags.
 java.lang.String getID()
          Rule identifier is an arbitrary string, preferably short one
 DecisionNode[] getNodes()
           
 int getNum()
           
 IDecisionRule getRule()
           
 ambit2.base.interfaces.IProcessor<org.openscience.cdk.interfaces.IAtomContainer,org.openscience.cdk.renderer.selection.IChemObjectSelection> getSelector()
           
 java.lang.String getTitle()
          Rule name is an arbitrary string, preferably one line, reflecting the essence of the rule
(e.g.
 void hideResiduesID(boolean hide)
           
 boolean isEditable()
           
 boolean isImplemented()
           
 boolean isResidueIDHidden()
           
 boolean isVisited()
           
 void removePropertyChangeListener(java.beans.PropertyChangeListener l)
           
 void setBranch(boolean answer, IDecisionRule node)
          Sets the decision rule at the branch No if answer==false or the decision rule at the branch Yes if answer =true
 void setCategories(IDecisionCategory[] categories)
           
 void setCategory(boolean answer, IDecisionCategory category)
          /** Sets the category at the branch No if answer==false or the category at the branch Yes if answer =true
 void setEditable(boolean value)
           
 void setExampleMolecule(org.openscience.cdk.interfaces.IAtomContainer mol, boolean ruleResult)
          Sets example molecule for the YES or NO answer of the rule
 void setExplanation(java.lang.String message)
          Sets rule explanation
 void setID(java.lang.String id)
          Sets rule identifier
 void setNodes(DecisionNode[] nodes)
           
 void setNum(int no)
           
 void setRule(IDecisionRule rule)
          Sets rule
 void setTitle(java.lang.String name)
          Sets rule name
 void setVisited(boolean visited)
           
 java.lang.String toString()
           
 java.lang.String toString(boolean verbose)
          Returns string representation of the decision node if (verbose) returns getId() + "." + getName() else returns "Q"+getId();
 void update(java.util.Observable arg0, java.lang.Object arg1)
           
 boolean verifyRule(org.openscience.cdk.interfaces.IAtomContainer mol)
          This is the core of a IDecisionRule behaviour.
 
Methods inherited from class java.util.Observable
addObserver, clearChanged, countObservers, deleteObserver, deleteObservers, hasChanged, notifyObservers, notifyObservers, setChanged
 
Methods inherited from class java.lang.Object
finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

rule

protected IDecisionRule rule

nodes

protected DecisionNode[] nodes

categories

protected IDecisionCategory[] categories

visited

protected transient boolean visited
Constructor Detail

DecisionNode

public DecisionNode()
Constructor


DecisionNode

public DecisionNode(IDecisionRule rule)
Constructs a decision node with rule, null next nodes.

Parameters:
rule -

DecisionNode

public DecisionNode(IDecisionRule rule,
                    DecisionNode nodeNo,
                    DecisionNode nodeYes)
Constructs a decision node with rule, nodeNo at branch NO and nodeYes at branch YES. Categories are assigned null value.

Parameters:
rule -
nodeNo -
nodeYes -

DecisionNode

public DecisionNode(IDecisionRule rule,
                    DecisionNode nodeNo,
                    DecisionNode nodeYes,
                    IDecisionCategory categoryNo,
                    IDecisionCategory categoryYes)
Parameters:
rule - - the rule
nodeNo - - the node at branch "No"
nodeYes - - the node at branch "Yes"
categoryNo - - the Category at branch "No"
categoryYes - - the Category at branch "Yes"
Method Detail

isEditable

public boolean isEditable()
Specified by:
isEditable in interface IDecisionRule

setEditable

public void setEditable(boolean value)
Specified by:
setEditable in interface IDecisionRule

getRule

public IDecisionRule getRule()
Returns:
rule

setRule

public void setRule(IDecisionRule rule)
Sets rule

Parameters:
rule -

getBranch

public IDecisionRule getBranch(boolean answer)
returns the decision rule at the branch No if answer==false or the decision rule at the branch Yes if answer =true

Specified by:
getBranch in interface IDecisionTransition

setBranch

public void setBranch(boolean answer,
                      IDecisionRule node)
Sets the decision rule at the branch No if answer==false or the decision rule at the branch Yes if answer =true

Parameters:
answer - - selects which branch to be set
node - - the next node to set

getCategory

public IDecisionCategory getCategory(boolean answer)
returns the decision category at the branch No if answer==false or the category at the branch Yes if answer =true

Specified by:
getCategory in interface IDecisionTransition

setCategory

public void setCategory(boolean answer,
                        IDecisionCategory category)
/** Sets the category at the branch No if answer==false or the category at the branch Yes if answer =true

Parameters:
answer -
category -

toString

public java.lang.String toString(boolean verbose)
Returns string representation of the decision node if (verbose) returns getId() + "." + getName() else returns "Q"+getId();

Parameters:
verbose -
Returns:
String

toString

public java.lang.String toString()
Specified by:
toString in interface IDecisionRule
Overrides:
toString in class java.lang.Object

getExampleMolecule

public org.openscience.cdk.interfaces.IMolecule getExampleMolecule(boolean ruleResult)
                                                            throws DecisionMethodException
Description copied from interface: IDecisionRule
if ruleResult is TRUE, returns the example molecule if the rule is answered YES if ruleResult is FALSE, returns the example molecule if the rule is answered NO

Specified by:
getExampleMolecule in interface IDecisionRule
Returns:
org.openscience.cdk.interfaces.Molecule
Throws:
DecisionMethodException

getExplanation

public java.lang.String getExplanation()
Description copied from interface: IDecisionRule
Rule explanation is an arbitrary text, could be multiline and may contain html tags.

Specified by:
getExplanation in interface IDecisionRule
Returns:
explanation

getID

public java.lang.String getID()
Description copied from interface: IDecisionRule
Rule identifier is an arbitrary string, preferably short one

Specified by:
getID in interface IDecisionRule
Returns:
the rule identifier

getTitle

public java.lang.String getTitle()
Description copied from interface: IDecisionRule
Rule name is an arbitrary string, preferably one line, reflecting the essence of the rule
(e.g. "Is aromatic")

Specified by:
getTitle in interface IDecisionRule
Returns:
rule name

getNum

public int getNum()
Specified by:
getNum in interface IDecisionRule

isImplemented

public boolean isImplemented()
Specified by:
isImplemented in interface IDecisionRule
Returns:
false if the rule is not implemented and true if it is

setExampleMolecule

public void setExampleMolecule(org.openscience.cdk.interfaces.IAtomContainer mol,
                               boolean ruleResult)
Description copied from interface: IDecisionRule
Sets example molecule for the YES or NO answer of the rule

Specified by:
setExampleMolecule in interface IDecisionRule
Parameters:
mol - org.openscience.cdk.interfaces.Molecule

addPropertyChangeListener

public void addPropertyChangeListener(java.beans.PropertyChangeListener l)
Specified by:
addPropertyChangeListener in interface IDecisionRule

removePropertyChangeListener

public void removePropertyChangeListener(java.beans.PropertyChangeListener l)
Specified by:
removePropertyChangeListener in interface IDecisionRule

setExplanation

public void setExplanation(java.lang.String message)
Description copied from interface: IDecisionRule
Sets rule explanation

Specified by:
setExplanation in interface IDecisionRule

setID

public void setID(java.lang.String id)
Description copied from interface: IDecisionRule
Sets rule identifier

Specified by:
setID in interface IDecisionRule

setTitle

public void setTitle(java.lang.String name)
Description copied from interface: IDecisionRule
Sets rule name

Specified by:
setTitle in interface IDecisionRule

setNum

public void setNum(int no)
Specified by:
setNum in interface IDecisionRule

verifyRule

public boolean verifyRule(org.openscience.cdk.interfaces.IAtomContainer mol)
                   throws DecisionMethodException
Description copied from interface: IDecisionRule
This is the core of a IDecisionRule behaviour. The method returns true if the answer of the rule is YES for the analyzed molecule org.openscience.cdk.interfaces.AtomContainer and FALSE if the answer of the rule is NO for the analyzed molecule org.openscience.cdk.interfaces.AtomContainer??

Specified by:
verifyRule in interface IDecisionRule
Parameters:
mol - org.openscience.cdk.interfaces.AtomContainer
Returns:
rule result, boolean
Throws:
DecisionMethodException

isVisited

public boolean isVisited()
Returns:
Returns the visited.

setVisited

public void setVisited(boolean visited)
Parameters:
visited - The visited to set.

clearFlags

public void clearFlags(org.openscience.cdk.interfaces.IAtomContainer mol)
Description copied from interface: IDecisionRule
When rules analyze a molecule, a set of properties are set. This method provides a way to clear the properties. Could be moved in a different class in a later release

Specified by:
clearFlags in interface IDecisionRule
Parameters:
mol - org.openscience.cdk.interfaces.Molecule

hideResiduesID

public void hideResiduesID(boolean hide)
Specified by:
hideResiduesID in interface IDecisionRule

isResidueIDHidden

public boolean isResidueIDHidden()
Specified by:
isResidueIDHidden in interface IDecisionRule

getEditor

public IDecisionRuleEditor getEditor()
Description copied from interface: IDecisionRule
Each rule provides an editor, which is a class implementing IDecisionRuleEditor. The editor shall provide user interface for visualization and modification of various rule settings.

Specified by:
getEditor in interface IDecisionRule
Returns:
IDecisionRuleEditor

clone

public java.lang.Object clone()
                       throws java.lang.CloneNotSupportedException
Specified by:
clone in interface IDecisionRule
Overrides:
clone in class java.lang.Object
Throws:
java.lang.CloneNotSupportedException

equals

public boolean equals(java.lang.Object obj)
Overrides:
equals in class java.lang.Object

update

public void update(java.util.Observable arg0,
                   java.lang.Object arg1)
Specified by:
update in interface java.util.Observer

getCategories

public IDecisionCategory[] getCategories()

setCategories

public void setCategories(IDecisionCategory[] categories)

getNodes

public DecisionNode[] getNodes()

setNodes

public void setNodes(DecisionNode[] nodes)

getSelector

public ambit2.base.interfaces.IProcessor<org.openscience.cdk.interfaces.IAtomContainer,org.openscience.cdk.renderer.selection.IChemObjectSelection> getSelector()
Specified by:
getSelector in interface IDecisionRule


Copyright © 2004-2012 Ideaconsult Ltd.. All Rights Reserved.