public override void endElement(CMLStack xpath, System.String uri, System.String local, System.String raw)
 {
     System.String name = local;
     if (current == ENERGY)
     {
         cdo.setObjectProperty("Frame", "energy", frame_energy);
         // + " " + units);
         current      = UNKNOWN;
         frame_energy = "";
     }
     else if (name.Equals("list"))
     {
         base.endElement(xpath, uri, local, raw);
         cdo.endObject("Animation");
     }
     else if (name.Equals("molecule"))
     {
         base.endElement(xpath, uri, local, raw);
         cdo.endObject("Frame");
     }
     else
     {
         base.endElement(xpath, uri, local, raw);
     }
 }
Esempio n. 2
0
 public override void endElement(CMLStack xpath, System.String uri, System.String local, System.String raw)
 {
     if ("reaction".Equals(local))
     {
         cdo.endObject("Reaction");
     }
     else if ("reactionList".Equals(local))
     {
         cdo.endObject("SetOfReactions");
     }
     else if ("reactant".Equals(local))
     {
         cdo.endObject("Reactant");
     }
     else if ("product".Equals(local))
     {
         cdo.endObject("Product");
     }
     else if ("molecule".Equals(local))
     {
         //logger.debug("Storing Molecule");
         base.storeData();
         // do nothing else but store atom/bond information
     }
     else
     {
         base.endElement(xpath, uri, local, raw);
     }
 }
Esempio n. 3
0
 /// <summary> Constructor for the CMLHandler.
 ///
 /// </summary>
 /// <param name="cdo">The Chemical Document Object in which data is stored
 ///
 /// </param>
 public CMLHandler(IChemicalDocumentObject cdo)
 {
     //logger = new LoggingTool(this);
     conv            = new CMLCoreModule(cdo);
     userConventions = System.Collections.Hashtable.Synchronized(new System.Collections.Hashtable());
     xpath           = new CMLStack();
     conventionStack = new CMLStack();
 }
Esempio n. 4
0
 /// <summary> Constructor for the CMLHandler.
 /// 
 /// </summary>
 /// <param name="cdo">The Chemical Document Object in which data is stored
 /// 
 /// </param>
 public CMLHandler(IChemicalDocumentObject cdo)
 {
     //logger = new LoggingTool(this);
     conv = new CMLCoreModule(cdo);
     userConventions = System.Collections.Hashtable.Synchronized(new System.Collections.Hashtable());
     xpath = new CMLStack();
     conventionStack = new CMLStack();
 }
Esempio n. 5
0
 public override void characterData(CMLStack xpath, char[] ch, int start, int length)
 {
     System.String s = new System.String(ch, start, length).Trim();
     //logger.debug("Start PMP chardata (" + CurrentElement + ") :" + s);
     //logger.debug(" ElTitle: " + elementTitle);
     if (xpath.ToString().EndsWith("string/") && BUILTIN.Equals("spacegroup"))
     {
         System.String sg = "P1";
         // standardize space group names (see Crystal.java)
         if ("P 21 21 21 (1)".Equals(s))
         {
             sg = "P 2_1 2_1 2_1";
         }
         cdo.setObjectProperty("Crystal", "spacegroup", sg);
     }
     else
     {
         if (xpath.ToString().EndsWith("floatArray/") && (elementTitle.Equals("a") || elementTitle.Equals("b") || elementTitle.Equals("c")))
         {
             System.String axis = elementTitle + "-axis";
             cdo.startObject(axis);
             try
             {
                 SupportClass.Tokenizer st = new SupportClass.Tokenizer(s);
                 //logger.debug("Tokens: " + st.Count);
                 if (st.Count > 2)
                 {
                     System.String token = st.NextToken();
                     //logger.debug("FloatArray (Token): " + token);
                     cdo.setObjectProperty(axis, "x", token);
                     token = st.NextToken();
                     //logger.debug("FloatArray (Token): " + token);
                     cdo.setObjectProperty(axis, "y", token);
                     token = st.NextToken();
                     //logger.debug("FloatArray (Token): " + token);
                     cdo.setObjectProperty(axis, "z", token);
                 }
                 else
                 {
                     //logger.debug("PMP Convention error: incorrect number of cell axis fractions!\n");
                 }
             }
             catch (System.Exception e)
             {
                 //UPGRADE_TODO: The equivalent in .NET for method 'java.lang.Throwable.toString' may return a different value. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1043'"
                 //logger.debug("PMP Convention error: " + e.ToString());
             }
             cdo.endObject(axis);
         }
         else
         {
             base.characterData(xpath, ch, start, length);
         }
     }
     //logger.debug("End PMP chardata");
 }
 public override void characterData(CMLStack xpath, char[] ch, int start, int length)
 {
     if (current == ENERGY)
     {
         frame_energy = new System.String(ch, start, length);
     }
     else
     {
         base.characterData(xpath, ch, start, length);
     }
 }
Esempio n. 7
0
        public override void endElement(CMLStack xpath, System.String uri, System.String local, System.String raw)
        {
            System.String name = raw;

            if (name.Equals("list") && connectionTable && !isBond)
            {
                //logger.debug("End Connection Table");
                connectionTable = false;
            }

            isELSYM = false;
            isBond  = false;
            base.endElement(xpath, uri, local, raw);
        }
 public override void startElement(CMLStack xpath, System.String uri, System.String local, System.String raw, SaxAttributesSupport atts)
 {
     System.String name = local;
     if (name.Equals("list"))
     {
         //logger.debug("Oke, JMOLANIMATION seems to be kicked in :)");
         cdo.startObject("Animation");
         base.startElement(xpath, uri, local, raw, atts);
     }
     else if (name.Equals("molecule"))
     {
         cdo.startObject("Frame");
         //logger.debug("New frame being parsed.");
         base.startElement(xpath, uri, local, raw, atts);
     }
     else if (name.Equals("float"))
     {
         bool isEnergy = false;
         //logger.debug("FLOAT found!");
         for (int i = 0; i < atts.GetLength(); i++)
         {
             //logger.debug(" att: ", atts.GetFullName(i), " -> ", atts.GetValue(i));
             if (atts.GetFullName(i).Equals("title") && atts.GetValue(i).Equals("FRAME_ENERGY"))
             {
                 isEnergy = true;
             }
         }
         if (isEnergy)
         {
             // oke, this is the frames energy!
             current = ENERGY;
         }
         else
         {
             base.startElement(xpath, uri, local, raw, atts);
         }
     }
     else
     {
         base.startElement(xpath, uri, local, raw, atts);
     }
 }
 public override void startElement(CMLStack xpath, System.String uri, System.String local, System.String raw, SaxAttributesSupport atts)
 {
     System.String name = local;
     if (name.Equals("list"))
     {
         //logger.debug("Oke, JMOLANIMATION seems to be kicked in :)");
         cdo.startObject("Animation");
         base.startElement(xpath, uri, local, raw, atts);
     }
     else if (name.Equals("molecule"))
     {
         cdo.startObject("Frame");
         //logger.debug("New frame being parsed.");
         base.startElement(xpath, uri, local, raw, atts);
     }
     else if (name.Equals("float"))
     {
         bool isEnergy = false;
         //logger.debug("FLOAT found!");
         for (int i = 0; i < atts.GetLength(); i++)
         {
             //logger.debug(" att: ", atts.GetFullName(i), " -> ", atts.GetValue(i));
             if (atts.GetFullName(i).Equals("title") && atts.GetValue(i).Equals("FRAME_ENERGY"))
             {
                 isEnergy = true;
             }
         }
         if (isEnergy)
         {
             // oke, this is the frames energy!
             current = ENERGY;
         }
         else
         {
             base.startElement(xpath, uri, local, raw, atts);
         }
     }
     else
     {
         base.startElement(xpath, uri, local, raw, atts);
     }
 }
Esempio n. 10
0
        public override void characterData(CMLStack xpath, char[] ch, int start, int length)
        {
            System.String s = new System.String(ch, start, length).Trim();

            if (isELSYM)
            {
                elsym.Add(s);
            }
            else if (isBond)
            {
                //logger.debug("CD (bond): " + s);

                if (connect_root.Length > 0)
                {
                    SupportClass.Tokenizer st = new SupportClass.Tokenizer(s);

                    while (st.HasMoreTokens())
                    {
                        System.String atom = (System.String)st.NextToken();

                        if (!atom.Equals("0"))
                        {
                            //logger.debug("new bond: " + connect_root + "-" + atom);
                            cdo.startObject("Bond");

                            int atom1 = System.Int32.Parse(connect_root) - 1;
                            int atom2 = System.Int32.Parse(atom) - 1;
                            cdo.setObjectProperty("Bond", "atom1", ((System.Int32)atom1).ToString());
                            cdo.setObjectProperty("Bond", "atom2", ((System.Int32)atom2).ToString());
                            cdo.setObjectProperty("Bond", "order", "1");
                            cdo.endObject("Bond");
                        }
                    }
                }
            }
            else
            {
                base.characterData(xpath, ch, start, length);
            }
        }
Esempio n. 11
0
 public override void characterData(CMLStack xpath, char[] ch, int start, int length)
 {
     System.String s = new System.String(ch, start, length).Trim();
     if (xpath.ToString().EndsWith("string/") && BUILTIN.Equals("stereo"))
     {
         stereoGiven = true;
         if (s.Trim().Equals("W"))
         {
             //logger.debug("CML W stereo found");
             bondStereo.Add("1");
         }
         else if (s.Trim().Equals("H"))
         {
             //logger.debug("CML H stereo found");
             bondStereo.Add("6");
         }
     }
     else
     {
         base.characterData(xpath, ch, start, length);
     }
 }
Esempio n. 12
0
 public override void characterData(CMLStack xpath, char[] ch, int start, int length)
 {
     System.String s = new System.String(ch, start, length).Trim();
     if (xpath.ToString().EndsWith("string/") && BUILTIN.Equals("stereo"))
     {
         stereoGiven = true;
         if (s.Trim().Equals("W"))
         {
             //logger.debug("CML W stereo found");
             bondStereo.Add("1");
         }
         else if (s.Trim().Equals("H"))
         {
             //logger.debug("CML H stereo found");
             bondStereo.Add("6");
         }
     }
     else
     {
         base.characterData(xpath, ch, start, length);
     }
 }
Esempio n. 13
0
        public override void startElement(CMLStack xpath, System.String uri, System.String local, System.String raw, SaxAttributesSupport atts)
        {
            System.String name = raw;
            isELSYM = false;

            if ("list".Equals(name))
            {
                for (int i = 0; i < atts.GetLength(); i++)
                {
                    if (atts.GetFullName(i).Equals("title") && atts.GetValue(i).Equals("sequence"))
                    {
                    }
                    else if (atts.GetFullName(i).Equals("title") && atts.GetValue(i).Equals("connections"))
                    {
                        // assume that Atom's have been read
                        //logger.debug("Assuming that Atom's have been read: storing them");
                        base.storeAtomData();
                        connectionTable = true;
                        //logger.debug("Start Connection Table");
                    }
                    else if (atts.GetFullName(i).Equals("title") && atts.GetValue(i).Equals("connect"))
                    {
                        //logger.debug("New connection");
                        isBond = true;
                    }
                    else if (atts.GetFullName(i).Equals("id") && isBond)
                    {
                        connect_root = atts.GetValue(i);
                    }

                    // ignore other list items at this moment
                }
            }
            else
            {
                base.startElement(xpath, uri, local, raw, atts);
            }
        }
 public override void characterData(CMLStack xpath, char[] ch, int start, int length)
 {
     if (current == ENERGY)
     {
         frame_energy = new System.String(ch, start, length);
     }
     else
     {
         base.characterData(xpath, ch, start, length);
     }
 }
Esempio n. 15
0
 public override void endElement(CMLStack xpath, System.String uri, System.String local, System.String raw)
 {
     base.endElement(xpath, uri, local, raw);
 }
Esempio n. 16
0
 public override void startElement(CMLStack xpath, System.String uri, System.String local, System.String raw, SaxAttributesSupport atts)
 {
     ////logger.debug("MDLMol element: name");
     base.startElement(xpath, uri, local, raw, atts);
 }
Esempio n. 17
0
        public virtual void endElement(CMLStack xpath, System.String uri, System.String name, System.String raw)
        {
            ////logger.debug("EndElement: ", name);

            System.String cData = currentChars;

            if ("bond".Equals(name))
            {
                if (!stereoGiven)
                    bondStereo.Add("");
                if (bondStereo.Count > bondDictRefs.Count)
                    bondDictRefs.Add(null);
            }
            else if ("atom".Equals(name))
            {
                if (atomCounter > eltitles.Count)
                {
                    eltitles.Add(null);
                }
                if (atomCounter > hCounts.Count)
                {
                    /* while strictly undefined, assume zero 
                    implicit hydrogens when no number is given */
                    hCounts.Add("0");
                }
                if (atomCounter > atomDictRefs.Count)
                {
                    atomDictRefs.Add(null);
                }
                if (atomCounter > isotope.Count)
                {
                    isotope.Add(null);
                }
                if (atomCounter > spinMultiplicities.Count)
                {
                    spinMultiplicities.Add(null);
                }
                if (atomCounter > formalCharges.Count)
                {
                    /* while strictly undefined, assume zero 
                    implicit hydrogens when no number is given */
                    formalCharges.Add("0");
                }
                /* It may happen that not all atoms have
                associated 2D or 3D coordinates. accept that */
                if (atomCounter > x2.Count && x2.Count != 0)
                {
                    /* apparently, the previous atoms had atomic
                    coordinates, add 'null' for this atom */
                    x2.Add(null);
                    y2.Add(null);
                }
                if (atomCounter > x3.Count && x3.Count != 0)
                {
                    /* apparently, the previous atoms had atomic
                    coordinates, add 'null' for this atom */
                    x3.Add(null);
                    y3.Add(null);
                    z3.Add(null);
                }

                if (atomCounter > xfract.Count && xfract.Count != 0)
                {
                    /* apparently, the previous atoms had atomic
                    coordinates, add 'null' for this atom */
                    xfract.Add(null);
                    yfract.Add(null);
                    zfract.Add(null);
                }
            }
            else if ("molecule".Equals(name))
            {
                storeData();
                cdo.endObject("Molecule");
            }
            else if ("crystal".Equals(name))
            {
                if (crystalScalar > 0)
                {
                    // convert unit cell parameters to cartesians
                    Vector3d[] axes = CrystalGeometryTools.notionalToCartesian(unitcellparams[0], unitcellparams[1], unitcellparams[2], unitcellparams[3], unitcellparams[4], unitcellparams[5]);
                    aAxis = axes[0];
                    bAxis = axes[1];
                    cAxis = axes[2];
                    cartesianAxesSet = true;
                    cdo.startObject("a-axis");
                    cdo.setObjectProperty("a-axis", "x", aAxis.x.ToString());
                    cdo.setObjectProperty("a-axis", "y", aAxis.y.ToString());
                    cdo.setObjectProperty("a-axis", "z", aAxis.z.ToString());
                    cdo.endObject("a-axis");
                    cdo.startObject("b-axis");
                    cdo.setObjectProperty("b-axis", "x", bAxis.x.ToString());
                    cdo.setObjectProperty("b-axis", "y", bAxis.y.ToString());
                    cdo.setObjectProperty("b-axis", "z", bAxis.z.ToString());
                    cdo.endObject("b-axis");
                    cdo.startObject("c-axis");
                    cdo.setObjectProperty("c-axis", "x", cAxis.x.ToString());
                    cdo.setObjectProperty("c-axis", "y", cAxis.y.ToString());
                    cdo.setObjectProperty("c-axis", "z", cAxis.z.ToString());
                    cdo.endObject("c-axis");
                }
                else
                {
                    ////logger.error("Could not find crystal unit cell parameters");
                }
                cdo.endObject("Crystal");
            }
            else if ("list".Equals(name))
            {
                cdo.endObject("SetOfMolecules");
            }
            else if ("coordinate3".Equals(name))
            {
                if (BUILTIN.Equals("xyz3"))
                {
                    ////logger.debug("New coord3 xyz3 found: ", currentChars);

                    try
                    {

                        SupportClass.Tokenizer st = new SupportClass.Tokenizer(currentChars);
                        x3.Add(st.NextToken());
                        y3.Add(st.NextToken());
                        z3.Add(st.NextToken());
                        ////logger.debug("coord3 x3.length: ", x3.Count);
                        ////logger.debug("coord3 y3.length: ", y3.Count);
                        ////logger.debug("coord3 z3.length: ", z3.Count);
                    }
                    catch (System.Exception exception)
                    {
                        ////logger.error("CMLParsing error while setting coordinate3!");
                        ////logger.debug(exception);
                    }
                }
                else
                {
                    ////logger.warn("Unknown coordinate3 BUILTIN: " + BUILTIN);
                }
            }
            else if ("string".Equals(name))
            {
                if (BUILTIN.Equals("elementType"))
                {
                    ////logger.debug("Element: ", cData.Trim());
                    elsym.Add(cData);
                }
                else if (BUILTIN.Equals("atomRef"))
                {
                    curRef++;
                    ////logger.debug("Bond: ref #", curRef);

                    if (curRef == 1)
                    {
                        bondARef1.Add(cData.Trim());
                    }
                    else if (curRef == 2)
                    {
                        bondARef2.Add(cData.Trim());
                    }
                }
                else if (BUILTIN.Equals("order"))
                {
                    ////logger.debug("Bond: order ", cData.Trim());
                    order.Add(cData.Trim());
                }
                else if (BUILTIN.Equals("formalCharge"))
                {
                    // NOTE: this combination is in violation of the CML DTD!!!
                    ////logger.warn("formalCharge BUILTIN accepted but violating CML DTD");
                    ////logger.debug("Charge: ", cData.Trim());
                    System.String charge = cData.Trim();
                    if (charge.StartsWith("+") && charge.Length > 1)
                    {
                        charge = charge.Substring(1);
                    }
                    formalCharges.Add(charge);
                }
            }
            else if ("float".Equals(name))
            {
                if (BUILTIN.Equals("x3"))
                {
                    x3.Add(cData.Trim());
                }
                else if (BUILTIN.Equals("y3"))
                {
                    y3.Add(cData.Trim());
                }
                else if (BUILTIN.Equals("z3"))
                {
                    z3.Add(cData.Trim());
                }
                else if (BUILTIN.Equals("x2"))
                {
                    x2.Add(cData.Trim());
                }
                else if (BUILTIN.Equals("y2"))
                {
                    y2.Add(cData.Trim());
                }
                else if (BUILTIN.Equals("order"))
                {
                    // NOTE: this combination is in violation of the CML DTD!!!
                    order.Add(cData.Trim());
                }
                else if (BUILTIN.Equals("charge") || BUILTIN.Equals("partialCharge"))
                {
                    partialCharges.Add(cData.Trim());
                }
            }
            else if ("integer".Equals(name))
            {
                if (BUILTIN.Equals("formalCharge"))
                {
                    formalCharges.Add(cData.Trim());
                }
            }
            else if ("coordinate2".Equals(name))
            {
                if (BUILTIN.Equals("xy2"))
                {
                    ////logger.debug("New coord2 xy2 found.", cData);

                    try
                    {

                        SupportClass.Tokenizer st = new SupportClass.Tokenizer(cData);
                        x2.Add(st.NextToken());
                        y2.Add(st.NextToken());
                    }
                    catch (System.Exception e)
                    {
                        //UPGRADE_TODO: The equivalent in .NET for method 'java.lang.Throwable.toString' may return a different value. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1043'"
                        notify("CMLParsing error: " + e, SYSTEMID, 175, 1);
                    }
                }
            }
            else if ("stringArray".Equals(name))
            {
                if (BUILTIN.Equals("id") || BUILTIN.Equals("atomId") || BUILTIN.Equals("atomID"))
                {
                    // invalid according to CML1 DTD but found in OpenBabel 1.x output

                    try
                    {
                        bool countAtoms = (atomCounter == 0) ? true : false;
                        SupportClass.Tokenizer st = new SupportClass.Tokenizer(cData);

                        while (st.HasMoreTokens())
                        {
                            if (countAtoms)
                            {
                                atomCounter++;
                            }
                            System.String token = st.NextToken();
                            ////logger.debug("StringArray (Token): ", token);
                            elid.Add(token);
                        }
                    }
                    catch (System.Exception e)
                    {
                        //UPGRADE_TODO: The equivalent in .NET for method 'java.lang.Throwable.toString' may return a different value. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1043'"
                        notify("CMLParsing error: " + e, SYSTEMID, 186, 1);
                    }
                }
                else if (BUILTIN.Equals("elementType"))
                {

                    try
                    {
                        bool countAtoms = (atomCounter == 0) ? true : false;
                        SupportClass.Tokenizer st = new SupportClass.Tokenizer(cData);

                        while (st.HasMoreTokens())
                        {
                            if (countAtoms)
                            {
                                atomCounter++;
                            }
                            elsym.Add(st.NextToken());
                        }
                    }
                    catch (System.Exception e)
                    {
                        //UPGRADE_TODO: The equivalent in .NET for method 'java.lang.Throwable.toString' may return a different value. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1043'"
                        notify("CMLParsing error: " + e, SYSTEMID, 194, 1);
                    }
                }
                else if (BUILTIN.Equals("atomRefs"))
                {
                    curRef++;
                    ////logger.debug("New atomRefs found: ", curRef);

                    try
                    {
                        bool countBonds = (bondCounter == 0) ? true : false;
                        SupportClass.Tokenizer st = new SupportClass.Tokenizer(cData);

                        while (st.HasMoreTokens())
                        {
                            if (countBonds)
                            {
                                bondCounter++;
                            }
                            System.String token = st.NextToken();
                            ////logger.debug("Token: ", token);

                            if (curRef == 1)
                            {
                                bondARef1.Add(token);
                            }
                            else if (curRef == 2)
                            {
                                bondARef2.Add(token);
                            }
                        }
                    }
                    catch (System.Exception e)
                    {
                        //UPGRADE_TODO: The equivalent in .NET for method 'java.lang.Throwable.toString' may return a different value. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1043'"
                        notify("CMLParsing error: " + e, SYSTEMID, 194, 1);
                    }
                }
                else if (BUILTIN.Equals("atomRef"))
                {
                    curRef++;
                    ////logger.debug("New atomRef found: ", curRef); // this is CML1 stuff, we get things like:
                    /*
                    <bondArray>
                    <stringArray builtin="atomRef">a2 a2 a2 a2 a3 a3 a4 a4 a5 a6 a7 a9</stringArray>
                    <stringArray builtin="atomRef">a9 a11 a12 a13 a5 a4 a6 a9 a7 a8 a8 a10</stringArray>
                    <stringArray builtin="order">1 1 1 1 2 1 2 1 1 1 2 2</stringArray>
                    </bondArray>
                    */

                    try
                    {
                        bool countBonds = (bondCounter == 0) ? true : false;
                        SupportClass.Tokenizer st = new SupportClass.Tokenizer(cData);

                        while (st.HasMoreTokens())
                        {
                            if (countBonds)
                            {
                                bondCounter++;
                            }
                            System.String token = st.NextToken();
                            ////logger.debug("Token: ", token);

                            if (curRef == 1)
                            {
                                bondARef1.Add(token);
                            }
                            else if (curRef == 2)
                            {
                                bondARef2.Add(token);
                            }
                        }
                    }
                    catch (System.Exception e)
                    {
                        //UPGRADE_TODO: The equivalent in .NET for method 'java.lang.Throwable.toString' may return a different value. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1043'"
                        notify("CMLParsing error: " + e, SYSTEMID, 194, 1);
                    }
                }
                else if (BUILTIN.Equals("order"))
                {
                    ////logger.debug("New bond order found.");

                    try
                    {

                        SupportClass.Tokenizer st = new SupportClass.Tokenizer(cData);

                        while (st.HasMoreTokens())
                        {

                            System.String token = st.NextToken();
                            ////logger.debug("Token: ", token);
                            order.Add(token);
                        }
                    }
                    catch (System.Exception e)
                    {
                        //UPGRADE_TODO: The equivalent in .NET for method 'java.lang.Throwable.toString' may return a different value. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1043'"
                        notify("CMLParsing error: " + e, SYSTEMID, 194, 1);
                    }
                }
            }
            else if ("integerArray".Equals(name))
            {
                ////logger.debug("IntegerArray: builtin = ", BUILTIN);

                if (BUILTIN.Equals("formalCharge"))
                {

                    try
                    {

                        SupportClass.Tokenizer st = new SupportClass.Tokenizer(cData);

                        while (st.HasMoreTokens())
                        {

                            System.String token = st.NextToken();
                            ////logger.debug("Charge added: ", token);
                            formalCharges.Add(token);
                        }
                    }
                    catch (System.Exception e)
                    {
                        //UPGRADE_TODO: The equivalent in .NET for method 'java.lang.Throwable.toString' may return a different value. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1043'"
                        notify("CMLParsing error: " + e, SYSTEMID, 205, 1);
                    }
                }
            }
            else if ("scalar".Equals(name))
            {
                if (xpath.ToString().EndsWith("crystal/scalar/"))
                {
                    ////logger.debug("Going to set a crystal parameter: " + crystalScalar, " to ", cData);
                    try
                    {
                        unitcellparams[crystalScalar - 1] = System.Double.Parse(cData.Trim());
                    }
                    catch (System.FormatException exception)
                    {
                        ////logger.error("Content must a float: " + cData);
                    }
                }
                else
                {
                    if (xpath.ToString().EndsWith("bond/scalar/"))
                    {
                        if (DICTREF.Equals("mdl:stereo"))
                        {
                            bondStereo.Add(cData.Trim());
                            stereoGiven = true;
                        }
                    }
                    else
                    {
                        if (xpath.ToString().EndsWith("atom/scalar/"))
                        {
                            if (DICTREF.Equals("cdk:partialCharge"))
                            {
                                partialCharges.Add(cData.Trim());
                            }
                        }
                        else
                        {
                            if (xpath.ToString().EndsWith("molecule/scalar/"))
                            {
                                if (DICTREF.Equals("pdb:id"))
                                {
                                    cdo.setObjectProperty("Molecule", DICTREF, cData);
                                }
                            }
                            else
                            {
                                ////logger.warn("Ignoring scalar: " + xpath);
                            }
                        }
                    }
                }
            }
            else if ("floatArray".Equals(name))
            {
                if (BUILTIN.Equals("x3"))
                {

                    try
                    {

                        SupportClass.Tokenizer st = new SupportClass.Tokenizer(cData);

                        while (st.HasMoreTokens())
                            x3.Add(st.NextToken());
                    }
                    catch (System.Exception e)
                    {
                        //UPGRADE_TODO: The equivalent in .NET for method 'java.lang.Throwable.toString' may return a different value. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1043'"
                        notify("CMLParsing error: " + e, SYSTEMID, 205, 1);
                    }
                }
                else if (BUILTIN.Equals("y3"))
                {

                    try
                    {

                        SupportClass.Tokenizer st = new SupportClass.Tokenizer(cData);

                        while (st.HasMoreTokens())
                            y3.Add(st.NextToken());
                    }
                    catch (System.Exception e)
                    {
                        //UPGRADE_TODO: The equivalent in .NET for method 'java.lang.Throwable.toString' may return a different value. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1043'"
                        notify("CMLParsing error: " + e, SYSTEMID, 213, 1);
                    }
                }
                else if (BUILTIN.Equals("z3"))
                {

                    try
                    {

                        SupportClass.Tokenizer st = new SupportClass.Tokenizer(cData);

                        while (st.HasMoreTokens())
                            z3.Add(st.NextToken());
                    }
                    catch (System.Exception e)
                    {
                        //UPGRADE_TODO: The equivalent in .NET for method 'java.lang.Throwable.toString' may return a different value. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1043'"
                        notify("CMLParsing error: " + e, SYSTEMID, 221, 1);
                    }
                }
                else if (BUILTIN.Equals("x2"))
                {
                    ////logger.debug("New floatArray found.");

                    try
                    {

                        SupportClass.Tokenizer st = new SupportClass.Tokenizer(cData);

                        while (st.HasMoreTokens())
                            x2.Add(st.NextToken());
                    }
                    catch (System.Exception e)
                    {
                        //UPGRADE_TODO: The equivalent in .NET for method 'java.lang.Throwable.toString' may return a different value. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1043'"
                        notify("CMLParsing error: " + e, SYSTEMID, 205, 1);
                    }
                }
                else if (BUILTIN.Equals("y2"))
                {
                    ////logger.debug("New floatArray found.");

                    try
                    {

                        SupportClass.Tokenizer st = new SupportClass.Tokenizer(cData);

                        while (st.HasMoreTokens())
                            y2.Add(st.NextToken());
                    }
                    catch (System.Exception e)
                    {
                        //UPGRADE_TODO: The equivalent in .NET for method 'java.lang.Throwable.toString' may return a different value. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1043'"
                        notify("CMLParsing error: " + e, SYSTEMID, 454, 1);
                    }
                }
                else if (BUILTIN.Equals("partialCharge"))
                {
                    ////logger.debug("New floatArray with partial charges found.");

                    try
                    {

                        SupportClass.Tokenizer st = new SupportClass.Tokenizer(cData);

                        while (st.HasMoreTokens())
                            partialCharges.Add(st.NextToken());
                    }
                    catch (System.Exception e)
                    {
                        //UPGRADE_TODO: The equivalent in .NET for method 'java.lang.Throwable.toString' may return a different value. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1043'"
                        notify("CMLParsing error: " + e, SYSTEMID, 462, 1);
                    }
                }
            }
            else if ("basic".Equals(name))
            {
                // assuming this is the child element of <identifier>
                this.inchi = cData;
            }
            else if ("name".Equals(name))
            {
                if (xpath.ToString().EndsWith("molecule/name/"))
                {
                    cdo.setObjectProperty("Molecule", DICTREF, cData);
                }
            }
            else
            {
                ////logger.warn("Skipping element: " + name);
            }

            currentChars = "";
            BUILTIN = "";
            elementTitle = "";
        }
Esempio n. 18
0
        public virtual void startElement(CMLStack xpath, System.String uri, System.String local, System.String raw, SaxAttributesSupport atts)
        {

            System.String name = local;
            ////logger.debug("StartElement");
            currentChars = "";

            BUILTIN = "";
            DICTREF = "";

            for (int i = 0; i < atts.GetLength(); i++)
            {
                System.String qname = atts.GetFullName(i);
                if (qname.Equals("builtin"))
                {
                    BUILTIN = atts.GetValue(i);
                    ////logger.debug(name, "->BUILTIN found: ", atts.GetValue(i));
                }
                else if (qname.Equals("dictRef"))
                {
                    DICTREF = atts.GetValue(i);
                    ////logger.debug(name, "->DICTREF found: ", atts.GetValue(i));
                }
                else if (qname.Equals("title"))
                {
                    elementTitle = atts.GetValue(i);
                    ////logger.debug(name, "->TITLE found: ", atts.GetValue(i));
                }
                else
                {
                    ////logger.debug("Qname: ", qname);
                }
            }

            if ("atom".Equals(name))
            {
                atomCounter++;
                for (int i = 0; i < atts.GetLength(); i++)
                {

                    System.String att = atts.GetFullName(i);
                    System.String value_Renamed = atts.GetValue(i);

                    if (att.Equals("id"))
                    {
                        // this is supported in CML 1.x
                        elid.Add(value_Renamed);
                    }
                    // this is supported in CML 2.0 
                    else if (att.Equals("elementType"))
                    {
                        elsym.Add(value_Renamed);
                    }
                    // this is supported in CML 2.0 
                    else if (att.Equals("title"))
                    {
                        eltitles.Add(value_Renamed);
                    }
                    // this is supported in CML 2.0 
                    else if (att.Equals("x2"))
                    {
                        x2.Add(value_Renamed);
                    }
                    // this is supported in CML 2.0 
                    else if (att.Equals("xy2"))
                    {
                        SupportClass.Tokenizer tokenizer = new SupportClass.Tokenizer(value_Renamed);
                        x2.Add(tokenizer.NextToken());
                        y2.Add(tokenizer.NextToken());
                    }
                    // this is supported in CML 2.0 
                    else if (att.Equals("xyzFract"))
                    {
                        SupportClass.Tokenizer tokenizer = new SupportClass.Tokenizer(value_Renamed);
                        xfract.Add(tokenizer.NextToken());
                        yfract.Add(tokenizer.NextToken());
                        zfract.Add(tokenizer.NextToken());
                    }
                    // this is supported in CML 2.0 
                    else if (att.Equals("xyz3"))
                    {
                        SupportClass.Tokenizer tokenizer = new SupportClass.Tokenizer(value_Renamed);
                        x3.Add(tokenizer.NextToken());
                        y3.Add(tokenizer.NextToken());
                        z3.Add(tokenizer.NextToken());
                    }
                    // this is supported in CML 2.0 
                    else if (att.Equals("y2"))
                    {
                        y2.Add(value_Renamed);
                    }
                    // this is supported in CML 2.0 
                    else if (att.Equals("x3"))
                    {
                        x3.Add(value_Renamed);
                    }
                    // this is supported in CML 2.0 
                    else if (att.Equals("y3"))
                    {
                        y3.Add(value_Renamed);
                    }
                    // this is supported in CML 2.0 
                    else if (att.Equals("z3"))
                    {
                        z3.Add(value_Renamed);
                    }
                    // this is supported in CML 2.0 
                    else if (att.Equals("xFract"))
                    {
                        xfract.Add(value_Renamed);
                    }
                    // this is supported in CML 2.0 
                    else if (att.Equals("yFract"))
                    {
                        yfract.Add(value_Renamed);
                    }
                    // this is supported in CML 2.0 
                    else if (att.Equals("zFract"))
                    {
                        zfract.Add(value_Renamed);
                    }
                    // this is supported in CML 2.0 
                    else if (att.Equals("formalCharge"))
                    {
                        formalCharges.Add(value_Renamed);
                    }
                    // this is supported in CML 2.0 
                    else if (att.Equals("hydrogenCount"))
                    {
                        hCounts.Add(value_Renamed);
                    }
                    else if (att.Equals("isotope"))
                    {
                        isotope.Add(value_Renamed);
                    }
                    else if (att.Equals("dictRef"))
                    {
                        atomDictRefs.Add(value_Renamed);
                    }
                    else if (att.Equals("spinMultiplicity"))
                    {
                        spinMultiplicities.Add(value_Renamed);
                    }
                    else
                    {
                        ////logger.warn("Unparsed attribute: " + att);
                    }
                }
            }
            else if ("atomArray".Equals(name))
            {
                bool atomsCounted = false;
                for (int i = 0; i < atts.GetLength(); i++)
                {
                    System.String att = atts.GetFullName(i);
                    int count = 0;
                    if (att.Equals("atomID"))
                    {
                        count = addArrayElementsTo(elid, atts.GetValue(i));
                    }
                    else if (att.Equals("elementType"))
                    {
                        count = addArrayElementsTo(elsym, atts.GetValue(i));
                    }
                    else if (att.Equals("x2"))
                    {
                        count = addArrayElementsTo(x2, atts.GetValue(i));
                    }
                    else if (att.Equals("y2"))
                    {
                        count = addArrayElementsTo(y2, atts.GetValue(i));
                    }
                    else if (att.Equals("x3"))
                    {
                        count = addArrayElementsTo(x3, atts.GetValue(i));
                    }
                    else if (att.Equals("y3"))
                    {
                        count = addArrayElementsTo(y3, atts.GetValue(i));
                    }
                    else if (att.Equals("z3"))
                    {
                        count = addArrayElementsTo(z3, atts.GetValue(i));
                    }
                    else if (att.Equals("xFract"))
                    {
                        count = addArrayElementsTo(xfract, atts.GetValue(i));
                    }
                    else if (att.Equals("yFract"))
                    {
                        count = addArrayElementsTo(yfract, atts.GetValue(i));
                    }
                    else if (att.Equals("zFract"))
                    {
                        count = addArrayElementsTo(zfract, atts.GetValue(i));
                    }
                    else
                    {
                        ////logger.warn("Unparsed attribute: " + att);
                    }
                    if (!atomsCounted)
                    {
                        atomCounter += count;
                        atomsCounted = true;
                    }
                }
            }
            else if ("bond".Equals(name))
            {
                bondCounter++;
                for (int i = 0; i < atts.GetLength(); i++)
                {
                    System.String att = atts.GetFullName(i);
                    ////logger.debug("B2 ", att, "=", atts.GetValue(i));

                    if (att.Equals("id"))
                    {
                        bondid.Add(atts.GetValue(i));
                        ////logger.debug("B3 ", bondid);
                    }
                    else if (att.Equals("atomRefs") || att.Equals("atomRefs2"))
                    {
                        // this is CML 2.0 support

                        // expect exactly two references
                        try
                        {
                            SupportClass.Tokenizer st = new SupportClass.Tokenizer(atts.GetValue(i));
                            bondARef1.Add((System.String)st.NextToken());
                            bondARef2.Add((System.String)st.NextToken());
                        }
                        catch (System.Exception e)
                        {
                            //UPGRADE_TODO: The equivalent in .NET for method 'java.lang.Throwable.getMessage' may return a different value. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1043'"
                            ////logger.error("Error in CML file: ", e.Message);
                            ////logger.debug(e);
                        }
                    }
                    else if (att.Equals("order"))
                    {
                        // this is CML 2.0 support
                        order.Add(atts.GetValue(i).Trim());
                    }
                    else if (att.Equals("dictRef"))
                    {
                        bondDictRefs.Add(atts.GetValue(i).Trim());
                    }
                }

                stereoGiven = false;
                curRef = 0;
            }
            else if ("bondArray".Equals(name))
            {
                bool bondsCounted = false;
                for (int i = 0; i < atts.GetLength(); i++)
                {
                    System.String att = atts.GetFullName(i);
                    int count = 0;
                    if (att.Equals("bondID"))
                    {
                        count = addArrayElementsTo(bondid, atts.GetValue(i));
                    }
                    else if (att.Equals("atomRefs1"))
                    {
                        count = addArrayElementsTo(bondARef1, atts.GetValue(i));
                    }
                    else if (att.Equals("atomRefs2"))
                    {
                        count = addArrayElementsTo(bondARef2, atts.GetValue(i));
                    }
                    else if (att.Equals("atomRef1"))
                    {
                        count = addArrayElementsTo(bondARef1, atts.GetValue(i));
                    }
                    else if (att.Equals("atomRef2"))
                    {
                        count = addArrayElementsTo(bondARef2, atts.GetValue(i));
                    }
                    else if (att.Equals("order"))
                    {
                        count = addArrayElementsTo(order, atts.GetValue(i));
                    }
                    else
                    {
                        ////logger.warn("Unparsed attribute: " + att);
                    }
                    if (!bondsCounted)
                    {
                        bondCounter += count;
                        bondsCounted = true;
                    }
                }
                curRef = 0;
            }
            else if ("molecule".Equals(name))
            {
                newMolecule();
                BUILTIN = "";
                cdo.startObject("Molecule");
                for (int i = 0; i < atts.GetLength(); i++)
                {
                    if (atts.GetFullName(i).Equals("id"))
                    {
                        cdo.setObjectProperty("Molecule", "id", atts.GetValue(i));
                    }
                    else if (atts.GetFullName(i).Equals("dictRef"))
                    {
                        cdo.setObjectProperty("Molecule", "dictRef", atts.GetValue(i));
                    }
                }
            }
            else if ("crystal".Equals(name))
            {
                newCrystalData();
                cdo.startObject("Crystal");
                for (int i = 0; i < atts.GetLength(); i++)
                {
                    System.String att = atts.GetFullName(i);
                    if (att.Equals("z"))
                    {
                        cdo.setObjectProperty("Crystal", "z", atts.GetValue(i));
                    }
                }
            }
            else if ("symmetry".Equals(name))
            {
                for (int i = 0; i < atts.GetLength(); i++)
                {
                    System.String att = atts.GetFullName(i);
                    if (att.Equals("spaceGroup"))
                    {
                        cdo.setObjectProperty("Crystal", "spacegroup", atts.GetValue(i));
                    }
                }
            }
            else if ("scalar".Equals(name))
            {
                if (xpath.ToString().EndsWith("crystal/scalar/"))
                    crystalScalar++;
            }
            else if ("list".Equals(name))
            {
                cdo.startObject("SetOfMolecules");
            }
        }
Esempio n. 19
0
 public virtual void characterData(CMLStack xpath, char[] ch, int start, int length)
 {
     currentChars = currentChars + new System.String(ch, start, length);
     ////logger.debug("CD: ", currentChars);
 }
Esempio n. 20
0
 public override void endElement(CMLStack xpath, System.String uri, System.String local, System.String raw)
 {
     if ("reaction".Equals(local))
     {
         cdo.endObject("Reaction");
     }
     else if ("reactionList".Equals(local))
     {
         cdo.endObject("SetOfReactions");
     }
     else if ("reactant".Equals(local))
     {
         cdo.endObject("Reactant");
     }
     else if ("product".Equals(local))
     {
         cdo.endObject("Product");
     }
     else if ("molecule".Equals(local))
     {
         //logger.debug("Storing Molecule");
         base.storeData();
         // do nothing else but store atom/bond information
     }
     else
     {
         base.endElement(xpath, uri, local, raw);
     }
 }
Esempio n. 21
0
 public override void characterData(CMLStack xpath, char[] ch, int start, int length)
 {
     System.String s = new System.String(ch, start, length).Trim();
     //logger.debug("Start PMP chardata (" + CurrentElement + ") :" + s);
     //logger.debug(" ElTitle: " + elementTitle);
     if (xpath.ToString().EndsWith("string/") && BUILTIN.Equals("spacegroup"))
     {
         System.String sg = "P1";
         // standardize space group names (see Crystal.java)
         if ("P 21 21 21 (1)".Equals(s))
         {
             sg = "P 2_1 2_1 2_1";
         }
         cdo.setObjectProperty("Crystal", "spacegroup", sg);
     }
     else
     {
         if (xpath.ToString().EndsWith("floatArray/") && (elementTitle.Equals("a") || elementTitle.Equals("b") || elementTitle.Equals("c")))
         {
             System.String axis = elementTitle + "-axis";
             cdo.startObject(axis);
             try
             {
                 SupportClass.Tokenizer st = new SupportClass.Tokenizer(s);
                 //logger.debug("Tokens: " + st.Count);
                 if (st.Count > 2)
                 {
                     System.String token = st.NextToken();
                     //logger.debug("FloatArray (Token): " + token);
                     cdo.setObjectProperty(axis, "x", token);
                     token = st.NextToken();
                     //logger.debug("FloatArray (Token): " + token);
                     cdo.setObjectProperty(axis, "y", token);
                     token = st.NextToken();
                     //logger.debug("FloatArray (Token): " + token);
                     cdo.setObjectProperty(axis, "z", token);
                 }
                 else
                 {
                     //logger.debug("PMP Convention error: incorrect number of cell axis fractions!\n");
                 }
             }
             catch (System.Exception e)
             {
                 //UPGRADE_TODO: The equivalent in .NET for method 'java.lang.Throwable.toString' may return a different value. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1043'"
                 //logger.debug("PMP Convention error: " + e.ToString());
             }
             cdo.endObject(axis);
         }
         else
         {
             base.characterData(xpath, ch, start, length);
         }
     }
     //logger.debug("End PMP chardata");
 }
Esempio n. 22
0
 public override void endElement(CMLStack xpath, System.String uri, System.String local, System.String raw)
 {
     base.endElement(xpath, uri, local, raw);
 }
Esempio n. 23
0
 public override void characterData(CMLStack xpath, char[] ch, int start, int length)
 {
     base.characterData(xpath, ch, start, length);
 }
Esempio n. 24
0
 public override void characterData(CMLStack xpath, char[] ch, int start, int length)
 {
     base.characterData(xpath, ch, start, length);
 }
Esempio n. 25
0
        public override void characterData(CMLStack xpath, char[] ch, int start, int length)
        {

            System.String s = new System.String(ch, start, length).Trim();

            if (isELSYM)
            {
                elsym.Add(s);
            }
            else if (isBond)
            {
                //logger.debug("CD (bond): " + s);

                if (connect_root.Length > 0)
                {

                    SupportClass.Tokenizer st = new SupportClass.Tokenizer(s);

                    while (st.HasMoreTokens())
                    {

                        System.String atom = (System.String)st.NextToken();

                        if (!atom.Equals("0"))
                        {
                            //logger.debug("new bond: " + connect_root + "-" + atom);
                            cdo.startObject("Bond");

                            int atom1 = System.Int32.Parse(connect_root) - 1;
                            int atom2 = System.Int32.Parse(atom) - 1;
                            cdo.setObjectProperty("Bond", "atom1", ((System.Int32)atom1).ToString());
                            cdo.setObjectProperty("Bond", "atom2", ((System.Int32)atom2).ToString());
                            cdo.setObjectProperty("Bond", "order", "1");
                            cdo.endObject("Bond");
                        }
                    }
                }
            }
            else
            {
                base.characterData(xpath, ch, start, length);
            }
        }
Esempio n. 26
0
        public override void endElement(CMLStack xpath, System.String uri, System.String local, System.String raw)
        {

            System.String name = raw;

            if (name.Equals("list") && connectionTable && !isBond)
            {
                //logger.debug("End Connection Table");
                connectionTable = false;
            }

            isELSYM = false;
            isBond = false;
            base.endElement(xpath, uri, local, raw);
        }
Esempio n. 27
0
 public override void startElement(CMLStack xpath, System.String uri, System.String local, System.String raw, SaxAttributesSupport atts)
 {
     if ("reaction".Equals(local))
     {
         cdo.startObject("Reaction");
         for (int i = 0; i < atts.GetLength(); i++)
         {
             System.String att = atts.GetFullName(i);
             System.String value_Renamed = atts.GetValue(i);
             if (att.Equals("id"))
             {
                 cdo.setObjectProperty("Reaction", "id", value_Renamed);
             }
         }
     }
     else if ("reactionList".Equals(local))
     {
         cdo.startObject("SetOfReactions");
         for (int i = 0; i < atts.GetLength(); i++)
         {
             System.String att = atts.GetFullName(i);
             System.String value_Renamed = atts.GetValue(i);
             if (att.Equals("id"))
             {
                 cdo.setObjectProperty("SetOfReactions", "id", value_Renamed);
             }
         }
     }
     else if ("reactant".Equals(local))
     {
         cdo.startObject("Reactant");
         for (int i = 0; i < atts.GetLength(); i++)
         {
             System.String att = atts.GetFullName(i);
             System.String value_Renamed = atts.GetValue(i);
             if (att.Equals("id"))
             {
                 cdo.setObjectProperty("Reactant", "id", value_Renamed);
             }
         }
     }
     else if ("product".Equals(local))
     {
         cdo.startObject("Product");
         for (int i = 0; i < atts.GetLength(); i++)
         {
             System.String att = atts.GetFullName(i);
             System.String value_Renamed = atts.GetValue(i);
             if (att.Equals("id"))
             {
                 cdo.setObjectProperty("Product", "id", value_Renamed);
             }
         }
     }
     else if ("molecule".Equals(local))
     {
         // do nothing for now
         base.newMolecule();
     }
     else
     {
         base.startElement(xpath, uri, local, raw, atts);
     }
 }
Esempio n. 28
0
        public override void startElement(CMLStack xpath, System.String uri, System.String local, System.String raw, SaxAttributesSupport atts)
        {
            System.String name = raw;
            isELSYM = false;

            if ("list".Equals(name))
            {

                for (int i = 0; i < atts.GetLength(); i++)
                {

                    if (atts.GetFullName(i).Equals("title") && atts.GetValue(i).Equals("sequence"))
                    {
                    }
                    else if (atts.GetFullName(i).Equals("title") && atts.GetValue(i).Equals("connections"))
                    {
                        // assume that Atom's have been read
                        //logger.debug("Assuming that Atom's have been read: storing them");
                        base.storeAtomData();
                        connectionTable = true;
                        //logger.debug("Start Connection Table");
                    }
                    else if (atts.GetFullName(i).Equals("title") && atts.GetValue(i).Equals("connect"))
                    {
                        //logger.debug("New connection");
                        isBond = true;
                    }
                    else if (atts.GetFullName(i).Equals("id") && isBond)
                    {
                        connect_root = atts.GetValue(i);
                    }

                    // ignore other list items at this moment
                }
            }
            else
            {
                base.startElement(xpath, uri, local, raw, atts);
            }
        }
 public override void endElement(CMLStack xpath, System.String uri, System.String local, System.String raw)
 {
     System.String name = local;
     if (current == ENERGY)
     {
         cdo.setObjectProperty("Frame", "energy", frame_energy);
         // + " " + units);
         current = UNKNOWN;
         frame_energy = "";
     }
     else if (name.Equals("list"))
     {
         base.endElement(xpath, uri, local, raw);
         cdo.endObject("Animation");
     }
     else if (name.Equals("molecule"))
     {
         base.endElement(xpath, uri, local, raw);
         cdo.endObject("Frame");
     }
     else
     {
         base.endElement(xpath, uri, local, raw);
     }
 }
Esempio n. 30
0
 public override void startElement(CMLStack xpath, System.String uri, System.String local, System.String raw, SaxAttributesSupport atts)
 {
     if ("reaction".Equals(local))
     {
         cdo.startObject("Reaction");
         for (int i = 0; i < atts.GetLength(); i++)
         {
             System.String att           = atts.GetFullName(i);
             System.String value_Renamed = atts.GetValue(i);
             if (att.Equals("id"))
             {
                 cdo.setObjectProperty("Reaction", "id", value_Renamed);
             }
         }
     }
     else if ("reactionList".Equals(local))
     {
         cdo.startObject("SetOfReactions");
         for (int i = 0; i < atts.GetLength(); i++)
         {
             System.String att           = atts.GetFullName(i);
             System.String value_Renamed = atts.GetValue(i);
             if (att.Equals("id"))
             {
                 cdo.setObjectProperty("SetOfReactions", "id", value_Renamed);
             }
         }
     }
     else if ("reactant".Equals(local))
     {
         cdo.startObject("Reactant");
         for (int i = 0; i < atts.GetLength(); i++)
         {
             System.String att           = atts.GetFullName(i);
             System.String value_Renamed = atts.GetValue(i);
             if (att.Equals("id"))
             {
                 cdo.setObjectProperty("Reactant", "id", value_Renamed);
             }
         }
     }
     else if ("product".Equals(local))
     {
         cdo.startObject("Product");
         for (int i = 0; i < atts.GetLength(); i++)
         {
             System.String att           = atts.GetFullName(i);
             System.String value_Renamed = atts.GetValue(i);
             if (att.Equals("id"))
             {
                 cdo.setObjectProperty("Product", "id", value_Renamed);
             }
         }
     }
     else if ("molecule".Equals(local))
     {
         // do nothing for now
         base.newMolecule();
     }
     else
     {
         base.startElement(xpath, uri, local, raw, atts);
     }
 }
Esempio n. 31
0
 public override void startElement(CMLStack xpath, System.String uri, System.String local, System.String raw, SaxAttributesSupport atts)
 {
     //logger.debug("PMP element: name");
     base.startElement(xpath, uri, local, raw, atts);
 }