use of org.openscience.cdk.interfaces.IReaction in project cdk by cdk.
the class ReactionTest method testReaction.
@Test
public void testReaction() {
IReaction reaction = new Reaction();
Assert.assertNotNull(reaction);
Assert.assertEquals(0, reaction.getReactantCount());
Assert.assertEquals(0, reaction.getProductCount());
Assert.assertEquals(IReaction.Direction.FORWARD, reaction.getDirection());
}
use of org.openscience.cdk.interfaces.IReaction in project cdk by cdk.
the class ChemModelTest method testChemModel.
@Test
public void testChemModel() {
IChemModel chemModel = new ChemModel();
Assert.assertNotNull(chemModel);
Assert.assertTrue(chemModel.isEmpty());
IAtom atom = new Atom("N");
IAtomContainer mol = new AtomContainer();
IAtomContainerSet mset = new AtomContainerSet();
mol.addAtom(atom);
mset.addAtomContainer(mol);
chemModel.setMoleculeSet(mset);
Assert.assertFalse(chemModel.isEmpty());
mol.removeAtomOnly(atom);
Assert.assertFalse(chemModel.isEmpty());
chemModel.setMoleculeSet(null);
Assert.assertTrue(chemModel.isEmpty());
IChemModel model1 = new ChemModel();
mol.addAtom(atom);
IReaction react = new Reaction();
react.addReactant(mol);
IReactionSet rset = new ReactionSet();
rset.addReaction(react);
model1.setReactionSet(rset);
Assert.assertFalse(model1.isEmpty());
mol.removeAtomOnly(atom);
Assert.assertFalse(model1.isEmpty());
model1.setReactionSet(null);
Assert.assertTrue(model1.isEmpty());
IChemModel model2 = new ChemModel();
mol.addAtom(atom);
IRingSet ringset = new RingSet();
ringset.add(mset);
model2.setRingSet(ringset);
Assert.assertFalse(model2.isEmpty());
mol.removeAtomOnly(atom);
Assert.assertFalse(model2.isEmpty());
model2.setRingSet(null);
Assert.assertTrue(model2.isEmpty());
IChemModel model3 = new ChemModel();
mol.addAtom(atom);
ICrystal cry = new Crystal(mol);
model3.setCrystal(cry);
Assert.assertFalse(model3.isEmpty());
mol.removeAtomOnly(atom);
Assert.assertFalse(model3.isEmpty());
model3.setCrystal(null);
Assert.assertTrue(model3.isEmpty());
}
use of org.openscience.cdk.interfaces.IReaction in project cdk by cdk.
the class DebugReactionTest method testDebugReaction.
@Test
public void testDebugReaction() {
IReaction polymer = new DebugReaction();
Assert.assertTrue(polymer instanceof DebugReaction);
}
use of org.openscience.cdk.interfaces.IReaction in project cdk by cdk.
the class ReactionScheme method clone.
/**
* Clones this ReactionScheme object and its content.
*
* @return The cloned object
*/
@Override
public Object clone() throws CloneNotSupportedException {
IReactionScheme clone = new ReactionScheme();
for (IReactionScheme scheme : this.reactionSchemes()) {
clone.add((IReactionScheme) scheme.clone());
}
for (IReaction reaction : reactions()) {
clone.addReaction((IReaction) reaction.clone());
}
// clone the properties
if (getProperties() != null) {
Map<Object, Object> properties = getProperties();
Map<Object, Object> clonedHashtable = new HashMap<>();
for (Object key : properties.keySet()) {
Object value = properties.get(key);
clonedHashtable.put(key, value);
}
clone.addProperties(clonedHashtable);
}
return clone;
}
use of org.openscience.cdk.interfaces.IReaction in project cdk by cdk.
the class ReactionSet method toString.
@Override
public String toString() {
StringBuilder buffer = new StringBuilder(32);
buffer.append("ReactionSet(");
buffer.append(this.hashCode());
buffer.append(", R=").append(getReactionCount()).append(", ");
for (IReaction reaction : reactions()) {
buffer.append(reaction.toString());
}
buffer.append(')');
return buffer.toString();
}
Aggregations