use of org.openscience.cdk.interfaces.IChemModel in project cdk by cdk.
the class AbstractChemModelTest method testStateChanged_EventPropagation_Crystal.
@Test
public void testStateChanged_EventPropagation_Crystal() {
ChemObjectListenerImpl listener = new ChemObjectListenerImpl();
IChemModel chemObject = (IChemModel) newChemObject();
chemObject.addListener(listener);
ICrystal crystal = chemObject.getBuilder().newInstance(ICrystal.class);
chemObject.setCrystal(crystal);
Assert.assertTrue(listener.changed);
// reset the listener
listener.reset();
Assert.assertFalse(listener.changed);
// changing the set should trigger a change event in the IChemModel
crystal.add(chemObject.getBuilder().newInstance(IAtomContainer.class));
Assert.assertTrue(listener.changed);
}
use of org.openscience.cdk.interfaces.IChemModel in project cdk by cdk.
the class AbstractChemModelTest method testIsEmpty_Crystal.
@Test
public void testIsEmpty_Crystal() {
IChemModel model = (IChemModel) newChemObject();
IChemObjectBuilder builder = model.getBuilder();
ICrystal crystal = builder.newInstance(ICrystal.class);
model.setCrystal(crystal);
Assert.assertTrue(model.isEmpty());
crystal.addAtom(builder.newInstance(IAtom.class, "C"));
Assert.assertFalse(model.isEmpty());
model.setCrystal(null);
Assert.assertTrue(model.isEmpty());
}
use of org.openscience.cdk.interfaces.IChemModel in project cdk by cdk.
the class AbstractChemModelTest method testIsEmpty_RingSet.
@Test
public void testIsEmpty_RingSet() {
IChemModel model = (IChemModel) newChemObject();
IChemObjectBuilder builder = model.getBuilder();
IAtomContainer container = builder.newInstance(IAtomContainer.class);
IRingSet ringset = builder.newInstance(IRingSet.class);
Assert.assertTrue(model.isEmpty());
model.setRingSet(ringset);
Assert.assertTrue(model.isEmpty());
ringset.addAtomContainer(container);
Assert.assertFalse(model.isEmpty());
model.setRingSet(null);
Assert.assertTrue(model.isEmpty());
}
use of org.openscience.cdk.interfaces.IChemModel in project cdk by cdk.
the class AbstractChemModelTest method testSetMoleculeSet_IAtomContainerSet.
@Test
public void testSetMoleculeSet_IAtomContainerSet() {
IChemModel chemModel = (IChemModel) newChemObject();
IAtomContainerSet crystal = chemModel.getBuilder().newInstance(IAtomContainerSet.class);
chemModel.setMoleculeSet(crystal);
Assert.assertEquals(crystal, chemModel.getMoleculeSet());
}
use of org.openscience.cdk.interfaces.IChemModel in project cdk by cdk.
the class AbstractChemSequenceTest method testGetChemModel_int.
@Test
public void testGetChemModel_int() {
IChemSequence cs = (IChemSequence) newChemObject();
cs.addChemModel(cs.getBuilder().newInstance(IChemModel.class));
IChemModel second = cs.getBuilder().newInstance(IChemModel.class);
cs.addChemModel(second);
cs.addChemModel(cs.getBuilder().newInstance(IChemModel.class));
Assert.assertEquals(second, cs.getChemModel(1));
}
Aggregations