Exemplo n.º 1
0
        public void LoadPeriodicDableFromDiskOrCode()
        {
            Stopwatch stopWatch = new Stopwatch();

            stopWatch.Start();

            string OMICS_ELEMENT_DATA_FILE = "PNNLOmicsElementData.xml";

            ResolveUNCPath.MappedDriveResolver uncPathCheck = new ResolveUNCPath.MappedDriveResolver();
            string asemblyDirectoryOrUNCDirectory           = uncPathCheck.ResolveToUNC(PathUtilities.AssemblyDirectory);

            FileInfo constantsFileInfo = new FileInfo(System.IO.Path.Combine(asemblyDirectoryOrUNCDirectory, OMICS_ELEMENT_DATA_FILE));

            ElementLibrary libraryLoad = new ElementLibrary();

            List <string>  elementSymbolList = new List <string>();
            List <Element> elementList       = new List <Element>();

            Assert.IsTrue(constantsFileInfo.Exists);

            if (constantsFileInfo.Exists)
            {
                try
                {
                    libraryLoad.LoadXML(constantsFileInfo.FullName, out elementSymbolList, out elementList);
                }
                catch
                {
                    //file missing
                }
            }

            Assert.AreEqual(elementList.Count, 104);
            Assert.AreEqual(elementSymbolList.Count, 104);
            Assert.AreEqual(elementList[50].MassAverage, 121.76);
            Assert.AreEqual(elementSymbolList[50], "Sb");

            elementSymbolList = null;
            elementList       = null;

            libraryLoad.LoadHardCoded(out elementSymbolList, out elementList);

            Assert.AreEqual(elementList.Count, 104);
            Assert.AreEqual(elementSymbolList.Count, 104);
            Assert.AreEqual(elementList[50].MassAverage, 121.76);
            Assert.AreEqual(elementSymbolList[50], "Sb");

            stopWatch.Stop();
            Console.WriteLine("This took " + stopWatch.Elapsed + "seconds to Load and initialize the library twice");
        }
Exemplo n.º 2
0
    public void ApplyQuery()
    {
        _element = ElementLibrary.SelectGoodElement(_GoodElementCondition);
        GameObject[] gObjects = GameObject.FindGameObjectsWithTag("Element");
        Vector3      position;
        Quaternion   rotation;

        foreach (GameObject g in gObjects)
        {
            if (_Condition.IsVerifyingConditions(g.GetComponent <ElementsProperties>()))
            {
                position = g.transform.position;
                rotation = g.transform.rotation;
                Destroy(g);
                Instantiate(_element, position, rotation);
            }
        }
    }
Exemplo n.º 3
0
        public void TestMasses()
        {
            var newlibrary1 = new AminoAcidLibrary();
            //Dictionary<string, Compound> dictionaryIn1 = newlibrary1.LoadLibrary();
            //foreach (KeyValuePair<string, Compound> matterObject in dictionaryIn1)
            //{
            //    totalMass += matterObject.Value.MassMonoIsotopic;
            //    textM = matterObject.Value.MassMonoIsotopic.ToString() + "," + matterObject.Value.Symbol.ToString() + "," + matterObject.Value.Name.ToString() + Environment.NewLine;
            //    //Console.Write(textM);
            //}

            //Assert.AreEqual(totalMass, 2475.1616262881598);

            var newlibrary2 = new CrossRingLibrary();
            //Dictionary<string, Compound> dictionaryIn2 = newlibrary2.LoadLibrary();
            //foreach (KeyValuePair<string, Compound> matterObject in dictionaryIn2)
            //{
            //    totalMass += matterObject.Value.MassMonoIsotopic;
            //    textM = matterObject.Value.MassMonoIsotopic.ToString() + "," + matterObject.Value.Symbol.ToString() + "," + matterObject.Value.Name.ToString() + Environment.NewLine;
            //    //Console.Write(textM);
            //}

            //Assert.AreEqual(totalMass, 1432.3950300356437);

            var newlibrary3 = new ElementLibrary();
            //Dictionary<string, Element> dictionaryIn3 = newlibrary3.LoadLibrary();
            //foreach (KeyValuePair<string, Element> matterObject in dictionaryIn3)
            //{
            //    totalMass += matterObject.Value.MassMonoIsotopic;
            //    textM = matterObject.Value.MassMonoIsotopic.ToString() + "," + matterObject.Value.Symbol.ToString() + "," + matterObject.Value.Name.ToString() + Environment.NewLine;
            //    //Console.Write(textM);
            //}

            //Assert.AreEqual(totalMass, 12899.589616552506);

            var newlibrary4 = new MiscellaneousMatterLibrary();
            //Dictionary<string, Compound> dictionaryIn4 = newlibrary4.LoadLibrary();
            //foreach (KeyValuePair<string, Compound> matterObject in dictionaryIn4)
            //{
            //    totalMass += matterObject.Value.MassMonoIsotopic;
            //    textM = matterObject.Value.MassMonoIsotopic.ToString() + "," + matterObject.Value.Symbol.ToString() + "," + matterObject.Value.Name.ToString() + Environment.NewLine;
            //    //Console.Write(textM);
            //}

            //Assert.AreEqual(totalMass, 295.99644294548898);

            var newlibrary5 = new MonosaccharideLibrary();
            //Dictionary<string, Compound> dictionaryIn5 = newlibrary5.LoadLibrary();
            //foreach (KeyValuePair<string, Compound> matterObject in dictionaryIn5)
            //{
            //    totalMass += matterObject.Value.MassMonoIsotopic;
            //    textM = matterObject.Value.MassMonoIsotopic.ToString() + "," + matterObject.Value.Symbol.ToString() + "," + matterObject.Value.Name.ToString() + Environment.NewLine;
            //    //Console.Write(textM);
            //}

            //Assert.AreEqual(totalMass, 1687.5704282280092);

            var newlibrary6 = new SubAtomicParticleLibrary();
            //Dictionary<string, SubAtomicParticle> dictionaryIn6 = newlibrary6.LoadLibrary();
            //foreach (KeyValuePair<string, SubAtomicParticle> matterObject in dictionaryIn6)
            //{
            //    totalMass += matterObject.Value.MassMonoIsotopic;
            //    textM = matterObject.Value.MassMonoIsotopic.ToString() + "," + matterObject.Value.Symbol.ToString() + "," + matterObject.Value.Name.ToString() + Environment.NewLine;
            //    //Console.Write(textM);
            //}

            //Assert.AreEqual(totalMass, 2.0164899626494304);
        }
Exemplo n.º 4
0
 private void Start()
 {
     e      = new ElementLibrary(elements);
     niveau = GetComponent <GameManagement>().nNiveau;
 }
Exemplo n.º 5
0
 public void ApplyQuery()
 {
     _element = ElementLibrary.SelectGoodElement(_GoodElementCondition);
     gameObject.GetComponent <SpawnElements>().SpawnElement(_element, SpawnDuration);
 }