class MolecularFormulaChecker {

    public Double isValidSum(IMolecularFormula formula) {
        double result = 1.0;

        IMolecularFormula formulaWith = isValid(formula);
        Map<Object, Object> properties = formulaWith.getProperties();

        Iterator<IRule> iterRules = rules.iterator();
        while (iterRules.hasNext()) {
            result *= (Double) properties.get(iterRules.next().getClass());
        }
        return result;
    }

    public  MolecularFormulaChecker(List<IRule> rules);

}