int numOfIsotopes = pattern.getNumberOfIsotopes();
DataPoint dataPoints[] = new DataPoint[numOfIsotopes];
for (int i = 0; i < numOfIsotopes; i++) {
IsotopeContainer isotope = pattern.getIsotope(i);
// For each unit of charge, we have to add or remove a mass of a
// single electron. If the charge is positive, we remove electron
// mass. If the charge is negative, we add it.
double mass = isotope.getMass()
+ (polarity.getSign() * -1 * charge * ELECTRON_MASS);
if (charge != 0)
mass /= charge;
double intensity = isotope.getIntensity();
dataPoints[i] = new SimpleDataPoint(mass, intensity);
}
String formulaString = MolecularFormulaManipulator