toxTree.tree.rules
Class RuleVerifyProperty
java.lang.Object
java.util.Observable
toxTree.tree.AbstractRule
toxTree.tree.rules.RuleVerifyProperty
- All Implemented Interfaces:
- java.io.Serializable, java.lang.Cloneable, IDecisionInteractive, IDecisionRule, IImplementationDetails, XMLSerializable
- Direct Known Subclasses:
- RuleAqueousSolubility, RuleInitAlertCounter, RuleLipidSolubility, RuleLogP, RuleMeltingPoint, RuleMolWeight, RuleSurfaceTension, RuleVapourPressure, RuleVerifyIntake
public class RuleVerifyProperty
- extends AbstractRule
- implements IDecisionInteractive, IImplementationDetails
Verifies if property is >, < or = to a getProperty()
value.
Property to be read as IMolecule
.getProperty(getPropertyName()
).
If there exist no such property of the molecule, a inputProperty(IAtomContainer)
method is invoked, which typically waits for user input of the property value.
If the property is not assigned after inputProperty(IAtomContainer)
call, then DRuleNotImplemented
is fired.
- Author:
- Nina Jeliazkova nina@acad.bg, Martin Martinov
Modified Dec 17, 2006
- See Also:
- Serialized Form
Fields inherited from class toxTree.tree.AbstractRule |
changes, editable, ERR_STRUCTURENOTPREPROCESSED, examples, explanation, id, logger, MSG_NO, MSG_YES, no, residueIDHidden, title |
Fields inherited from interface toxTree.core.XMLSerializable |
xmltag_CATEGORIES, xmltag_CATEGORY, xmltag_CATEGORYTHRESHOLD, xmltag_CLASS, xmltag_EXPLANATION, xmltag_ID, xmltag_METHOD, xmltag_METHODPARAMETER, xmltag_METHODS, xmltag_NAME, xmltag_RULE, xmltag_RULEEXAMPLE, xmltag_RULES, xmltag_TREEROOT |
Method Summary |
boolean |
compare(double Param1,
double Param2)
|
java.lang.String |
getCaption()
|
java.lang.String |
getCondition()
|
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 |
getImplementationDetails()
|
boolean |
getInteractive()
|
java.beans.PropertyChangeListener |
getListener()
|
IDecisionInteractive.UserOptions |
getOptions()
|
double |
getProperty()
|
java.lang.String |
getPropertyName()
|
java.lang.String |
getPropertyUnits()
public String inputProperty(IAtomContainer mol) {
PropertyEditor p = new PropertyEditor(mol,new OptionsPanel(toString(),mol, this));
if (JOptionPane.showConfirmDialog(null,p,"Rule " + getID() + "." + getCaption(),
JOptionPane.OK_CANCEL_OPTION,JOptionPane.PLAIN_MESSAGE) == JOptionPane.OK_OPTION) {
setInteractive(!p.isSilent());
return p.getPropertyValue();
} else return null;
//return JOptionPane.showInputDialog("Enter " + propertyName + "," + propertyUnits);
} |
ambit2.base.interfaces.IProcessor<org.openscience.cdk.interfaces.IAtomContainer,org.openscience.cdk.renderer.selection.IChemObjectSelection> |
getSelector()
|
java.lang.String |
inputProperty(org.openscience.cdk.interfaces.IAtomContainer mol)
|
boolean |
isImplemented()
|
void |
removeListener()
|
void |
setCondition(java.lang.String condition)
|
void |
setInteractive(boolean value)
|
void |
setListener(java.beans.PropertyChangeListener listener)
|
void |
setOptions(IDecisionInteractive.UserOptions options)
|
void |
setProperty(double propertyStaticValue)
|
void |
setPropertyName(java.lang.String propertyName)
|
void |
setPropertyUnits(java.lang.String propertyUnits)
|
boolean |
verifyRule(org.openscience.cdk.interfaces.IAtomContainer mol)
This is the core of a IDecisionRule behaviour. |
Methods inherited from class toxTree.tree.AbstractRule |
addPropertyChangeListener, clearFlags, clone, createRule, equals, fromXML, getEditor, getExamples, getID, getNum, getTitle, hideResiduesID, isEditable, isResidueIDHidden, log, log, log, makeMolecule, removePropertyChangeListener, setEditable, setExampleMolecule, setExamples, setExplanation, setID, setNum, setTitle, toShallowXML, toString, toXML |
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 |
propertyStaticValue
protected java.lang.Double propertyStaticValue
propertyName
protected java.lang.String propertyName
propertyUnits
protected java.lang.String propertyUnits
options
protected IDecisionInteractive.UserOptions options
condition_higher
public static java.lang.String condition_higher
condition_lower
public static java.lang.String condition_lower
condition_equals
public static java.lang.String condition_equals
condition
protected java.lang.String condition
nf
protected static java.text.NumberFormat nf
propertyExamples
protected double[] propertyExamples
listener
protected java.beans.PropertyChangeListener listener
RuleVerifyProperty
public RuleVerifyProperty()
RuleVerifyProperty
public RuleVerifyProperty(java.lang.String propertyName,
java.lang.String units,
java.lang.String condition,
double value)
getOptions
public IDecisionInteractive.UserOptions getOptions()
- Specified by:
getOptions
in interface IDecisionInteractive
setOptions
public void setOptions(IDecisionInteractive.UserOptions options)
- Specified by:
setOptions
in interface IDecisionInteractive
getListener
public java.beans.PropertyChangeListener getListener()
- Specified by:
getListener
in interface IDecisionInteractive
setListener
public void setListener(java.beans.PropertyChangeListener listener)
- Specified by:
setListener
in interface IDecisionInteractive
getCaption
public java.lang.String getCaption()
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
inputProperty
public java.lang.String inputProperty(org.openscience.cdk.interfaces.IAtomContainer mol)
throws DecisionMethodException
- Throws:
DecisionMethodException
setProperty
public void setProperty(double propertyStaticValue)
getProperty
public double getProperty()
setCondition
public void setCondition(java.lang.String condition)
getCondition
public java.lang.String getCondition()
compare
public boolean compare(double Param1,
double Param2)
isImplemented
public boolean isImplemented()
- Specified by:
isImplemented
in interface IDecisionRule
- Overrides:
isImplemented
in class AbstractRule
- Returns:
- false if the rule is not implemented and true if it is
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
- Overrides:
getExplanation
in class AbstractRule
- Returns:
- explanation
- See Also:
IDecisionRule.getExplanation()
getPropertyName
public java.lang.String getPropertyName()
setPropertyName
public void setPropertyName(java.lang.String propertyName)
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
- Overrides:
getExampleMolecule
in class AbstractRule
- Returns:
org.openscience.cdk.interfaces.Molecule
- Throws:
DecisionMethodException
getPropertyUnits
public java.lang.String getPropertyUnits()
- public String inputProperty(IAtomContainer mol) {
PropertyEditor p = new PropertyEditor(mol,new OptionsPanel(toString(),mol, this));
if (JOptionPane.showConfirmDialog(null,p,"Rule " + getID() + "." + getCaption(),
JOptionPane.OK_CANCEL_OPTION,JOptionPane.PLAIN_MESSAGE) == JOptionPane.OK_OPTION) {
setInteractive(!p.isSilent());
return p.getPropertyValue();
} else return null;
//return JOptionPane.showInputDialog("Enter " + propertyName + "," + propertyUnits);
}
setPropertyUnits
public void setPropertyUnits(java.lang.String propertyUnits)
getInteractive
public boolean getInteractive()
- Specified by:
getInteractive
in interface IDecisionInteractive
setInteractive
public void setInteractive(boolean value)
- Specified by:
setInteractive
in interface IDecisionInteractive
getImplementationDetails
public java.lang.String getImplementationDetails()
- Specified by:
getImplementationDetails
in interface IImplementationDetails
removeListener
public void removeListener()
- Specified by:
removeListener
in interface IDecisionInteractive
getSelector
public ambit2.base.interfaces.IProcessor<org.openscience.cdk.interfaces.IAtomContainer,org.openscience.cdk.renderer.selection.IChemObjectSelection> getSelector()
- Specified by:
getSelector
in interface IDecisionRule
- Overrides:
getSelector
in class AbstractRule
Copyright © 2004-2012 Ideaconsult Ltd.. All Rights Reserved.