public ValidationReport validateIsotopeExistence(IIsotope isotope) {
        ValidationReport report = new ValidationReport();
        ValidationTest isotopeExists = new ValidationTest(isotope,
                "Isotope with this mass number is not known for this element.");
        try {
            IsotopeFactory isotopeFac = Isotopes.getInstance();
            IIsotope[] isotopes = isotopeFac.getIsotopes(isotope.getSymbol());
            if (isotope.getMassNumber() != null &&
                isotope.getMassNumber() != 0) {
                boolean foundKnownIsotope = false;
                for (int i = 0; i < isotopes.length; i++) {
                    if (Objects.equals(isotopes[i].getMassNumber(), isotope.getMassNumber())) {
                        foundKnownIsotope = true;
                    }
                }
                if (!foundKnownIsotope) {
                    report.addError(isotopeExists);
                } else {
                    report.addOK(isotopeExists);
                }
            } else {
                // isotopic is unspecified
                report.addOK(isotopeExists);
            }
        } catch (Exception exception) {
            // too bad...
        }
        return report;
    }
public ValidationReport validateIsotopeExistence ( IIsotope isotope ) { ValidationReport report = new ValidationReport ( ) ; ValidationTest isotopeExists = new ValidationTest ( isotope , "Isotope with this mass number is not known for this element." ) ; try { IsotopeFactory isotopeFac = Isotopes . getInstance ( ) ; IIsotope [ ] isotopes = isotopeFac . getIsotopes ( isotope . getSymbol ( ) ) ; if ( isotope . getMassNumber ( ) != null && isotope . getMassNumber ( ) != 0 ) { boolean foundKnownIsotope = false ; for ( int i = 0 ; i < isotopes . length ; i ++ ) { if ( Objects . equals ( isotopes [ i ] . getMassNumber ( ) , isotope . getMassNumber ( ) ) ) { foundKnownIsotope = true ; } } if ( ! foundKnownIsotope ) { report . addError ( isotopeExists ) ; } else { report . addOK ( isotopeExists ) ; } } else { report . addOK ( isotopeExists ) ; } } catch ( Exception exception ) { } return report ; }
the Isotope tests