test_class.declarator: generator
test_class.modifier: private
test_class.original_string: private ReactionPlusGenerator generator;
test_class.type: ReactionPlusGenerator
test_class.var_name: generator
test_class.file: display/renderextra/src/test/java/org/openscience/cdk/renderer/generators/ReactionPlusGeneratorTest.java
test_class.identifier: ReactionPlusGeneratorTest
test_class.superclass: extends AbstractGeneratorTest
test_case.body: @Test
      public void testEmptyReaction() {
          IReaction singleReaction = super.builder.newInstance(IReaction.class);
  
          // nothing should be made
          IRenderingElement root = generator.generate(singleReaction, model);
          List<IRenderingElement> elements = elementUtil.getAllSimpleElements(root);
          Assert.assertEquals(0, elements.size());
      }
test_case.class_method_signature: ReactionPlusGeneratorTest.testEmptyReaction()
test_case.full_signature: @Test public void testEmptyReaction()
test_case.identifier: testEmptyReaction
test_case.invocations: newInstance generate getAllSimpleElements assertEquals size
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void testEmptyReaction()
focal_class.file: display/renderextra/src/main/java/org/openscience/cdk/renderer/generators/ReactionPlusGenerator.java
focal_class.identifier: ReactionPlusGenerator
focal_class.interfaces: implements IGenerator<IReaction>
focal_class.class_method_signature: ReactionPlusGenerator.generate(IReaction reaction, RendererModel model)
focal_class.full_signature: @Override public IRenderingElement generate(IReaction reaction, RendererModel model)
focal_class.identifier: generate
focal_class.modifiers: @Override public
focal_class.parameters: (IReaction reaction, RendererModel model)
focal_class.return: IRenderingElement
focal_class.signature: IRenderingElement generate(IReaction reaction, RendererModel model)
focal_class.class_method_signature: ReactionPlusGenerator.makePlus(Rectangle2D moleculeBox1, Rectangle2D moleculeBox2, double axis, Color color)
focal_class.full_signature: private TextElement makePlus(Rectangle2D moleculeBox1, Rectangle2D moleculeBox2, double axis, Color color)
focal_class.identifier: makePlus
focal_class.modifiers: private
focal_class.parameters: (Rectangle2D moleculeBox1, Rectangle2D moleculeBox2, double axis, Color color)
focal_class.return: TextElement
focal_class.signature: TextElement makePlus(Rectangle2D moleculeBox1, Rectangle2D moleculeBox2, double axis, Color color)
focal_class.class_method_signature: ReactionPlusGenerator.getParameters()
focal_class.full_signature: @Override public List<IGeneratorParameter<?>> getParameters()
focal_class.identifier: getParameters
focal_class.modifiers: @Override public
focal_class.parameters: ()
focal_class.return: List<IGeneratorParameter<?>>
focal_class.signature: List<IGeneratorParameter<?>> getParameters()
focal_method.body: @Override
      public IRenderingElement generate(IReaction reaction, RendererModel model) {
          ElementGroup diagram = new ElementGroup();
  
          Color color = model.getParameter(BasicSceneGenerator.ForegroundColor.class).getValue();
          IAtomContainerSet reactants = reaction.getReactants();
  
          // only draw + signs when there are more than one reactant
          if (reactants.getAtomContainerCount() > 1) {
              Rectangle2D totalBoundsReactants = BoundsCalculator.calculateBounds(reactants);
              Rectangle2D bounds1 = BoundsCalculator.calculateBounds(reactants.getAtomContainer(0));
              double axis = totalBoundsReactants.getCenterY();
              for (int i = 1; i < reaction.getReactantCount(); i++) {
                  Rectangle2D bounds2 = BoundsCalculator.calculateBounds(reactants.getAtomContainer(i));
                  diagram.add(makePlus(bounds1, bounds2, axis, color));
                  bounds1 = bounds2;
              }
          }
  
          // only draw + signs when there are more than one products
          IAtomContainerSet products = reaction.getProducts();
          if (products.getAtomContainerCount() > 1) {
              Rectangle2D totalBoundsProducts = BoundsCalculator.calculateBounds(products);
              double axis = totalBoundsProducts.getCenterY();
              Rectangle2D bounds1 = BoundsCalculator.calculateBounds(reactants.getAtomContainer(0));
              for (int i = 1; i < reaction.getProductCount(); i++) {
                  Rectangle2D bounds2 = BoundsCalculator.calculateBounds(products.getAtomContainer(i));
  
                  diagram.add(makePlus(bounds1, bounds2, axis, color));
                  bounds1 = bounds2;
              }
          }
          return diagram;
      }
focal_method.class_method_signature: ReactionPlusGenerator.generate(IReaction reaction, RendererModel model)
focal_method.full_signature: @Override public IRenderingElement generate(IReaction reaction, RendererModel model)
focal_method.identifier: generate
focal_method.invocations: getValue getParameter getReactants getAtomContainerCount calculateBounds calculateBounds getAtomContainer getCenterY getReactantCount calculateBounds getAtomContainer add makePlus getProducts getAtomContainerCount calculateBounds getCenterY calculateBounds getAtomContainer getProductCount calculateBounds getAtomContainer add makePlus
focal_method.modifiers: @Override public
focal_method.parameters: (IReaction reaction, RendererModel model)
focal_method.return: IRenderingElement
focal_method.signature: IRenderingElement generate(IReaction reaction, RendererModel model)