use of org.openscience.cdk.reaction.type.RearrangementCationReaction in project cdk by cdk.
the class StructureResonanceGeneratorTest method testSetDefaultReactions.
/**
* A unit test suite for JUnit.
*/
@Test
public void testSetDefaultReactions() {
StructureResonanceGenerator sRG = new StructureResonanceGenerator();
List<IReactionProcess> reactionList = sRG.getReactions();
Assert.assertNotNull(reactionList);
Assert.assertEquals(6, reactionList.size());
SharingLonePairReaction slReaction = (SharingLonePairReaction) reactionList.get(0);
Assert.assertEquals(1, slReaction.getParameterList().size());
List<IParameterReact> objects = slReaction.getParameterList();
for (IParameterReact object : objects) {
if (object instanceof SetReactionCenter)
Assert.assertFalse(object.isSetParameter());
}
PiBondingMovementReaction pBReaction = (PiBondingMovementReaction) reactionList.get(1);
Assert.assertEquals(1, pBReaction.getParameterList().size());
objects = pBReaction.getParameterList();
for (IParameterReact object : objects) {
if (object instanceof SetReactionCenter)
Assert.assertFalse(object.isSetParameter());
}
RearrangementAnionReaction raReaction = (RearrangementAnionReaction) reactionList.get(2);
Assert.assertEquals(1, raReaction.getParameterList().size());
objects = raReaction.getParameterList();
for (IParameterReact object : objects) {
if (object instanceof SetReactionCenter)
Assert.assertFalse(object.isSetParameter());
}
RearrangementCationReaction rcReaction = (RearrangementCationReaction) reactionList.get(3);
Assert.assertEquals(1, rcReaction.getParameterList().size());
objects = rcReaction.getParameterList();
for (IParameterReact object : objects) {
if (object instanceof SetReactionCenter)
Assert.assertFalse(object.isSetParameter());
}
RearrangementLonePairReaction lnReaction = (RearrangementLonePairReaction) reactionList.get(4);
Assert.assertEquals(1, lnReaction.getParameterList().size());
objects = lnReaction.getParameterList();
for (IParameterReact object : objects) {
if (object instanceof SetReactionCenter)
Assert.assertFalse(object.isSetParameter());
}
RearrangementRadicalReaction rrReaction = (RearrangementRadicalReaction) reactionList.get(5);
Assert.assertEquals(1, rrReaction.getParameterList().size());
objects = rrReaction.getParameterList();
for (IParameterReact object : objects) {
if (object instanceof SetReactionCenter)
Assert.assertFalse(object.isSetParameter());
}
}
use of org.openscience.cdk.reaction.type.RearrangementCationReaction in project cdk by cdk.
the class StructureResonanceGenerator method callDefaultReactions.
private void callDefaultReactions() {
List<IParameterReact> paramList = new ArrayList<>();
IParameterReact param = new SetReactionCenter();
param.setParameter(Boolean.FALSE);
paramList.add(param);
IReactionProcess type = new SharingLonePairReaction();
try {
type.setParameterList(paramList);
} catch (CDKException e) {
LoggingToolFactory.createLoggingTool(StructureResonanceGenerator.class).warn("Unexpected Error:", e);
}
reactionsList.add(type);
type = new PiBondingMovementReaction();
List<IParameterReact> paramList2 = new ArrayList<>();
IParameterReact param2 = new SetReactionCenter();
param2.setParameter(Boolean.FALSE);
paramList2.add(param2);
try {
type.setParameterList(paramList2);
} catch (CDKException e) {
LoggingToolFactory.createLoggingTool(StructureResonanceGenerator.class).warn("Unexpected Error:", e);
}
reactionsList.add(type);
type = new RearrangementAnionReaction();
try {
type.setParameterList(paramList);
} catch (CDKException e) {
LoggingToolFactory.createLoggingTool(StructureResonanceGenerator.class).warn("Unexpected Error:", e);
}
reactionsList.add(type);
type = new RearrangementCationReaction();
try {
type.setParameterList(paramList);
} catch (CDKException e) {
LoggingToolFactory.createLoggingTool(StructureResonanceGenerator.class).warn("Unexpected Error:", e);
}
reactionsList.add(type);
type = new RearrangementLonePairReaction();
try {
type.setParameterList(paramList);
} catch (CDKException e) {
LoggingToolFactory.createLoggingTool(StructureResonanceGenerator.class).warn("Unexpected Error:", e);
}
reactionsList.add(type);
type = new RearrangementRadicalReaction();
try {
type.setParameterList(paramList);
} catch (CDKException e) {
LoggingToolFactory.createLoggingTool(StructureResonanceGenerator.class).warn("Unexpected Error:", e);
}
reactionsList.add(type);
}
Aggregations