Assigns an atom type to an atom

@param  atom  The atom to be aasigned
@param  ID    the atom type id
@exception  NoSuchAtomTypeException  atomType is not known
@return       the assigned atom
333944
private IAtom setAtom(IAtom atom, String ID) throws NoSuchAtomTypeException {
        IAtomType at = null;
        String key = "";
        List<?> data = null;
        Double value = null;

        at = getAtomType(ID);
        if (atom.getSymbol() == null) {
            atom.setSymbol(at.getSymbol());
        }
        atom.setAtomTypeName(at.getAtomTypeName());
        atom.setFormalNeighbourCount(at.getFormalNeighbourCount());
        key = "vdw" + ID;
        data = (List) parameterSet.get(key);
        value = (Double) data.get(0);
        key = "charge" + ID;
        if (parameterSet.containsKey(key)) {
            data = (List) parameterSet.get(key);
            value = (Double) data.get(0);
            atom.setCharge(value.doubleValue());
        }
        Object color = at.getProperty("org.openscience.cdk.renderer.color");
        if (color != null) {
            atom.setProperty("org.openscience.cdk.renderer.color", color);
        }
        if (at.getAtomicNumber() != 0) {
            atom.setAtomicNumber(at.getAtomicNumber());
        }
        if (at.getExactMass() > 0.0) {
            atom.setExactMass(at.getExactMass());
        }
        return atom;
    }
1217279
public Element createElement(String tagName, String id) {
		Element element = DOM.createElement(tagName).cast();
		DOM.setElementAttribute(element, "id", id);
		return element;
	}
1217606
public static final Atom add(Atom a, Atom b){

		Atom c = new AtomImpl();
		c.setX( a.getX() + b.getX() );
		c.setY( a.getY() + b.getY() );
		c.setZ( a.getZ() + b.getZ() );

		return c ;
	}
108687
public static IAtom getAtomById(IAtomContainer ac, String id) throws CDKException {
        for (int i = 0; i < ac.getAtomCount(); i++) {
            if (ac.getAtom(i).getID() != null && ac.getAtom(i).getID().equals(id)) return ac.getAtom(i);
        }
        throw new CDKException("no suc atom");
    }
803722
public IAtom configureMM2BasedAtom(IAtom atom, String hoseCode, boolean hetRing) throws NoSuchAtomTypeException {
        //logger.debug("CONFIGURE MM2 ATOM");
        List<Pattern> atomTypePattern = null;
        MM2BasedAtomTypePattern atp = new MM2BasedAtomTypePattern();
        atomTypePattern = atp.getAtomTypePatterns();
        Double d_tmp = null;
        Pattern p = null;
        String ID = "";
        boolean atomTypeFlag = false;

        if (atom instanceof IPseudoAtom) {
            return atom;
        }

        hoseCode = removeAromaticityFlagsFromHoseCode(hoseCode);

        String[] ids = {"C", "Csp2", "C=", "Csp", "HC", "O", "O=", "N", "Nsp2", "Nsp", "F", "CL", "BR", "I", "S", "S+",
                ">SN", "SO2", "SI", "LP", "HO", "CR3R", "HN", "HOCO", "P", "B", "BTET", "HN2", "C.", "C+", "GE", "SN",
                "PB", "SE", "TE", "D", "NPYD", "CE3R", "N+", "NPYL", "Oar", "Sthi", "N2OX", "HS", "=N=", "NO3", "OM",
                "HN+", "OR", "Car", "HE", "NE", "AR", "KR", "XE", "", "", "", "MG", "PTET", "FE", "FE", "NI", "NI",
                "CO", "CO", "", "", "OX", "OK", "C++", "N=C", "NPD+", "N+=", "N2OX"};

        for (int j = 0; j < atomTypePattern.size(); j++) {
            p = (Pattern) atomTypePattern.get(j);
            Matcher mat = p.matcher(hoseCode);
            if (mat.matches()) {
                ID = ids[j];
                //CHECK Rings 1,2,8,9? Thiole 44? AZO 9? Radical - ? Amid 23/enol 21?
                if (j == 0) {
                    //csp3
                    if (atom.getFlag(CDKConstants.ISINRING)) {
                        if (atom.getProperty("RING_SIZE").equals(Integer.valueOf(3))) {
                            ID = ids[21];
                        } else if (atom.getProperty("RING_SIZE").equals(Integer.valueOf(6))
                                && atom.getFlag(CDKConstants.ISAROMATIC)) {
                            ID = ids[1];
                        } else if (atom.getFlag(CDKConstants.ISAROMATIC)) {
                            ID = ids[1];
                        }
                    }
                } else if (j == 1) {
                    //csp2
                    if (atom.getFlag(CDKConstants.ISINRING)) {
                        if (atom.getProperty("RING_SIZE").equals(Integer.valueOf(6))
                                && atom.getFlag(CDKConstants.ISAROMATIC)) {
                        } else if (atom.getProperty("RING_SIZE").equals(Integer.valueOf(3))) {
                            ID = ids[37];
                        } else {
                            ID = ids[1];
                        }
                    }
                    p = (Pattern) atomTypePattern.get(2);
                    //COOH
                    mat = p.matcher(hoseCode);
                    if (mat.matches() && !atom.getFlag(CDKConstants.ISINRING)) {
                        ID = ids[2];
                    }

                } else if (j == 5) {
                    //OH/Ether
                    if (atom.getFlag(CDKConstants.ISINRING)) {
                        if (atom.getProperty("RING_SIZE").equals(Integer.valueOf(3))) {
                            ID = ids[48];
                            //EPOXY
                        } else if (atom.getProperty("RING_SIZE").equals(Integer.valueOf(5))
                                && atom.getFlag(CDKConstants.ISAROMATIC)) {
                            ID = ids[40];
                        } else {
                            ID = ids[5];
                        }
                    }
                } else if (j == 7) {
                    //n sp3
                    if (atom.getFlag(CDKConstants.ISINRING) && atom.getFlag(CDKConstants.ISAROMATIC)) {
                        if (atom.getProperty("RING_SIZE").equals(Integer.valueOf(5))) {
                            ID = ids[39];
                        }
                    }
                    //Amid
                    p = (Pattern) atomTypePattern.get(77);
                    mat = p.matcher(hoseCode);
                    if (mat.matches() && !atom.getFlag(CDKConstants.ISINRING)) {
                        ID = ids[8];
                    }
                } else if (j == 8) {
                    //nsp2
                    if (atom.getFlag(CDKConstants.ISINRING)) {
                        if (atom.getProperty("RING_SIZE").equals(Integer.valueOf(6))) {
                            ID = ids[36];
                        }
                    }
                    p = (Pattern) atomTypePattern.get(36);
                    //AZO
                    mat = p.matcher(hoseCode);
                    if (mat.matches() && !atom.getFlag(CDKConstants.ISINRING)) {
                        ID = ids[36];
                    }

                } else if (j == 43) {
                    //h thiol
                    d_tmp = (Double) atom.getProperty("MAX_BOND_ORDER");
                    if (d_tmp.doubleValue() > 1) {
                        ID = ids[4];
                    }
                } else if (j == 20) {
                    //h alcohol,ether
                    p = (Pattern) atomTypePattern.get(76);
                    //Enol
                    mat = p.matcher(hoseCode);
                    if (mat.matches() && !atom.getFlag(CDKConstants.ISINRING)) {
                        ID = ids[27];
                    }
                    p = (Pattern) atomTypePattern.get(23);
                    //COOH
                    mat = p.matcher(hoseCode);
                    if (mat.matches() && !atom.getFlag(CDKConstants.ISINRING)) {
                        ID = ids[23];
                    }
                } else if (j == 22) {
                    p = (Pattern) atomTypePattern.get(75);
                    //Amid
                    mat = p.matcher(hoseCode);
                    if (mat.matches()) {
                        ID = ids[27];
                    }
                }

                atomTypeFlag = true;
                //logger.debug("Atom Symbol:" + atom.getSymbol() + " MATCH AtomType> " + ID + " HoseCode>" + hoseCode + " ");
                break;
            }//IF
        }//for end
        if (atomTypeFlag) {
            atomTypeFlag = false;
            return setAtom(atom, ID);
        } else {
            throw new NoSuchAtomTypeException("Atom is unkown: Symbol:" + atom.getSymbol()
                    + " does not MATCH AtomType. HoseCode:" + hoseCode);
        }
    }
583741
protected void setId(String id) {
		if (!StringUtils.hasText(id)) {
			id = null;
		}
		this.id = id;
	}
1143590
@Override
    public boolean matches(IAtom atom) {
        return Preconditions.checkNotNull(atom.getAtomicNumber(), "Atomic number is not set.").equals(
                this.getAtomicNumber());
    }
498768
public void setUUID(String id) {
		try {
			this.value = (id != null) ? UUID.fromString(id) : null;
		} catch (Throwable exception) {
			assert id != null;
			this.value = UUID.nameUUIDFromBytes(id.getBytes());
		}
		this.type = AttributeType.UUID;
		this.assigned = this.value != null;
	}
1087576
public boolean couldMatchAtomType(IAtomContainer atomContainer, IAtom atom, IAtomType atomType) {
        logger.debug("   ... matching atom ", atom.getSymbol(), " vs ", atomType);
        if (atomContainer.getBondOrderSum(atom) + atom.getImplicitHydrogenCount() < atomType.getBondOrderSum()) {
            logger.debug("    Match!");
            return true;
        }
        logger.debug("    No Match");
        return false;
    }
1053195
private static SyntaxType register(String id, String name)
    {
        SyntaxType syntaxType = new SyntaxType(id, name);
        KNOWN_SYNTAX_TYPES.put(id, syntaxType);
        return syntaxType;
    }
578697
public void setAtoms(Atom[] atoms){
		Structure s = new StructureImpl();
		Chain c = new ChainImpl();
		c.setId("A");
		for (Atom a: atoms){
			c.addGroup(a.getGroup());
		}
		s.addChain(c);
		setStructure(s);
	}
344641
@SuppressWarnings("unchecked")
    public <T extends WebLocatorAbstractBuilder> T setId(final String id) {
        pathBuilder.setId(id);
        return (T) this;
    }
123352
public IAtomType[] getAtomTypes(String symbol) {
        logger.debug("Request for atomtype for symbol ", symbol);
        List<IAtomType> atomList = new ArrayList<IAtomType>();
        for (IAtomType atomType : atomTypes.values()) {
            if (Objects.equals(atomType.getSymbol(), symbol)) {
                atomList.add(atomType);
            }
        }
        IAtomType[] atomTypes = (IAtomType[]) atomList.toArray(new IAtomType[atomList.size()]);
        if (atomTypes.length > 0)
            logger.debug("Atomtype for symbol ", symbol, " has this number of types: " + atomTypes.length);
        else
            logger.debug("No atomtype for symbol ", symbol);
        return atomTypes;
    }
1027578
function (obj, path, val) {
/*Line 73 - 'Atom.js' */        if (!obj) return;
/*Line 74 - 'Atom.js' */        var index = path.indexOf('.');
/*Line 75 - 'Atom.js' */        if (index != -1) {
/*Line 76 - 'Atom.js' */            var f = path.substr(0, index);
/*Line 77 - 'Atom.js' */            obj = AtomBinder.getValue(obj, f);
/*Line 78 - 'Atom.js' */            path = path.substr(index + 1);
/*Line 79 - 'Atom.js' */            return Atom.set(obj, path,val);
/*Line 80 - 'Atom.js' */        }
/*Line 81 - 'Atom.js' */        AtomBinder.setValue(obj, path, val);
/*Line 82 - 'Atom.js' */    }
1097105
private void setAtomTypes(IChemObjectBuilder builder) throws Exception {
        String name = "";
        String rootType = "";
        int an = 0;
        int rl = 255;
        int gl = 20;
        int bl = 147;
        int maxbond = 0;

        double mass = 0.0;
        st.nextToken();
        String sid = st.nextToken();
        rootType = st.nextToken();
        name = st.nextToken();
        String san = st.nextToken();
        String sam = st.nextToken();
        String smaxbond = st.nextToken();

        try {
            mass = new Double(sam).doubleValue();
            an = Integer.parseInt(san);
            maxbond = Integer.parseInt(smaxbond);

        } catch (NumberFormatException nfe) {
            throw new IOException("AtomTypeTable.ReadAtypes: " + "Malformed Number");
        }

        IAtomType atomType = builder.newInstance(IAtomType.class, name, rootType);
        atomType.setAtomicNumber(an);
        atomType.setExactMass(mass);
        atomType.setMassNumber(massNumber(an, mass));
        atomType.setFormalNeighbourCount(maxbond);
        atomType.setSymbol(rootType);
        Color co = new Color(rl, gl, bl);
        atomType.setProperty("org.openscience.cdk.renderer.color", co);
        atomType.setAtomTypeName(sid);
        atomTypes.add(atomType);
    }
489993
@SuppressWarnings("unchecked")
    public <T extends XPathBuilder> T setId(final String id) {
        this.id = id;
        return (T) this;
    }
1074932
@Override
    protected void initPrototypeId(int id)
    {
        String s;
        int arity;
        switch (id) {
          case Id_defaultSettings:  arity=0; s="defaultSettings";  break;
          case Id_settings:         arity=0; s="settings";         break;
          case Id_setSettings:      arity=1; s="setSettings";      break;
          default: throw new IllegalArgumentException(String.valueOf(id));
        }
        initPrototypeMethod(XMLCTOR_TAG, id, s, arity);
    }