Package org.openscience.cdk.formula
Class MolecularFormulaChecker
java.lang.Object
org.openscience.cdk.formula.MolecularFormulaChecker
Validate a molecular formula given in IMolecularformula object. The validation is based according different rules that you have to introduce before see IRule.
-
Constructor Summary
ConstructorsConstructorDescriptionMolecularFormulaChecker
(List<IRule> rules) Construct an instance of MolecularFormulaChecker. -
Method Summary
Modifier and TypeMethodDescriptiongetRules()
Get the IRules to be applied to validate the IMolecularFormula.isValid
(IMolecularFormula formula) Validate if a IMolecularFormula is valid.isValidSum
(IMolecularFormula formula) Validate if a IMolecularFormula is valid.
-
Constructor Details
-
MolecularFormulaChecker
Construct an instance of MolecularFormulaChecker. It must be initialized with the rules to applied.- Parameters:
rules
- A List with IRule to be applied
-
-
Method Details
-
getRules
Get the IRules to be applied to validate the IMolecularFormula.- Returns:
- A List with IRule
-
isValidSum
Validate if a IMolecularFormula is valid. The result more close to 1 means maximal probability to be valid. Opposite more close to 0 means minimal probability to be valid. To know the result in each IRule useisValid(IMolecularFormula)
- Parameters:
formula
- The IMolecularFormula value- Returns:
- The percent of the validity
- See Also:
-
isValid
Validate if a IMolecularFormula is valid. The results of each IRule which has to be applied is put into IMolecularFormula as properties. To extract the result final as the product of rule's result useisValidSum(IMolecularFormula)
.- Parameters:
formula
- The IMolecularFormula value- Returns:
- formulaWith The IMolecularFormula with the results for each IRule into properties
- See Also:
-