test_class.declarator: builder
test_class.modifier: private static
test_class.original_string: private static IChemObjectBuilder builder;
test_class.type: IChemObjectBuilder
test_class.var_name: builder
test_class.file: tool/formula/src/test/java/org/openscience/cdk/formula/rules/NitrogenRuleTest.java
test_class.identifier: NitrogenRuleTest
test_class.superclass: extends FormulaRuleTest
test_case.body: @Test
      public void testC49H75NO12() throws ClassNotFoundException, CDKException, Exception {
  
          IRule rule = new NitrogenRule();
  
          IMolecularFormula formula = MolecularFormulaManipulator.getMajorIsotopeMolecularFormula("C49H75NO12", builder);
          formula.setCharge(0);
  
          Assert.assertEquals(1.0, rule.validate(formula), 0.0001);
      }
test_case.class_method_signature: NitrogenRuleTest.testC49H75NO12()
test_case.full_signature: @Test public void testC49H75NO12()
test_case.identifier: testC49H75NO12
test_case.invocations: getMajorIsotopeMolecularFormula setCharge assertEquals validate
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void testC49H75NO12()
focal_class.declarator: logger = LoggingToolFactory.createLoggingTool(NitrogenRule.class)
focal_class.modifier: private static
focal_class.original_string: private static ILoggingTool logger = LoggingToolFactory.createLoggingTool(NitrogenRule.class);
focal_class.type: ILoggingTool
focal_class.var_name: logger
focal_class.file: tool/formula/src/main/java/org/openscience/cdk/formula/rules/NitrogenRule.java
focal_class.identifier: NitrogenRule
focal_class.interfaces: implements IRule
focal_class.class_method_signature: NitrogenRule.NitrogenRule()
focal_class.full_signature: public  NitrogenRule()
focal_class.identifier: NitrogenRule
focal_class.modifiers: public
focal_class.parameters: ()
focal_class.signature:  NitrogenRule()
focal_class.class_method_signature: NitrogenRule.setParameters(Object[] params)
focal_class.full_signature: @Override public void setParameters(Object[] params)
focal_class.identifier: setParameters
focal_class.modifiers: @Override public
focal_class.parameters: (Object[] params)
focal_class.return: void
focal_class.signature: void setParameters(Object[] params)
focal_class.class_method_signature: NitrogenRule.getParameters()
focal_class.full_signature: @Override public Object[] getParameters()
focal_class.identifier: getParameters
focal_class.modifiers: @Override public
focal_class.parameters: ()
focal_class.return: Object[]
focal_class.signature: Object[] getParameters()
focal_class.class_method_signature: NitrogenRule.validate(IMolecularFormula formula)
focal_class.full_signature: @Override public double validate(IMolecularFormula formula)
focal_class.identifier: validate
focal_class.modifiers: @Override public
focal_class.parameters: (IMolecularFormula formula)
focal_class.return: double
focal_class.signature: double validate(IMolecularFormula formula)
focal_class.class_method_signature: NitrogenRule.getOthers(IMolecularFormula formula)
focal_class.full_signature: private int getOthers(IMolecularFormula formula)
focal_class.identifier: getOthers
focal_class.modifiers: private
focal_class.parameters: (IMolecularFormula formula)
focal_class.return: int
focal_class.signature: int getOthers(IMolecularFormula formula)
focal_class.class_method_signature: NitrogenRule.isOdd(double value)
focal_class.full_signature: private boolean isOdd(double value)
focal_class.identifier: isOdd
focal_class.modifiers: private
focal_class.parameters: (double value)
focal_class.return: boolean
focal_class.signature: boolean isOdd(double value)
focal_method.body: @Override
      public double validate(IMolecularFormula formula) throws CDKException {
          logger.info("Start validation of ", formula);
  
          double mass = MolecularFormulaManipulator.getTotalMassNumber(formula);
          if (mass == 0) return 0.0;
  
          int numberN = MolecularFormulaManipulator.getElementCount(formula,
                  formula.getBuilder().newInstance(IElement.class, "N"));
          numberN += getOthers(formula);
  
          if (formula.getCharge() == null || formula.getCharge() == 0 || !isOdd(Math.abs(formula.getCharge()))) {
              if (isOdd(mass) && isOdd(numberN)) {
                  return 1.0;
              } else if (!isOdd(mass) && (numberN == 0 || !isOdd(numberN))) {
                  return 1.0;
              } else
                  return 0.0;
          } else {
              if (!isOdd(mass) && isOdd(numberN)) {
                  return 1.0;
              } else if (isOdd(mass) && (numberN == 0 || !isOdd(numberN))) {
                  return 1.0;
              } else
                  return 0.0;
          }
      }
focal_method.class_method_signature: NitrogenRule.validate(IMolecularFormula formula)
focal_method.full_signature: @Override public double validate(IMolecularFormula formula)
focal_method.identifier: validate
focal_method.invocations: info getTotalMassNumber getElementCount newInstance getBuilder getOthers getCharge getCharge isOdd abs getCharge isOdd isOdd isOdd isOdd isOdd isOdd isOdd isOdd
focal_method.modifiers: @Override public
focal_method.parameters: (IMolecularFormula formula)
focal_method.return: double
focal_method.signature: double validate(IMolecularFormula formula)