コード例 #1
0
 public void Add(Cycles cycles)
 {
     db.Cycles.Add(cycles);
 }
コード例 #2
0
ファイル: CyclesTests.cs プロジェクト: hazer232323/Methods
        public static void Test10(int a, int expected)
        {
            int actual = Cycles.Test10(a);

            Assert.AreEqual(expected, actual);
        }
コード例 #3
0
ファイル: CyclesTests.cs プロジェクト: hazer232323/Methods
 public static void Test11_WhenNumberIsNegativeOrEqualZero_ArgumentExpection(int a)
 {
     Assert.Throws <ArgumentException>(() => Cycles.Test11(a));
 }
コード例 #4
0
ファイル: InputEvents.cs プロジェクト: smdx24/CPI-Source-Code
 public CycleChangeEvent(Cycles _cycle)
 {
     Cycle = _cycle;
 }
コード例 #5
0
ファイル: CyclesTests.cs プロジェクト: hazer232323/Methods
        public static void Test1(decimal a, decimal b, decimal expected)
        {
            decimal actual = Cycles.Test1(a, b);

            Assert.AreEqual(expected, actual);
        }
コード例 #6
0
        public void GetresultAlgorithmEvklidaTest(int a, int b, int exspected)
        {
            int actual = Cycles.GetresultAlgorithmEvklida(a, b);

            Assert.AreEqual(exspected, actual);
        }
コード例 #7
0
        public void FindMirrowNumbTest(int a, int exspected)
        {
            int actual = Cycles.FindMirrowNumb(a);

            Assert.AreEqual(exspected, actual);
        }
コード例 #8
0
ファイル: SmoothVerts.cs プロジェクト: yazici/AVA
 public override void Create()
 {
     Cycles.Insert(0, smooth);
     Cycles.Insert(1, smoothed);
 }
コード例 #9
0
 public override void Destroy()
 {
     Cycles.Remove(body);
     Cycles.Remove(transfer);
     Cycles.Remove(parallel);
 }
コード例 #10
0
 public override void Create()
 {
     Cycles.Insert(0, verts);
     Cycles.Insert(1, life);
 }
コード例 #11
0
        /// <summary>
        ///  Method assigns atom types to atoms (calculates sssr and aromaticity)
        /// </summary>
        /// <returns>sssrf set</returns>
        /// <exception cref="CDKException"> Problems detecting aromaticity or making hose codes.</exception>
        public IRingSet AssignAtomTyps(IAtomContainer molecule)
        {
            IAtom             atom     = null;
            string            hoseCode = "";
            HOSECodeGenerator hcg      = new HOSECodeGenerator();
            int      NumberOfRingAtoms = 0;
            IRingSet ringSetMolecule   = Cycles.FindSSSR(molecule).ToRingSet();
            bool     isInHeteroRing    = false;

            try
            {
                AtomContainerManipulator.PercieveAtomTypesAndConfigureAtoms(molecule);
                Aromaticity.CDKLegacy.Apply(molecule);
            }
            catch (Exception cdk1)
            {
                throw new CDKException("AROMATICITYError: Cannot determine aromaticity due to: " + cdk1.Message, cdk1);
            }

            for (int i = 0; i < molecule.Atoms.Count; i++)
            {
                atom = molecule.Atoms[i];
                if (ringSetMolecule.Contains(atom))
                {
                    NumberOfRingAtoms = NumberOfRingAtoms + 1;
                    atom.IsInRing     = true;
                    atom.IsAliphatic  = false;
                    var ringSetA = ringSetMolecule.GetRings(atom).ToList();
                    RingSetManipulator.Sort(ringSetA);
                    IRing sring = (IRing)ringSetA[ringSetA.Count - 1];
                    atom.SetProperty("RING_SIZE", sring.RingSize);
                    foreach (var ring in ringSetA)
                    {
                        if (IsHeteroRingSystem(ring))
                        {
                            break;
                        }
                    }
                }
                else
                {
                    atom.IsAliphatic = true;
                    atom.IsInRing    = false;
                    isInHeteroRing   = false;
                }
                atom.SetProperty("MAX_BOND_ORDER", molecule.GetMaximumBondOrder(atom).Numeric());

                try
                {
                    hoseCode = hcg.GetHOSECode(molecule, atom, 3);
                    //Debug.WriteLine("HOSECODE GENERATION: ATOM "+i+" HoseCode: "+hoseCode+" ");
                }
                catch (CDKException ex1)
                {
                    Console.Out.WriteLine("Could not build HOSECode from atom " + i + " due to " + ex1.ToString());
                    throw new CDKException("Could not build HOSECode from atom " + i + " due to " + ex1.ToString(), ex1);
                }
                try
                {
                    ConfigureAtom(atom, hoseCode, isInHeteroRing);
                }
                catch (CDKException ex2)
                {
                    Console.Out.WriteLine("Could not final configure atom " + i + " due to " + ex2.ToString());
                    throw new CDKException("Could not final configure atom due to problems with force field", ex2);
                }
            }

            //        IBond[] bond = molecule.Bonds;
            string bondType;

            foreach (var bond in molecule.Bonds)
            {
                //Debug.WriteLine("bond[" + i + "] properties : " + molecule.Bonds[i].GetProperties());
                bondType = "0";
                if (bond.Order == BondOrder.Single)
                {
                    if ((bond.Begin.AtomTypeName.Equals("Csp2", StringComparison.Ordinal)) &&
                        ((bond.End.AtomTypeName.Equals("Csp2", StringComparison.Ordinal)) ||
                         (bond.End.AtomTypeName.Equals("C=", StringComparison.Ordinal))))
                    {
                        bondType = "1";
                    }

                    if ((bond.Begin.AtomTypeName.Equals("C=", StringComparison.Ordinal)) &&
                        ((bond.End.AtomTypeName.Equals("Csp2", StringComparison.Ordinal)) ||
                         (bond.End.AtomTypeName.Equals("C=", StringComparison.Ordinal))))
                    {
                        bondType = "1";
                    }

                    if ((bond.Begin.AtomTypeName.Equals("Csp", StringComparison.Ordinal)) &&
                        (bond.End.AtomTypeName.Equals("Csp", StringComparison.Ordinal)))
                    {
                        bondType = "1";
                    }
                }
                //            molecule.Bonds[i].SetProperty("MMFF94 bond type", bondType);
                bond.SetProperty("MMFF94 bond type", bondType);
                //Debug.WriteLine("bond[" + i + "] properties : " + molecule.Bonds[i].GetProperties());
            }

            return(ringSetMolecule);
        }
コード例 #12
0
 GroupFromGeneratorsAlt(
     items.Select(str => Cycles.FromString(str).ToPermutation(n)),
コード例 #13
0
 public void SetEntryState(Cycles cycles, EntityState entityState)
 {
     db.Entry(cycles).State = entityState;
 }
コード例 #14
0
 public void Remove(Cycles cycles)
 {
     db.Cycles.Remove(cycles);
 }
コード例 #15
0
        public void GetSumWhoDel7Test(int a, int b, int exspected)
        {
            int actual = Cycles.GetSumWhoDel7(a, b);

            Assert.AreEqual(exspected, actual);
        }
コード例 #16
0
ファイル: Phase.cs プロジェクト: gmonk/ATSPM
        private void GetCycles(int StartofCycleEvent)
        {
            if (Events.Exists(s => s.EventCode == 1))
            {
                IsOverlap = false;

                var termEvent = new Cycle.TerminationCause();
                termEvent = Cycle.TerminationCause.Unknown;

                for (var i = 0; i < Events.Count; i++)
                {
                    var CycleStart       = new DateTime();
                    var changeToGreen    = new DateTime();
                    var beginYellowClear = new DateTime();
                    var endYellowClear   = new DateTime();
                    var changeToRed      = new DateTime();
                    var greenTerm        = new DateTime();
                    var cycleEnd         = new DateTime();

                    if (Events[i].EventCode == StartofCycleEvent)
                    {
                        if (i + 1 >= Events.Count)
                        {
                            break;
                        }
                        CycleStart = Events[i].Timestamp;
                        switch (Events[i].EventCode)
                        {
                        case 1:
                            changeToGreen = Events[i].Timestamp;
                            break;

                        case 4:
                            termEvent = Cycle.TerminationCause.GapOut;
                            break;

                        case 5:
                            termEvent = Cycle.TerminationCause.MaxOut;
                            break;

                        case 6:
                            termEvent = Cycle.TerminationCause.ForceOff;
                            break;

                        case 7:
                            greenTerm = Events[i].Timestamp;
                            break;

                        case 8:
                            beginYellowClear = Events[i].Timestamp;
                            break;

                        case 9:
                            endYellowClear = Events[i].Timestamp;
                            changeToRed    = Events[i].Timestamp;
                            break;
                            //case 10:
                            //    changeToRed = Events[i].Timestamp;
                            //    break;
                        }

                        var s = i + 1;


                        while (Events[s].EventCode != StartofCycleEvent && s != Events.Count)
                        {
                            switch (Events[s].EventCode)
                            {
                            case 1:
                                changeToGreen = Events[s].Timestamp;
                                break;

                            case 4:
                                termEvent = Cycle.TerminationCause.GapOut;
                                break;

                            case 5:
                                termEvent = Cycle.TerminationCause.MaxOut;
                                break;

                            case 6:
                                termEvent = Cycle.TerminationCause.ForceOff;
                                break;

                            case 7:
                                greenTerm = Events[s].Timestamp;
                                break;

                            case 8:
                                beginYellowClear = Events[s].Timestamp;
                                break;

                            case 9:
                                endYellowClear = Events[s].Timestamp;
                                changeToRed    = Events[s].Timestamp;
                                break;
                                //case 10:
                                //    changeToRed = Events[s].Timestamp;
                                //    break;
                            }
                            s++;
                            if (s >= Events.Count)
                            {
                                i = s;

                                //deal with the very last cycle
                                if (
                                    CycleStart > DateTime.MinValue
                                    )
                                {
                                    if (changeToGreen == DateTime.MinValue)
                                    {
                                        changeToGreen = CycleStart;
                                    }

                                    if (beginYellowClear == DateTime.MinValue)
                                    {
                                        beginYellowClear = CycleStart.AddSeconds(1);
                                    }

                                    if (endYellowClear == DateTime.MinValue)
                                    {
                                        endYellowClear = CycleStart.AddSeconds(4);
                                    }


                                    if (changeToRed == DateTime.MinValue)
                                    {
                                        changeToRed = CycleStart.AddSeconds(5);
                                    }


                                    if (Events.Last().EventCode == 1)
                                    {
                                        cycleEnd = Events.Last().Timestamp;
                                    }
                                    else
                                    {
                                        cycleEnd = EndDate;
                                    }

                                    var _Cycle = new Cycle(CycleStart, changeToGreen,
                                                           beginYellowClear, changeToRed, cycleEnd);
                                    _Cycle.EndYellowClearance = endYellowClear;
                                    _Cycle.TerminationEvent   = termEvent;

                                    Cycles.Add(_Cycle);
                                }
                                break;
                            }
                        }

                        if (s >= Events.Count)
                        {
                            break;
                        }

                        i        = s - 1;
                        cycleEnd = Events[s].Timestamp;


                        if (
                            CycleStart > DateTime.MinValue &&
                            changeToGreen > DateTime.MinValue &&
                            beginYellowClear > DateTime.MinValue &&
                            changeToRed > DateTime.MinValue
                            )
                        {
                            var _Cycle = new Cycle(CycleStart, changeToGreen,
                                                   beginYellowClear, changeToRed, cycleEnd);
                            _Cycle.EndYellowClearance = endYellowClear;
                            _Cycle.TerminationEvent   = termEvent;

                            Cycles.Add(_Cycle);
                        }
                        //else
                    }
                }
            }


            //if (Events.Exists(s => s.EventCode == 64))
            //{
            //    IsOverlap = true;
            //    for (int i = 0; i < Events.Count - 4; i++)
            //    {
            //        if (Events[i].EventCode == 64 && Events[i + 1].EventCode == 61 &&
            //            Events[i + 2].EventCode == 63 && Events[i + 3].EventCode == 64)
            //        {
            //            if ((Events[i + 3].Timestamp - Events[i].Timestamp).TotalSeconds < 300)
            //            {
            //                _Cycles.Add(new CustomReport.Cycle(Events[i].Timestamp, Events[i + 1].Timestamp,
            //                Events[i + 2].Timestamp, Events[i + 3].Timestamp, Events[i + 3].Timestamp));

            //                i = i + 3;
            //            }
            //        }
            //    }
            //}
        }
コード例 #17
0
        public void GetFibonachiNumbTest(int n, int exspected)
        {
            int actual = Cycles.GetFibonachiNumb(n);

            Assert.AreEqual(exspected, actual);
        }
コード例 #18
0
ファイル: Dandelion.cs プロジェクト: yazici/AVA
 public override void Create()
 {
     Cycles.Insert(0, force);
     Cycles.Insert(1, constrain);
     Cycles.Insert(2, verts);
 }
コード例 #19
0
        public void GetresultHalfdDvisionTest(int a, int exspected)
        {
            int actual = Cycles.GetresultHalfdDvision(a);

            Assert.AreEqual(exspected, actual);
        }
コード例 #20
0
        public void FindSameNumbTest(int a, int b, string exspected)
        {
            string actual = Cycles.FindSameNumb(a, b);

            Assert.AreEqual(exspected, actual);
        }
コード例 #21
0
        public void GetQuantitySummOddNuTest(int a, int exspected)
        {
            int actual = Cycles.FindQuantityOddNumb(a);

            Assert.AreEqual(exspected, actual);
        }
コード例 #22
0
        public void GetDegreeABTest(int a, int b, long exspected)
        {
            long actual = Cycles.GetDegreeAB(a, b);

            Assert.AreEqual(exspected, actual);
        }
コード例 #23
0
ファイル: CyclesTests.cs プロジェクト: hazer232323/Methods
 public static void Test7_WhenNumberAandBEqualZero_ArgumentExpection(int a, int b)
 {
     Assert.Throws <ArgumentException>(() => Cycles.Test7(a, b));
 }
コード例 #24
0
 public void Split1000ATest(int a, int [] exspected)
 {
     int[] actual = Cycles.Split1000A(a);
     Assert.AreEqual(exspected, actual);
 }
コード例 #25
0
ファイル: CyclesTests.cs プロジェクト: hazer232323/Methods
        public static void Test8(double n, int expected)
        {
            int actual = Cycles.Test8(n);

            Assert.AreEqual(expected, actual);
        }
コード例 #26
0
        public void TypeNumbGetNumbCoreATest(int a, int exspected)
        {
            int actual = Cycles.TypeNumbGetNumbCoreA(a);

            Assert.AreEqual(exspected, actual);
        }
コード例 #27
0
ファイル: CyclesTests.cs プロジェクト: hazer232323/Methods
        public static void Test11(int n, int[] expected)
        {
            int[] actual = Cycles.Test11(n);

            Assert.AreEqual(expected, actual);
        }
コード例 #28
0
        public void TypeNumbGetMaxDelTest(int a, int exspected)
        {
            int actual = Cycles.TypeNumbGetMaxDel(a);

            Assert.AreEqual(exspected, actual);
        }
コード例 #29
0
ファイル: CyclesTests.cs プロジェクト: hazer232323/Methods
        public static void Test12(int a, int b, string expected)
        {
            string actual = Cycles.Test12(a, b);

            Assert.AreEqual(expected, actual);
        }
コード例 #30
0
        //public static FunctionIntInt to_permutation(this Cycles cycles, int n) =>
        //    new FunctionIntInt(
        //        Enumerable.Range(1, n)
        //            .Select(i => (i, cycles.apply_multiple(i))));

        public static FunctionIntInt ToPermutation(this Cycles cycles, int n) =>