Esempio n. 1
0
 protected virtual void OnPreProcess(EventArgs e)
 {
     if (PreProcess != null)
     {
         PreProcess?.Invoke(this, e);
     }
 }
Esempio n. 2
0
        public void divideSpace()
        {
            string testString = "not 30.24 and(125 or 175)";

            Assert.AreEqual(
                "not 30.24 and ( 125 or 175 )"
                , PreProcess.divideSpace(testString));
        }
Esempio n. 3
0
 public void identifyChar()
 {
     Assert.AreEqual(PreProcess.IdentifyChar('a')
                     , charType.letter);
     Assert.AreEqual(PreProcess.IdentifyChar('4')
                     , charType.number);
     Assert.AreEqual(PreProcess.IdentifyChar('+')
                     , charType.symbol);
 }
Esempio n. 4
0
        static void Main(string[] args)
        {
            string path  = @"C:\Users\tram.huynh\Downloads\Demo\Example\1.cs";
            string path2 = @"C:\Users\tram.huynh\Downloads\Demo\PreProcess\1.cs";
            string a     = "#include abc;\r\nusing System;\nnamespace ConsoleApp1\n{\n    class Program\n    {  /*\n* abc desnnj \n*/\n      static void Main(string[] args)\n        {\n			//abc// ebc/\n            string c =\"acf\";\n			int a;\nint 			b,  s;\n			/*dvahsdbjas\n															dad**/\n            Console.WriteLine(b);\n            Console.ReadKey();/*dvahsdbjas*/\n        }\n    }\n}\n";
            string text  = File.ReadAllText(path);

            //var b = PreProcess.StripComments(text);
            var b = PreProcess.StripComments(a);
            var c = PreProcess.RemoveBlank(b);
            var d = PreProcess.RemovePackage(c);

            File.WriteAllText(path2, d);
            //Console.ReadKey();
        }
Esempio n. 5
0
        private void runTheAlgorithm(int minStores, int maxStores, bool continueWhenMatchesFound,
            List<Store> storeList, List<Item> itemList, Algorithm alg, PreProcess preProc = null) {
            // Pre-process the data
            if (preProc != null) {
                preProc(ref storeList, ref itemList);
            }

            // Now run the algorithms for the specified number of stores in the solution.
            for (int k = minStores; k <= maxStores; k++) {
                if ((!matchesfound || continueWhenMatchesFound) && !calcWorker.CancellationPending) {
                    beginCalculation(k, storeList.Count);
                    alg(k, storeList, itemList);
                    endCalculation(k);
                }
            }

        }
Esempio n. 6
0
        private void runApproxAlgorithm(
            int minStores,
            int maxStores,
            int millisToRunEach,
            List <Store> storeList,
            List <Item> itemList,
            Algorithm alg,
            //PreProcess preProc = null)
            PreProcess preProc)
        {
            // Pre-process the data
            if (preProc != null)
            {
                preProc(ref storeList, ref itemList);
            }

            if (timeoutTimer != null)
            {
                timeoutTimer.Stop();
            }
            else
            {
                timeoutTimer          = new System.Timers.Timer();
                timeoutTimer.Elapsed += timeoutTimer_Elapsed;
            }

            timeoutTimer.Interval = millisToRunEach;

            for (int k = minStores; k <= maxStores; k++)
            {
                if (!calcWorker.CancellationPending)
                {
                    beginCalculation(k, storeList.Count);
                    timeoutTimer.Start();
                    alg(k, storeList, itemList);
                    timeoutTimer.Stop();
                    endCalculation(k);
                }
            }
        }
Esempio n. 7
0
        private void runApproxAlgorithm(int minStores, int maxStores, int millisToRunEach, List<Store> storeList, List<Item> itemList, Algorithm alg, PreProcess preProc = null) {
            // Pre-process the data
            if (preProc != null) {
                preProc(ref storeList, ref itemList);
            }
            if (timeoutTimer != null) {
                timeoutTimer.Stop();
            } else {
                timeoutTimer = new System.Timers.Timer();
                timeoutTimer.Elapsed += timeoutTimer_Elapsed;
            }
            timeoutTimer.Interval = millisToRunEach;

            for (int k = minStores; k <= maxStores; k++) {
                if (!calcWorker.CancellationPending) {
                    beginCalculation(k, storeList.Count);
                    timeoutTimer.Start();
                    alg(k, storeList, itemList);
                    timeoutTimer.Stop();
                    endCalculation(k);
                }
            }

        }
Esempio n. 8
0
        private void runTheAlgorithm(int minStores, int maxStores, bool continueWhenMatchesFound,
                                     List <Store> storeList, List <Item> itemList, Algorithm alg, PreProcess preProc = null)
        {
            // Pre-process the data
            if (preProc != null)
            {
                preProc(ref storeList, ref itemList);
            }

            // Now run the algorithms for the specified number of stores in the solution.
            for (int k = minStores; k <= maxStores; k++)
            {
                if ((!matchesfound || continueWhenMatchesFound) && !calcWorker.CancellationPending)
                {
                    beginCalculation(k, storeList.Count);
                    alg(k, storeList, itemList);
                    endCalculation(k);
                }
            }
        }
Esempio n. 9
0
 public CommandNode <TEnv> Handles(PreProcess <TEnv> process)
 {
     Process = process;
     return(this);
 }