Adds a functional group to a given atom in the current molecule.

@param funGroupToken The token which denotes this specific functional group.
@param addPos The atom to add the group to.
194709
private void addFunGroup(String funGroupToken, int addPos) {
        //BOND MODIFICATION
        //Alkanes - Single bond
        if ("an".equals(funGroupToken)) {
            //Do nothing since all bonds are single by default.
        }
        //Alkenes - Double bond
        else if ("en".equals(funGroupToken)) {
            //If functional group hasn't had a location specified:
            if (addPos < 0) {
                //Set the first bond to an order of 2 (i.e. a double bond)
                currentMolecule.getBond(0).setOrder(IBond.Order.DOUBLE);
            } else {
                //Set the addPos'th bond to an order of 2 (i.e. a double bond)
                currentMolecule.getBond(addPos).setOrder(IBond.Order.DOUBLE);
            }
        }
        //Alkynes - Tripple bond
        else if ("yn".equals(funGroupToken)) {
            //If functional group hasn't had a location specified:
            if (addPos < 0) {
                //Set the first bond to an order of 3 (i.e. a tripple bond)
                currentMolecule.getBond(0).setOrder(IBond.Order.TRIPLE);
            } else {
                //Set the addPos'th bond to an order of 3 (i.e. a tripple bond)
                currentMolecule.getBond(addPos).setOrder(IBond.Order.TRIPLE);
            }
        }
        //FUNCTIONAL GROUP SUFFIXES
        //Ending "e"
        else if ("e".equals(funGroupToken)) {
            //Do nothing, since the "e" is found at the end of chain names
            //with a bond modifer but no functional groups.
        }
        //Alcohols
        else if ("ol".equals(funGroupToken) || "hydroxy".equals(funGroupToken)) {
            //If functional group hasn't had a location specified:
            if (addPos < 0) {
                addAtom("O", endOfChain, IBond.Order.SINGLE, 1);
            } else {
                addAtom("O", currentMolecule.getAtom(addPos), IBond.Order.SINGLE, 1);
            }
        }
        //Aldehydes
        else if ("al".equals(funGroupToken)) {
            addAtom("O", endOfChain, IBond.Order.DOUBLE, 0);
        }
        //Carboxylic acid
        else if ("oic acid".equals(funGroupToken)) {
            addAtom("O", endOfChain, IBond.Order.DOUBLE, 0);
            addAtom("O", endOfChain, IBond.Order.SINGLE, 1);
        }
        //Carboxylic Acid Chloride
        else if ("oyl chloride".equals(funGroupToken)) {
            addAtom("O", endOfChain, IBond.Order.DOUBLE, 0);
            addAtom("Cl", endOfChain, IBond.Order.SINGLE, 0);
        }
        //PREFIXES
        //Halogens
        //Chlorine
        else if ("chloro".equals(funGroupToken)) {
            //If functional group hasn't had a location specified:
            if (addPos < 0) {
                addAtom("Cl", currentMolecule.isEmpty() ? null : currentMolecule.getAtom(0), IBond.Order.SINGLE, 0);
            } else {
                addAtom("Cl", currentMolecule.getAtom(addPos), IBond.Order.SINGLE, 0);
            }
        }
        //Fluorine
        else if ("fluoro".equals(funGroupToken)) {
            //If functional group hasn't had a location specified:
            if (addPos < 0) {
                addAtom("F", currentMolecule.isEmpty() ? null : currentMolecule.getAtom(0), IBond.Order.SINGLE, 0);
            } else {
                addAtom("F", currentMolecule.getAtom(addPos), IBond.Order.SINGLE, 0);
            }
        }
        //Bromine
        else if ("bromo".equals(funGroupToken)) {
            //If functional group hasn't had a location specified:
            if (addPos < 0) {
                addAtom("Br", currentMolecule.isEmpty() ? null : currentMolecule.getAtom(0), IBond.Order.SINGLE, 0);
            } else {
                addAtom("Br", currentMolecule.getAtom(addPos), IBond.Order.SINGLE, 0);
            }
        }
        //Iodine
        else if ("iodo".equals(funGroupToken)) {
            //If functional group hasn't had a location specified:
            if (addPos < 0) {
                addAtom("I", currentMolecule.isEmpty() ? null : currentMolecule.getAtom(0), IBond.Order.SINGLE, 0);
            } else {
                addAtom("I", currentMolecule.getAtom(addPos), IBond.Order.SINGLE, 0);
            }
        }
        //Nitro
        else if ("nitro".equals(funGroupToken)) {
            //If functional group hasn't had a location specified:
            if (addPos < 0) {
                addAtom("N", currentMolecule.isEmpty() ? null : currentMolecule.getAtom(0), IBond.Order.SINGLE, 0);
            } else {
                addAtom("N", currentMolecule.getAtom(addPos), IBond.Order.SINGLE, 0);
            }

            //Stuff which applied no matter where the N atom is:
            IAtom nitrogenAtom = currentMolecule.getAtom(currentMolecule.getAtomCount());
            nitrogenAtom.setFormalCharge(+1);
            addAtom("O", nitrogenAtom, IBond.Order.SINGLE, 0);
            currentMolecule.getAtom(currentMolecule.getAtomCount()).setFormalCharge(-1);
            addAtom("O", nitrogenAtom, IBond.Order.DOUBLE, 0);
        }
        //Oxo
        else if ("oxo".equals(funGroupToken)) {
            //If functional group hasn't had a location specified:
            if (addPos < 0) {
                addAtom("O", currentMolecule.isEmpty() ? null : currentMolecule.getAtom(0), IBond.Order.DOUBLE, 0);
            } else {
                addAtom("O", currentMolecule.getAtom(addPos), IBond.Order.DOUBLE, 0);
            }
        }
        //Nitrile
        else if ("nitrile".equals(funGroupToken)) {
            addAtom("N", currentMolecule.isEmpty() ? null : currentMolecule.getAtom(0), IBond.Order.TRIPLE, 0);
        }
        //Benzene
        else if ("phenyl".equals(funGroupToken)) {
            IAtomContainer benzene = makeBenzene();
            //Detect Aromacity in the benzene ring.
            try {
                AtomContainerManipulator.percieveAtomTypesAndConfigureAtoms(benzene);
                Aromaticity.cdkLegacy().apply(benzene);
            } catch (CDKException exc) {
                //                logger.debug("No atom detected");
            }
            currentMolecule.add(benzene);

            IBond joiningBond;
            //If functional group hasn't had a location specified:
            if (addPos < 0) {
                joiningBond = currentMolecule.getBuilder().newInstance(IBond.class, currentMolecule.isEmpty() ? null : currentMolecule.getAtom(0),
                        benzene.getAtom(0));
            } else {
                joiningBond = currentMolecule.getBuilder().newInstance(IBond.class, currentMolecule.getAtom(addPos),
                        benzene.getAtom(0));
            }
            currentMolecule.addBond(joiningBond);
        } else if ("amino".equals(funGroupToken)) {
            //If functional group hasn't had a location specified:
            if (addPos < 0) {
                addAtom("N", currentMolecule.isEmpty() ? null : currentMolecule.getAtom(0), IBond.Order.SINGLE, 2);
            } else {
                addAtom("N", currentMolecule.getAtom(addPos), IBond.Order.SINGLE, 2);
            }
        }
        //ORGANO METALLICS ADDED AS PREFIXES
        else if ("alumino".equals(funGroupToken)) {
            //If functional group hasn't had a location specified:
            if (addPos < 0) {
                addAtom("Al", currentMolecule.isEmpty() ? null : currentMolecule.getAtom(0), IBond.Order.SINGLE, 2);
            } else {
                addAtom("Al", currentMolecule.getAtom(addPos), IBond.Order.SINGLE, 2);
            }
        } else if ("litho".equals(funGroupToken)) {
            //If functional group hasn't had a location specified:
            if (addPos < 0) {
                addAtom("Li", currentMolecule.isEmpty() ? null : currentMolecule.getAtom(0), IBond.Order.SINGLE, 2);
            } else {
                addAtom("Li", currentMolecule.getAtom(addPos), IBond.Order.SINGLE, 2);
            }
        }
        //PRIORITY SUBSTITUENTS

        //FUNCTIONAL GROUPS WHICH MAY HAVE THEIR OWN SUBSTITUENTS
        //Esters ("...oate")
        else if ("oate".equals(funGroupToken)) {
            addAtom("O", endOfChain, IBond.Order.DOUBLE, 0);
            addAtom("O", endOfChain, IBond.Order.SINGLE, 0);
            //Set the end of the chain to be built on for unspecified substituents.
            endOfChain = currentMolecule.getAtom(currentMolecule.getAtomCount());
        }
        //Amines
        else if ("amine".equals(funGroupToken)) {
            addAtom("N", endOfChain, IBond.Order.SINGLE, 1);
            //Set the end of the chain to be built on for unspecified substituents.
            endOfChain = currentMolecule.getAtom(currentMolecule.getAtomCount());
        }
        //Amides
        else if ("amide".equals(funGroupToken)) {
            addAtom("O", endOfChain, IBond.Order.DOUBLE, 0);
            addAtom("N", endOfChain, IBond.Order.SINGLE, 1);
            //Set the end of the chain to be built on for unspecified substituents.
            endOfChain = currentMolecule.getAtom(currentMolecule.getAtomCount());
        }
        //Ketones
        else if ("one".equals(funGroupToken)) {
            addAtom("O", endOfChain, IBond.Order.DOUBLE, 2);
            //End of chain doesn't change in this case
        }
        //Organometals
        else if (getMetalAtomicSymbol(funGroupToken) != null) {
            currentMolecule.addAtom(currentMolecule.getBuilder().newInstance(IAtom.class,
                    getMetalAtomicSymbol(funGroupToken)));
            endOfChain = currentMolecule.getAtom(currentMolecule.getAtomCount());
        } else {
            //            logger.debug("Encountered unknown group: " + funGroupToken + " at " + addPos +
            //            "\nThe parser thinks this is valid but the molecule builder has no logic for it");
        }
    }
1151143
private function addGroupElement($groupId, $h, $v, $sx, $sy)
        {
            $this->groups[$groupId]->total++;
            if ($h)
                $this->groups[$groupId]->horizontal = true;
            if ($v)
                $this->groups[$groupId]->vertical = true;                
            $this->groups[$groupId]->points[] = array($sx, $sy, false);
        }
717741
public GroupOptions addGroupByField(String fieldName) {

		Assert.hasText(fieldName, "Field.name for grouping must not be null/empty.");
		groupByFields.add(new SimpleField(fieldName));
		return this;
	}
165660
public static void putToken(Bundle bundle, String value) {
        Validate.notNull(bundle, "bundle");
        Validate.notNull(value, "value");
        bundle.putString(TOKEN_KEY, value);
    }
417325
private void add(String pos, String s) {
		if(s.length()>maxLen)
			return;
		if(pos.length()==0)
			return;
		posSet.add(pos);
		if(dict.containsKey(s)){
			TreeSet<String> sett = dict.get(s);
			sett.add(pos);
		}else{
			TreeSet<String> sett  = new TreeSet<String>();
			sett.add(pos);
			dict.put(s, sett);
		}
	}
247034
public final <T> void addOption(Class<T> cls, String name, String description, String exclusiveGroup)
    {
        addOption(cls, name, description, exclusiveGroup, true);
    }
212763
public void addGroup(CmsAdminMenuGroup group, float position) {

        m_groupContainer.addIdentifiableObject(group.getName(), group, position);
    }
627511
public void addGroupBy(String fieldName)
    {
        if (fieldName != null)
        {
            _getGroupby().add(new FieldHelper(fieldName, false));
        }
    }
714014
public void add(IRenderingElement element) {
        if (element != null) {
            if (element.getClass().equals(ElementGroup.class))
                elements.addAll(((ElementGroup) element).elements);
            else
                elements.add(element);
        }
    }
902859
public OptionGroup addOption(Option option) {
        if (option == null) {
            throw new IllegalArgumentException("Option cannot be null");
        }

        String value = option.getValue();

        if (options.containsKey(value)) {
            throw new IllegalArgumentException("An option with value '" + value + "' already exists in this group");
        }

        options.put(value, option);
        return this;
    }
769322
protected void addGroupToRole(String group, String role) {
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
            SibTr.entry(tc, CLASS_NAME + "addGroupToRole", new Object[] { group, role });
        }
        Set<String> groupsForTheRole = roleToGroupMap.get(role);
        if (groupsForTheRole != null) {
            groupsForTheRole.add(group);
        } else {
            groupsForTheRole = new HashSet<String>();
            groupsForTheRole.add(group);
        }
        roleToGroupMap.put(role, groupsForTheRole);
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
            SibTr.exit(tc, CLASS_NAME + "addGroupToRole");
        }
    }
419194
public ElementWithOptions addOptionToGroup(Object value, String text, String groupId) {
        String valueString = "";
        if (value != null) {
            valueString = value.toString();
        }

        return addOptionToGroup(valueString, text, groupId);
    }
645877
private void addGroup(List<Token> group, List<List<Token>> groups) {

    if(group.isEmpty()) return;

    // remove trailing tokens that should be ignored
    while(!group.isEmpty() && IGNORED_TRAILING_TOKENS.contains(
        group.get(group.size() - 1).getType())) {
      group.remove(group.size() - 1);
    }

    // if the group still has some tokens left, we'll add it to our list of groups
    if(!group.isEmpty()) {
      groups.add(group);
    }
  }
990776
function addGroup(group, options) {
  options = _.opts(options, {gid: null});
  if (!runningAsRoot()) return;
  if (!group) throw new Error('You must provide a group');
  if (groupExists(group)) {
    return;
  }

  if (isPlatform('linux')) {
    _addGroupLinux(group, options);
  } else if (isPlatform('osx')) {
    _addGroupOsx(group, options);
  } else if (isPlatform('windows')) {
    throw new Error(`Don't know how to add group ${group} on Windows`);
  } else {
    throw new Error(`Don't know how to add group ${group} in current platform`);
  }
}
826316
private void appendFunctionParamAnnotations(
      StringBuilder sb, FunctionType funType, Node paramNode) {
    int minArity = funType.getMinArity();
    int maxArity = funType.getMaxArity();
    List<JSType> formals = ImmutableList.copyOf(funType.getParameterTypes());
    for (int i = 0; i < formals.size(); i++) {
      sb.append(" * ");
      appendAnnotation(sb, "param", getParameterJSDocType(formals, i, minArity, maxArity));
      String parameterName = getParameterJSDocName(paramNode, i);
      sb.append(" ").append(parameterName).append("\n");
      if (paramNode != null) {
        paramNode = paramNode.getNext();
      }
    }
  }
1285007
public void addChargeGroup(ChargeGroup chargeGroup) {
        if (chargeGroups == null) chargeGroups = new ArrayList<ChargeGroup>();

        //Check if exists
        if (chargeGroups.contains(chargeGroup)) {
            System.out.println("Charge group: " + chargeGroup.getNumber() + " already present in molecule: " + getID());
            return;
        }

        chargeGroups.add(chargeGroup);
    }
553259
public void placeRing(IRing ring, Point2d ringCenter, double bondLength, Map<Integer, Double> startAngles) {
        double radius = this.getNativeRingRadius(ring, bondLength);
        double addAngle = 2 * Math.PI / ring.getRingSize();

        IAtom startAtom = ring.getAtom(0);
        Point2d p = new Point2d(ringCenter.x + radius, ringCenter.y);
        startAtom.setPoint2d(p);
        double startAngle = Math.PI * 0.5;

        /*
         * Different ring sizes get different start angles to have visually
         * correct placement
         */
        int ringSize = ring.getRingSize();
        if (startAngles.get(ringSize) != null) startAngle = startAngles.get(ringSize);

        List<IBond> bonds = ring.getConnectedBondsList(startAtom);
        /*
         * Store all atoms to draw in consecutive order relative to the chosen
         * bond.
         */
        Vector<IAtom> atomsToDraw = new Vector<IAtom>();
        IAtom currentAtom = startAtom;
        IBond currentBond = (IBond) bonds.get(0);
        for (int i = 0; i < ring.getBondCount(); i++) {
            currentBond = ring.getNextBond(currentBond, currentAtom);
            currentAtom = currentBond.getOther(currentAtom);
            atomsToDraw.addElement(currentAtom);
        }
        atomPlacer.populatePolygonCorners(atomsToDraw, ringCenter, startAngle, addAngle, radius);
    }