/** Updates the mass shifts. */
  protected void updateMassShifts() {
    if (theoreticalFragmentIons != null) {
      HashMap<Integer, ArrayList<Ion>> peptideFragmentIons =
          theoreticalFragmentIons.get(IonType.PEPTIDE_FRAGMENT_ION.index);
      ArrayList<Ion> ions = peptideFragmentIons.get(PeptideFragmentIon.A_ION);
      if (ions != null) {
        for (Ion ion : ions) {
          ion.setTheoreticMass(ion.getTheoreticMass() + massShift + massShiftNTerm);
        }
      }
      ions = peptideFragmentIons.get(PeptideFragmentIon.B_ION);
      if (ions != null) {
        for (Ion ion : ions) {
          ion.setTheoreticMass(ion.getTheoreticMass() + massShift + massShiftNTerm);
        }
      }
      ions = peptideFragmentIons.get(PeptideFragmentIon.C_ION);
      if (ions != null) {
        for (Ion ion : ions) {
          ion.setTheoreticMass(ion.getTheoreticMass() + massShift + massShiftNTerm);
        }
      }
      ions = peptideFragmentIons.get(PeptideFragmentIon.X_ION);
      if (ions != null) {
        for (Ion ion : ions) {
          ion.setTheoreticMass(ion.getTheoreticMass() + massShift + massShiftCTerm);
        }
      }
      ions = peptideFragmentIons.get(PeptideFragmentIon.Y_ION);
      if (ions != null) {
        for (Ion ion : ions) {
          ion.setTheoreticMass(ion.getTheoreticMass() + massShift + massShiftCTerm);
        }
      }
      ions = peptideFragmentIons.get(PeptideFragmentIon.Z_ION);
      if (ions != null) {
        for (Ion ion : ions) {
          ion.setTheoreticMass(ion.getTheoreticMass() + massShift + massShiftCTerm);
        }
      }

      HashMap<Integer, ArrayList<Ion>> tagFragmentIons =
          theoreticalFragmentIons.get(IonType.TAG_FRAGMENT_ION.index);
      ions = tagFragmentIons.get(TagFragmentIon.A_ION);
      if (ions != null) {
        for (Ion ion : ions) {
          ion.setTheoreticMass(ion.getTheoreticMass() + massShift + massShiftNTerm);
        }
      }
      ions = tagFragmentIons.get(TagFragmentIon.B_ION);
      if (ions != null) {
        for (Ion ion : ions) {
          ion.setTheoreticMass(ion.getTheoreticMass() + massShift + massShiftNTerm);
        }
      }
      ions = tagFragmentIons.get(TagFragmentIon.C_ION);
      if (ions != null) {
        for (Ion ion : ions) {
          ion.setTheoreticMass(ion.getTheoreticMass() + massShift + massShiftNTerm);
        }
      }
      ions = tagFragmentIons.get(TagFragmentIon.X_ION);
      if (ions != null) {
        for (Ion ion : ions) {
          ion.setTheoreticMass(ion.getTheoreticMass() + massShift + massShiftCTerm);
        }
      }
      ions = tagFragmentIons.get(TagFragmentIon.Y_ION);
      if (ions != null) {
        for (Ion ion : ions) {
          ion.setTheoreticMass(ion.getTheoreticMass() + massShift + massShiftCTerm);
        }
      }
      ions = tagFragmentIons.get(TagFragmentIon.Z_ION);
      if (ions != null) {
        for (Ion ion : ions) {
          ion.setTheoreticMass(ion.getTheoreticMass() + massShift + massShiftCTerm);
        }
      }
    }
  }