/** * Gets a array of all isotopes known to the IsotopeFactory. * * @return An array of all isotopes */ public IIsotope[] getIsotopes() { List<IIsotope> list = new ArrayList<IIsotope>(); for (List<IIsotope> isotopes : this.isotopes) { if (isotopes == null) continue; for (IIsotope isotope : isotopes) { list.add(clone(isotope)); } } return list.toArray(new IIsotope[list.size()]); }
/** * Gets a array of all isotopes known to the IsotopeFactory. * * @return An array of all isotopes */ public IIsotope[] getIsotopes() { List<IIsotope> list = new ArrayList<IIsotope>(); for (List<IIsotope> isotopes : this.isotopes) { if (isotopes == null) continue; for (IIsotope isotope : isotopes) { list.add(clone(isotope)); } } return list.toArray(new IIsotope[list.size()]); }
/** * Gets an array of all isotopes matching the searched exact mass within * a certain difference. * * @param exactMass search mass * @param difference mass the isotope is allowed to differ from the search mass * @return An array of all isotopes */ public IIsotope[] getIsotopes(double exactMass, double difference) { List<IIsotope> list = new ArrayList<>(); for (List<IIsotope> isotopes : this.isotopes) { if (isotopes == null) continue; for (IIsotope isotope : isotopes) { if (Math.abs(isotope.getExactMass() - exactMass) <= difference) { list.add(clone(isotope)); } } } return list.toArray(new IIsotope[list.size()]); }
/** * Gets an array of all isotopes matching the searched exact mass within * a certain difference. * * @param exactMass search mass * @param difference mass the isotope is allowed to differ from the search mass * @return An array of all isotopes */ public IIsotope[] getIsotopes(double exactMass, double difference) { List<IIsotope> list = new ArrayList<>(); for (List<IIsotope> isotopes : this.isotopes) { if (isotopes == null) continue; for (IIsotope isotope : isotopes) { if (Math.abs(isotope.getExactMass() - exactMass) <= difference) { list.add(clone(isotope)); } } } return list.toArray(new IIsotope[list.size()]); }
/** * Gets an array of all isotopes known to the IsotopeFactory for the given * element symbol. * *@param symbol An element symbol to search for *@return An array of isotopes that matches the given element symbol */ public IIsotope[] getIsotopes(String symbol) { final int elem = Elements.ofString(symbol).number(); if (isotopes[elem] == null) return EMPTY_ISOTOPE_ARRAY; List<IIsotope> list = new ArrayList<IIsotope>(); for (IIsotope isotope : isotopes[elem]) { list.add(clone(isotope)); } return list.toArray(new IIsotope[list.size()]); }
/** * Gets an array of all isotopes known to the IsotopeFactory for the given * element symbol. * *@param symbol An element symbol to search for *@return An array of isotopes that matches the given element symbol */ public IIsotope[] getIsotopes(String symbol) { final int elem = Elements.ofString(symbol).number(); if (isotopes[elem] == null) return EMPTY_ISOTOPE_ARRAY; List<IIsotope> list = new ArrayList<IIsotope>(); for (IIsotope isotope : isotopes[elem]) { list.add(clone(isotope)); } return list.toArray(new IIsotope[list.size()]); }
/** * Get an isotope based on the element symbol and exact mass. * * @param symbol the element symbol * @param exactMass the mass number * @param tolerance allowed difference from provided exact mass * @return the corresponding isotope */ public IIsotope getIsotope(String symbol, double exactMass, double tolerance) { IIsotope ret = null; double minDiff = Double.MAX_VALUE; int elem = Elements.ofString(symbol).number(); List<IIsotope> isotopes = this.isotopes[elem]; if (isotopes == null) return null; for (IIsotope isotope : isotopes) { double diff = Math.abs(isotope.getExactMass() - exactMass); if (isotope.getSymbol().equals(symbol) && diff <= tolerance && diff < minDiff) { ret = clone(isotope); minDiff = diff; } } return ret; }
/** * Get isotope based on element symbol and mass number. * * @param symbol the element symbol * @param massNumber the mass number * @return the corresponding isotope */ public IIsotope getIsotope(String symbol, int massNumber) { int elem = Elements.ofString(symbol).number(); List<IIsotope> isotopes = this.isotopes[elem]; if (isotopes == null) return null; for (IIsotope isotope : isotopes) { if (isotope.getSymbol().equals(symbol) && isotope.getMassNumber() == massNumber) { return clone(isotope); } } return null; }
/** * Get an isotope based on the element symbol and exact mass. * * @param symbol the element symbol * @param exactMass the mass number * @param tolerance allowed difference from provided exact mass * @return the corresponding isotope */ public IIsotope getIsotope(String symbol, double exactMass, double tolerance) { IIsotope ret = null; double minDiff = Double.MAX_VALUE; int elem = Elements.ofString(symbol).number(); List<IIsotope> isotopes = this.isotopes[elem]; if (isotopes == null) return null; for (IIsotope isotope : isotopes) { double diff = Math.abs(isotope.getExactMass() - exactMass); if (isotope.getSymbol().equals(symbol) && diff <= tolerance && diff < minDiff) { ret = clone(isotope); minDiff = diff; } } return ret; }
/** * Get isotope based on element symbol and mass number. * * @param symbol the element symbol * @param massNumber the mass number * @return the corresponding isotope */ public IIsotope getIsotope(String symbol, int massNumber) { int elem = Elements.ofString(symbol).number(); List<IIsotope> isotopes = this.isotopes[elem]; if (isotopes == null) return null; for (IIsotope isotope : isotopes) { if (isotope.getSymbol().equals(symbol) && isotope.getMassNumber() == massNumber) { return clone(isotope); } } return null; }