use of org.openscience.cdk.interfaces.ILonePair in project ambit-mirror by ideaconsult.
the class SuppleAtomContainer method getConnectedLonePairsList.
public List<ILonePair> getConnectedLonePairsList(IAtom atom) {
List<ILonePair> lps = new ArrayList<ILonePair>();
Iterator<ILonePair> lp = lonePairs.iterator();
while (lp.hasNext()) {
ILonePair p = lp.next();
if (p.contains(atom))
lps.add(p);
}
return lps;
}
use of org.openscience.cdk.interfaces.ILonePair in project ambit-mirror by ideaconsult.
the class SuppleAtomContainer method removeLonePair.
public ILonePair removeLonePair(int position) {
ILonePair lp = lonePairs.get(position);
lp.removeListener(this);
lonePairs.remove(lp);
notifyChanged();
return lp;
}
use of org.openscience.cdk.interfaces.ILonePair in project ambit-mirror by ideaconsult.
the class SuppleAtomContainer method removeAllElectronContainers.
public void removeAllElectronContainers() {
removeAllBonds();
for (ILonePair lp : lonePairs()) lp.removeListener(this);
for (ISingleElectron se : singleElectrons) se.removeListener(this);
lonePairs.clear();
singleElectrons.clear();
notifyChanged();
}
use of org.openscience.cdk.interfaces.ILonePair in project ambit-mirror by ideaconsult.
the class SuppleAtomContainer method init.
protected void init() {
atoms = new FilteredList<IAtom>();
bonds = new FilteredList<IBond>();
lonePairs = new ArrayList<ILonePair>();
singleElectrons = new ArrayList<ISingleElectron>();
int atomCount = getAtomCount();
stereoElements = new HashSet<IStereoElement>(atomCount / 2);
for (IStereoElement element : stereoElements()) {
addStereoElement(element);
}
}
use of org.openscience.cdk.interfaces.ILonePair in project ambit-mirror by ideaconsult.
the class SuppleAtomContainerTest method testAddLonePair_ILonePair.
@Test
public void testAddLonePair_ILonePair() {
IAtomContainer acetone = new SuppleAtomContainer();
IAtom c = MoleculeTools.newAtom(builder, "C");
IAtom o = MoleculeTools.newAtom(builder, "O");
acetone.addAtom(c);
acetone.addAtom(o);
IBond b1 = MoleculeTools.newBond(builder, c, o, IBond.Order.DOUBLE);
acetone.addBond(b1);
ILonePair lp1 = MoleculeTools.newLonePair(builder, o);
ILonePair lp2 = MoleculeTools.newLonePair(builder, o);
acetone.addLonePair(lp1);
acetone.addLonePair(lp2);
Assert.assertEquals(2, acetone.getConnectedLonePairsCount(o));
Assert.assertEquals(0, acetone.getConnectedLonePairsCount(c));
}
Aggregations