/// <summary> Adds the atom oAtom to a specified Monomer. /// /// </summary> /// <param name="oAtom"> The atom to add /// </param> /// <param name="oMonomer"> The monomer the atom belongs to /// </param> public virtual void addAtom(IAtom oAtom, IMonomer oMonomer) { if (!contains(oAtom)) { base.addAtom(oAtom); if (oMonomer != null) { // Not sure what's better here...throw nullpointer exception? oMonomer.addAtom(oAtom); if (!monomers.ContainsKey(oMonomer.MonomerName)) { monomers[oMonomer.MonomerName] = oMonomer; } } } /* notifyChanged() is called by addAtom in * AtomContainer */ }
/// <summary> /// Adds the atom oAtom to a specific Monomer. /// /// </summary> /// <param name="oAtom"> The atom to add /// </param> /// <param name="oMonomer"> The monomer the atom belongs to /// /// </param> public virtual void addAtom(IAtom oAtom, IMonomer oMonomer) { int atomCount = base.AtomCount; // Add atom to AtomContainer base.addAtom(oAtom); if (atomCount != base.AtomCount) { // ok, super did not yet contain the atom if (oMonomer == null) { oMonomer = getMonomer(""); } oMonomer.addAtom(oAtom); if (!monomers.ContainsKey(oMonomer.MonomerName)) { monomers[oMonomer.MonomerName] = oMonomer; } } }
/// <summary> Adds the atom oAtom to a specified Monomer. /// /// </summary> /// <param name="oAtom"> The atom to add /// </param> /// <param name="oMonomer"> The monomer the atom belongs to /// </param> public virtual void addAtom(IAtom oAtom, IMonomer oMonomer) { if (!contains(oAtom)) { base.addAtom(oAtom); if (oMonomer != null) { // Not sure what's better here...throw nullpointer exception? oMonomer.addAtom(oAtom); if (!monomers.ContainsKey(oMonomer.MonomerName)) { monomers[oMonomer.MonomerName] = oMonomer; } } } /* notifyChanged() is called by addAtom in AtomContainer */ }