test_class.declarator: generator
test_class.modifier: private
test_class.original_string: private RadicalGenerator generator;
test_class.type: RadicalGenerator
test_class.var_name: generator
test_class.file: display/renderextra/src/test/java/org/openscience/cdk/renderer/generators/RadicalGeneratorTest.java
test_class.identifier: RadicalGeneratorTest
test_class.superclass: extends AbstractGeneratorTest
test_case.body: @Test
      public void testEmptyContainer() {
          IAtomContainer emptyContainer = super.builder.newInstance(IAtomContainer.class);
  
          // nothing should be made
          IRenderingElement root = generator.generate(emptyContainer, model);
          List<IRenderingElement> elements = elementUtil.getAllSimpleElements(root);
          Assert.assertEquals(0, elements.size());
      }
test_case.class_method_signature: RadicalGeneratorTest.testEmptyContainer()
test_case.full_signature: @Test public void testEmptyContainer()
test_case.identifier: testEmptyContainer
test_case.invocations: newInstance generate getAllSimpleElements assertEquals size
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void testEmptyContainer()
focal_class.file: display/renderextra/src/main/java/org/openscience/cdk/renderer/generators/RadicalGenerator.java
focal_class.identifier: RadicalGenerator
focal_class.interfaces: implements IGenerator<IAtomContainer>
focal_class.class_method_signature: RadicalGenerator.RadicalGenerator()
focal_class.full_signature: public  RadicalGenerator()
focal_class.identifier: RadicalGenerator
focal_class.modifiers: public
focal_class.parameters: ()
focal_class.signature:  RadicalGenerator()
focal_class.class_method_signature: RadicalGenerator.generate(IAtomContainer container, RendererModel model)
focal_class.full_signature: @Override public IRenderingElement generate(IAtomContainer container, RendererModel model)
focal_class.identifier: generate
focal_class.modifiers: @Override public
focal_class.parameters: (IAtomContainer container, RendererModel model)
focal_class.return: IRenderingElement
focal_class.signature: IRenderingElement generate(IAtomContainer container, RendererModel model)
focal_class.class_method_signature: RadicalGenerator.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(IAtomContainer container, RendererModel model) {
          ElementGroup group = new ElementGroup();
  
          // TODO : put into RendererModel
          final double SCREEN_RADIUS = 2.0;
          final Color RADICAL_COLOR = Color.BLACK;
  
          // XXX : is this the best option?
          final double ATOM_RADIUS = ((AtomRadius) model.getParameter(AtomRadius.class)).getValue()
                  / model.getParameter(Scale.class).getValue();
  
          double modelRadius = SCREEN_RADIUS / model.getParameter(Scale.class).getValue();
          double modelSpacing = modelRadius * 2.5;
          Map<IAtom, Integer> singleElectronsPerAtom = new HashMap<IAtom, Integer>();
          for (ISingleElectron electron : container.singleElectrons()) {
              IAtom atom = electron.getAtom();
              if (singleElectronsPerAtom.get(atom) == null) singleElectronsPerAtom.put(atom, 0);
              Point2d point = atom.getPoint2d();
              int align = GeometryUtil.getBestAlignmentForLabelXY(container, atom);
              double xRadius = point.x;
              double yRadius = point.y;
              if (align == 1) {
                  xRadius += ATOM_RADIUS * 4 + singleElectronsPerAtom.get(atom) * modelSpacing;
              } else if (align == -1) {
                  xRadius -= ATOM_RADIUS * 4 + singleElectronsPerAtom.get(atom) * modelSpacing;
              } else if (align == 2) {
                  yRadius += ATOM_RADIUS * 4 + singleElectronsPerAtom.get(atom) * modelSpacing;
              } else if (align == -2) {
                  yRadius -= ATOM_RADIUS * 4 + singleElectronsPerAtom.get(atom) * modelSpacing;
              }
              singleElectronsPerAtom.put(atom, singleElectronsPerAtom.get(atom) + 1);
              group.add(new OvalElement(xRadius, yRadius, modelRadius, true, RADICAL_COLOR));
          }
          return group;
      }
focal_method.class_method_signature: RadicalGenerator.generate(IAtomContainer container, RendererModel model)
focal_method.full_signature: @Override public IRenderingElement generate(IAtomContainer container, RendererModel model)
focal_method.identifier: generate
focal_method.invocations: getValue getParameter getValue getParameter getValue getParameter singleElectrons getAtom get put getPoint2d getBestAlignmentForLabelXY get get get get put get add
focal_method.modifiers: @Override public
focal_method.parameters: (IAtomContainer container, RendererModel model)
focal_method.return: IRenderingElement
focal_method.signature: IRenderingElement generate(IAtomContainer container, RendererModel model)