protected void checkInputParameters ( final IChemObjectBuilder builder , final double minMass , final double maxMass , final MolecularFormulaRange mfRange ) { if ( ( minMass < 0.0 ) || ( maxMass < 0.0 ) ) { throw ( new IllegalArgumentException ( "The minimum and maximum mass values must be >=0" ) ) ; } if ( ( minMass > maxMass ) ) { throw ( new IllegalArgumentException ( "Minimum mass must be <= maximum mass" ) ) ; } if ( ( mfRange == null ) || ( mfRange . getIsotopeCount ( ) == 0 ) ) { throw ( new IllegalArgumentException ( "The MolecularFormulaRange parameter must be non-null and must contain at least one isotope" ) ) ; } // Sort the elements by mass in ascending order. That speeds up // the search. for ( IIsotope isotope : mfRange . isotopes ( ) ) { // Check if exact mass of each isotope is set if ( isotope . getExactMass ( ) == null ) throw new IllegalArgumentException ( "The exact mass value of isotope " + isotope + " is not set" ) ; } }
Checks if input parameters are valid and throws an IllegalArgumentException otherwise .