Permalink
Browse files

Removed IAtomContainerGenerator and IReactionGenerator in favor if us…

…ing generics: IGenerator<T extends IChemObject> (renderextra).
  • Loading branch information...
1 parent 506377f commit ec9a21e773d8504e64a54f55999202e6df7dba64 @egonw egonw committed with egonw Jun 4, 2010
@@ -39,8 +39,7 @@
import org.openscience.cdk.renderer.elements.ElementGroup;
import org.openscience.cdk.renderer.elements.IRenderingElement;
import org.openscience.cdk.renderer.font.IFontManager;
-import org.openscience.cdk.renderer.generators.IAtomContainerGenerator;
-import org.openscience.cdk.renderer.generators.IReactionGenerator;
+import org.openscience.cdk.renderer.generators.IGenerator;
import org.openscience.cdk.renderer.generators.BasicBondGenerator.BondLength;
import org.openscience.cdk.renderer.generators.BasicSceneGenerator.FontName;
import org.openscience.cdk.renderer.generators.BasicSceneGenerator.Margin;
@@ -115,7 +114,7 @@
/**
* Generators specific to reactions
*/
- private List<IReactionGenerator> reactionGenerators;
+ private List<IGenerator<IReaction>> reactionGenerators;
/**
* A renderer that generates diagrams using the specified
@@ -126,15 +125,15 @@
* @param fontManager
* a class that manages mappings between zoom and font sizes
*/
- public Renderer(List<IAtomContainerGenerator> generators, IFontManager fontManager) {
+ public Renderer(List<IGenerator<IAtomContainer>> generators, IFontManager fontManager) {
super(generators, fontManager);
}
- public Renderer(List<IAtomContainerGenerator> generators,
- List<IReactionGenerator> reactionGenerators,
+ public Renderer(List<IGenerator<IAtomContainer>> generators,
+ List<IGenerator<IReaction>> reactionGenerators,
IFontManager fontManager) {
this(generators, fontManager);
- for (IReactionGenerator generator : reactionGenerators)
+ for (IGenerator<IReaction> generator : reactionGenerators)
rendererModel.registerParameters(generator);
this.reactionGenerators = reactionGenerators;
this.setup();
@@ -951,7 +950,7 @@ private void setup() {
private IRenderingElement generateDiagram(IReaction reaction) {
ElementGroup diagram = new ElementGroup();
- for (IReactionGenerator generator : this.reactionGenerators) {
+ for (IGenerator<IReaction> generator : this.reactionGenerators) {
diagram.add(generator.generate(reaction, rendererModel));
}
@@ -965,14 +964,14 @@ private IRenderingElement generateDiagram(IMoleculeSet moleculeSet) {
ElementGroup diagram = new ElementGroup();
for (int i = 0; i < moleculeSet.getAtomContainerCount(); i++) {
IAtomContainer ac = moleculeSet.getAtomContainer(i);
- for (IAtomContainerGenerator generator : this.generators) {
+ for (IGenerator<IAtomContainer> generator : this.generators) {
diagram.add(generator.generate(ac, this.rendererModel));
}
}
return diagram;
}
- public List<IReactionGenerator> getReactionGenerators(){
- return new ArrayList<IReactionGenerator>(reactionGenerators);
+ public List<IGenerator<IReaction>> getReactionGenerators(){
+ return new ArrayList<IGenerator<IReaction>>(reactionGenerators);
}
}
@@ -1,6 +1,4 @@
-/* $Revision$ $Author$ $Date$
- *
- * Copyright (C) 2008 Arvid Berg <goglepox@users.sf.net>
+/* Copyright (C) 2008 Arvid Berg <goglepox@users.sf.net>
*
* Contact: cdk-devel@list.sourceforge.net
*
@@ -33,7 +31,7 @@
/**
* @cdk.module renderextra
*/
-public class AtomContainerBoundsGenerator implements IGenerator {
+public class AtomContainerBoundsGenerator implements IGenerator<IAtomContainer> {
public IRenderingElement generate( IAtomContainer ac, RendererModel model) {
double[] minMax = GeometryTools.getMinMax(ac);
@@ -42,7 +42,7 @@
* @author maclean
* @cdk.module renderextra
*/
-public class AtomNumberGenerator implements IGenerator {
+public class AtomNumberGenerator implements IGenerator<IAtomContainer> {
public static class AtomNumberTextColor extends
AbstractGeneratorParameter<Color> {
@@ -42,7 +42,7 @@
* @author maclean
* @cdk.module renderextra
*/
-public class BoundsGenerator implements IReactionGenerator {
+public class BoundsGenerator implements IGenerator<IReaction> {
/**
* The color of the box drawn at the bounds of a
@@ -1,36 +0,0 @@
-/* Copyright (C) 2009 Gilleain Torrance <gilleain@users.sf.net>
- *
- * Contact: cdk-devel@list.sourceforge.net
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- */
-package org.openscience.cdk.renderer.generators;
-
-import org.openscience.cdk.interfaces.IReaction;
-import org.openscience.cdk.renderer.RendererModel;
-import org.openscience.cdk.renderer.elements.IRenderingElement;
-
-/**
- * A Generator specifically for Reactions.
- *
- * @author maclean
- *
- * @cdk.module renderextra
- */
-public interface IReactionGenerator extends IGenerator {
-
- public IRenderingElement generate(IReaction reaction, RendererModel model);
-
-}
@@ -44,7 +44,7 @@
* @cdk.module renderextra
*
*/
-public class LonePairGenerator implements IGenerator {
+public class LonePairGenerator implements IGenerator<IAtomContainer> {
public LonePairGenerator() {}
@@ -38,7 +38,7 @@
/**
* @cdk.module renderextra
*/
-public class MappingGenerator implements IReactionGenerator {
+public class MappingGenerator implements IGenerator<IReaction> {
/**
* The width on screen of an atom-atom mapping line.
@@ -44,7 +44,7 @@
* @cdk.module renderextra
*
*/
-public class ProductsBoxGenerator implements IReactionGenerator {
+public class ProductsBoxGenerator implements IGenerator<IReaction> {
private static double DISTANCE;
@@ -46,7 +46,7 @@
* @cdk.module renderextra
*
*/
-public class RadicalGenerator implements IGenerator {
+public class RadicalGenerator implements IGenerator<IAtomContainer> {
public RadicalGenerator() {}
@@ -41,7 +41,7 @@
* @cdk.module renderextra
*
*/
-public class ReactantsBoxGenerator implements IReactionGenerator {
+public class ReactantsBoxGenerator implements IGenerator<IReaction> {
public IRenderingElement generate(IReaction reaction, RendererModel model) {
if (!model.getRenderingParameter(ShowReactionBoxes.class).getValue())
@@ -38,7 +38,7 @@
* @cdk.module renderextra
*
*/
-public class ReactionArrowGenerator implements IReactionGenerator {
+public class ReactionArrowGenerator implements IGenerator<IReaction> {
public IRenderingElement generate(IReaction reaction, RendererModel model) {
Rectangle2D totalBoundsReactants =
@@ -41,7 +41,7 @@
* @cdk.module renderextra
*
*/
-public class ReactionBoxGenerator implements IReactionGenerator {
+public class ReactionBoxGenerator implements IGenerator<IReaction> {
public IRenderingElement generate(IReaction reaction, RendererModel model) {
if (!model.getRenderingParameter(ShowReactionBoxes.class).getValue())
@@ -39,7 +39,7 @@
* @cdk.module renderextra
*
*/
-public class ReactionPlusGenerator implements IReactionGenerator {
+public class ReactionPlusGenerator implements IGenerator<IReaction> {
public IRenderingElement generate(IReaction reaction, RendererModel model) {
ElementGroup diagram = new ElementGroup();
@@ -22,7 +22,7 @@
import java.util.Arrays;
import java.util.List;
-import org.openscience.cdk.interfaces.IAtomContainer;
+import org.openscience.cdk.interfaces.IReaction;
import org.openscience.cdk.renderer.RendererModel;
import org.openscience.cdk.renderer.elements.ElementGroup;
import org.openscience.cdk.renderer.elements.IRenderingElement;
@@ -33,7 +33,7 @@
*
* @cdk.module renderextra
*/
-public class ReactionSceneGenerator implements IGenerator {
+public class ReactionSceneGenerator implements IGenerator<IReaction> {
public static class ShowReactionBoxes extends
AbstractGeneratorParameter<Boolean> {
@@ -55,7 +55,7 @@ public Double getDefault() {
public ReactionSceneGenerator() {}
- public IRenderingElement generate(IAtomContainer ac, RendererModel model) {
+ public IRenderingElement generate(IReaction reaction, RendererModel model) {
return new ElementGroup();
}

0 comments on commit ec9a21e

Please sign in to comment.