Inheritance: MonoBehaviour
Ejemplo n.º 1
0
 /// <summary> each display-page is exported to one Excel-sheet </summary>
 public static bool ExportSinglePackage(DisplayResults displayResults, out string errMsg, out MemoryStream excelStream)
 {
     return(Export(new List <DisplayResults>()
     {
         displayResults
     }, true, out errMsg, out excelStream));
 }
        public IList <DisplayResults> GetUserList(string username)
        {
            IList <DisplayResults> getUserGames = new List <DisplayResults>();

            IList <UserGameInfo> userGame = new List <UserGameInfo>();

            userGame = userGameInfoSQLDAO.PullUserGameInfo(username);

            foreach (UserGameInfo x in userGame)
            {
                DisplayResults newGameResult = new DisplayResults();
                newGameResult.UserGameInfo = x;
                newGameResult.GameInfo     = gameInfoSQLDAO.PullGameByID(x.Game_Id);
                newGameResult.Rating       = gameRatingSQLDAO.PullGameRating(newGameResult.GameInfo.ratingId);
                newGameResult.Franchise    = franchiseSQLDAO.PullSpecificFranchise(newGameResult.GameInfo.franchiseID);
                newGameResult.Genre        = genresSQLDAO.PullGenreList(newGameResult.GameInfo.genreID);
                newGameResult.Platform     = platformsSQLDAO.PullPlatformList(newGameResult.GameInfo.platformID);

                getUserGames.Add(newGameResult);
            }



            return(getUserGames);
        }
Ejemplo n.º 3
0
        public void CompileAndRun()
        {
            DisplayResults item = _singleton.Results[_singleton.Results.Count - 1];

            _singleton._page_calc.DoScroll(item);

            string plain_ole_command = _calculation_buffer[_calculation_buffer.Count - 1];

            calculatorParser parser = Parser(plain_ole_command);
            IParseTree       tree   = parser.expressionResult();

            IParseTree[] all_nodes = DFSVisitor.DFS(tree as ParserRuleContext).ToArray();

            if (CheckForExceptions(plain_ole_command, parser, tree, all_nodes))
            {
                return;
            }
            if (CheckForErrorToken(plain_ole_command, parser, tree, all_nodes))
            {
                return;
            }
            if (CheckForResult(plain_ole_command, parser, tree, all_nodes))
            {
                return;
            }

            string result = "Unknown.";

            Results[Results.Count - 1].result.Text = BuildFormattedCommandAndResult(plain_ole_command, 0, result);
            NotifyPropertyChanged("Results");
        }
Ejemplo n.º 4
0
        /// <summary>
        /// Using reflections to convert XML to class.
        /// </summary>
        /// <param name="strXML">XML to be parsed</param>
        /// <returns></returns>
        public List <ArrayOfResults> convertXmlToClassReflection(string strXML)
        {
            List <ArrayOfResults> lstarr = new List <ArrayOfResults>();

            try
            {
                XmlDocument xmldoc = new XmlDocument();
                xmldoc.LoadXml(strXML);
                var namespaceMgr = new XmlNamespaceManager(xmldoc.NameTable);
                namespaceMgr.AddNamespace("Result", "http://schemas.datacontract.org/2004/07/Rest_BingSearch");
                XmlNode     xmlNode         = xmldoc.SelectSingleNode("//Result:ArrayOfResults", namespaceMgr);
                XmlNodeList xmlResultsChild = xmlNode.ChildNodes;

                ArrayOfResults arrResult = new ArrayOfResults();
                foreach (XmlNode resultNode in xmlResultsChild)
                {
                    DisplayResults disp = new DisplayResults();
                    //Using reflections to get the class property value and convert it into class
                    foreach (XmlNode xml in resultNode.ChildNodes)
                    {
                        disp.GetType().GetProperty("res" + xml.Name).SetValue(disp, xml.InnerText, null);
                    }
                    //Add the result into the list of results.
                    arrResult.lstDisplayRes.Add(disp);
                }
                //In case of multiple array of results
                lstarr.Add(arrResult);
            }
            catch (Exception exp)
            {
                throw exp;
            }
            return(lstarr);
        }
Ejemplo n.º 5
0
        private void InDigit(string digit)
        {
            DisplayResults item = _singleton.Results[_singleton.Results.Count - 1];

            _singleton._page_calc.DoScroll(item);

            string plain_ole_command = _calculation_buffer[_calculation_buffer.Count - 1] + digit;

            _calculation_buffer[_calculation_buffer.Count - 1] = plain_ole_command;
            int ErrorPos = plain_ole_command.Length;

            byte[]           byteArray = Encoding.UTF8.GetBytes(plain_ole_command);
            calculatorParser pp        = new calculatorParser(
                new CommonTokenStream(
                    new calculatorLexer(
                        new AntlrInputStream(
                            new StreamReader(
                                new MemoryStream(byteArray)).ReadToEnd()))));
            IParseTree   tree   = pp.expressionResult();
            ITokenStream ts     = pp.TokenStream;
            string       result = AllTokens(ts).Reverse().Skip(1).First().Text;

            Results[Results.Count - 1].result.Text = BuildFormattedCommandAndResult(plain_ole_command, ErrorPos, result);
            NotifyPropertyChanged("Results");
        }
Ejemplo n.º 6
0
        public void Test()
        {
            ListNode sample1Head = new ListNode(2);

            sample1Head.next      = new ListNode(1);
            sample1Head.next.next = new ListNode(5);

            DisplayResults.Display(NextLargerNodes(sample1Head));

            ListNode sample2Head = new ListNode(2);

            sample2Head.next                = new ListNode(7);
            sample2Head.next.next           = new ListNode(4);
            sample2Head.next.next.next      = new ListNode(3);
            sample2Head.next.next.next.next = new ListNode(5);

            DisplayResults.Display(NextLargerNodes(sample2Head));


            ListNode sample3Head = new ListNode(1);

            sample3Head.next                               = new ListNode(7);
            sample3Head.next.next                          = new ListNode(5);
            sample3Head.next.next.next                     = new ListNode(1);
            sample3Head.next.next.next.next                = new ListNode(9);
            sample3Head.next.next.next.next.next           = new ListNode(2);
            sample3Head.next.next.next.next.next.next      = new ListNode(5);
            sample3Head.next.next.next.next.next.next.next = new ListNode(1);

            DisplayResults.Display(NextLargerNodes(sample3Head));
        }
Ejemplo n.º 7
0
 private void Start_Click(object sender, EventArgs e)
 {
     DisplayResults.Clear();
     if (checkBox1.Checked == true)
     {
         String ResStr = "";
         for (int i = 0; i < 1000; i++)
         {
             if (!(i % 2 == 0))
             {
                 ResStr += i.ToString() + "\r\n";
             }
         }
         DisplayResults.Text = ResStr;
     }
     else
     {
         for (int i = 0; i < 1000; i++)
         {
             if (!(i % 2 == 0))
             {
                 DisplayResults.Text += i.ToString() + "\r\n";
             }
         }
     }
 }
Ejemplo n.º 8
0
        private static void Main(string[] args)
        {
            var            encryptString = "_encrypted_";
            string         datePatern    = "dd_MM_H_mm_ss";
            Client         c;
            TextTestClient client = new TextTestClient();

            _displayResults = new DisplayResults();
            var logFilePath = "TestRun_NoSessions" + encryptString + DateTime.Now.ToString(datePatern) + ".txt";

            //Globals_Game.pcMasterList.Add("rory", new PlayerCharacter());
            using (Globals_Server.LogFile = new System.IO.StreamWriter(logFilePath))
            {
                _wordRecogniser = new WordRecogniser();
                _testClient     = new TextTestClient();
                Console.Clear();
                LogInPrompt();
                while (_testClient.IsConnectedAndLoggedIn() == false)
                {
                    Thread.Sleep(0);
                }
                var command = TokenizeConsoleEntry();
                ProcessCommand(_wordRecogniser.CheckWord(command[0]), command);
                ProcessCommand(WordRecogniser.Tasks.Check, command);
                while (_wordRecogniser.CheckWord(command[0]) != WordRecogniser.Tasks.Exit)
                {
                    command = TokenizeConsoleEntry();
                    ProcessCommand(_wordRecogniser.CheckWord(command[0]), command);
                    Globals_Server.LogFile.WriteLine(command[0]); // to log all the tasks attempted by the user before exit or server/client crash
                }
                Shutdown();
            }
        }
        public void Test()
        {
            int[] arr      = { 12, 11, 13, 5, 6, 7 };
            int   arr_size = arr.Length;

            mergeSort(arr, 0, arr_size - 1);
            DisplayResults.Display(arr);
        }
Ejemplo n.º 10
0
 public static void Test()
 {
     DisplayResults.Display(DecodeMorse(DecodeBits("1100110011001100000011000000111111001100111111001111110000000000000011001111110011111100111111000000110011001111110000001111110011001100000011"))); //E
     DisplayResults.Display(DecodeMorse(DecodeBits("01110")));                                                                                                                                          //E
     DisplayResults.Display(DecodeMorse(DecodeBits("00011100010101010001000000011101110101110001010111000101000111010111010001110101110000000111010101000101110100011101110111000101110111000111010000000101011101000111011101110001110101011100000001011101110111000101011100011101110001011101110100010101000000011101110111000101010111000100010111010000000111000101010100010000000101110101000101110001110111010100011101011101110000000111010100011101110111000111011101000101110101110101110")));
     //THE QUICK BROWN FOX JUMPS OVER THE LAZY DOG.
     DisplayResults.Display(DecodeMorse(DecodeBits("111"))); //E
 }
 public static void Test()
 {
     int[] arr1 = { 1, 2, 3, 4, 5, 6, 7, 8 };
     int[] arr2 = { 1, 3, 2, 4, 5, 6, 8, 7 };
     int[] arr3 = { 8, 7, 6, 5, 4, 3, 2, 1 };
     DisplayResults.Display(ReverseArray(arr1));
     DisplayResults.Display(ReverseArray(arr2));
     DisplayResults.Display(ReverseArray(arr3));
 }
Ejemplo n.º 12
0
        public static void Test()
        {
            List <string> sample1 = new string[] { "Heads", "Tails", "Tails", "Tails", "Heads", "Heads", "Tails" }.ToList();

            DisplayResults.Display(getMaxStreaks(sample1));
            List <string> sample2 = new string[] { "Tails", "Tails", "Tails" }.ToList();

            DisplayResults.Display(getMaxStreaks(sample2));
        }
 public static void Test()
 {
     DisplayResults.Display(Add("123", "345"));
     DisplayResults.Display(Add("3", "345"));
     DisplayResults.Display(Add("1", "345"));
     DisplayResults.Display(Add("555", "555"));
     DisplayResults.Display(Add("155", "555"));
     DisplayResults.Display(Add("155", "555"));
     DisplayResults.Display(Add("99999999999999999999", "1"));
 }
Ejemplo n.º 14
0
        private static List <ExportPage> GetPackagePages(DisplayResults displayResults)
        {
            List <ExportPage> exportPages = new List <ExportPage>();

            foreach (var dp in displayResults.displayPages)
            {
                exportPages.Add(GetPageContent(dp, dp.name));
            }
            return(exportPages);
        }
 public static void Test()
 {
     string[] names = new string[] { "Sheldon", "Leonard", "Penny", "Rajesh", "Howard" };
     long[]   nums  = new long[] { 1, 6, 10, 52, 63, 150, 7230702951 };
     foreach (var num in nums)
     {
         DisplayResults.Display(WhoIsNext(names, num));
         DisplayResults.Display(WhoIsNextBF(names, num));
     }
 }
Ejemplo n.º 16
0
 // Use this for initialization
 void Start()
 {
     ActivateStage(currentStage);
     school           = GetComponent <FishLibrary>();
     results          = GetComponent <DisplayResults>();
     casting          = GetComponent <CastRod>();
     catching         = GetComponent <CatchFish>();
     casting.enabled  = false;
     catching.enabled = false;
 }
Ejemplo n.º 17
0
 public static void Test()
 {
     int[] numbers1 = { 19, 5, 42, 2, 77 };
     DisplayResults.Display(Anagrams("a", new List <string> {
         "a", "b", "c", "d"
     }));
     int[] numbers2 = { 1, 3, 4, 2, 5, 6, 1 };
     DisplayResults.Display(Anagrams("racer", new List <string> {
         "carer", "arcre", "carre", "racrs", "racers", "arceer", "raccer", "carrer", "cerarr"
     }));
 }
Ejemplo n.º 18
0
 // Start is called before the first frame update
 void Start()
 {
     feedbackCalcs    = GetComponent <FeedbackCalculations>();
     playerStats      = GetComponent <PlayerStats>();
     deliverFeedback  = GetComponent <DeliverFeedback>();
     displayResults   = GetComponent <DisplayResults>();
     displayWinOrLose = GetComponent <DisplayWinOrLose>();
     budget           = GetComponent <BudgetManagement>();
     deliverFeedback.updateFeedback();
     quarterNum = 0;
     roundStart();
 }
Ejemplo n.º 19
0
        public static void Test()
        {
            string sample1 = "3";
            string sample2 = "5";
            string sample3 = "111";
            string sample4 = "369";

            DisplayResults.Display(GetPINs(sample1));
            DisplayResults.Display(GetPINs(sample2));
            DisplayResults.Display(GetPINs(sample3));
            DisplayResults.Display(GetPINs(sample4));
        }
        static async Task Main(string[] args)
        {
            var queryWorkflow  = new QueryWorkflow();
            var displayResults = new DisplayResults();

            var connectionString = UserInteractions.AskUserForAuthenticationInformation();
            var sqlCommand       = UserInteractions.PromptUserForSqlCommand();

            var results = await queryWorkflow.ExecuteQuery(connectionString, sqlCommand);

            displayResults.WriteSelectResultsToConsole(results);
        }
Ejemplo n.º 21
0
        /*the below is slow.*/

        /*public static ulong[] productFib(ulong prod)
         * {
         *  ulong num = 0;
         *  ulong resultN = 0;
         *  ulong resultNP = 0;
         *  while (resultN * resultNP < prod)
         *  {
         *      num++;
         *      resultN = Fibonacci(num);
         *      resultNP = Fibonacci(num + 1);
         *  }
         *  if (resultN * resultNP == prod)
         *      return new ulong[] { resultN, resultNP, 1 };
         *  else
         *      return new ulong[] { resultN, resultNP, 0 };
         *  //return new ulong[] { resultN-(num * 2 - 3), resultNP - ((num+1) * 2 - 3), 0 };
         * }
         *
         * public static ulong Fibonacci(ulong n)
         * {
         *  if (n <= 2)
         *  {
         *      return 1;
         *  }
         *  return Fibonacci(n - 1) + Fibonacci(n - 2);
         * }*/

        public static void Test()
        {
            DisplayResults.Display(productFib(0));
            DisplayResults.Display(productFib(1));
            DisplayResults.Display(productFib(2));
            DisplayResults.Display(productFib(3));
            DisplayResults.Display(productFib(4));
            DisplayResults.Display(productFib(5));
            DisplayResults.Display(productFib(714));
            DisplayResults.Display(productFib(800));
            DisplayResults.Display(productFib(4895));
        }
 public static void Test()
 {
     DisplayResults.Display(IsPrime(1));
     DisplayResults.Display(IsPrime(0));
     DisplayResults.Display(IsPrime(-1));
     DisplayResults.Display(IsPrime(2));
     DisplayResults.Display(IsPrime(3));
     DisplayResults.Display(IsPrime(4));
     DisplayResults.Display(IsPrime(5));
     DisplayResults.Display(IsPrime(6));
     DisplayResults.Display(IsPrime(101));
 }
Ejemplo n.º 23
0
        private void StartOperation(string searchText, int maxResults = Search.DefaultMaxResults)
        {
            Stopwatch sw            = Stopwatch.StartNew();
            var       results       = ExecuteSearch(searchText, maxResults);
            bool      moreAvailable = results is System.Collections.ICollection collection && collection.Count >= maxResults;
            var       elapsed       = sw.Elapsed;

            if (latestSearch == searchText)
            {
                DisplayResults?.Invoke(results, moreAvailable);
                SearchComplete?.Invoke(searchText, results, elapsed);
            }
        }
Ejemplo n.º 24
0
        private void StartOperation(string searchText)
        {
            Stopwatch sw      = Stopwatch.StartNew();
            var       results = ExecuteSearch(searchText);
            var       elapsed = sw.Elapsed;

            BuildControl.Elapsed = elapsed;
            if (latestSearch == searchText)
            {
                Application.Current.Dispatcher.InvokeAsync(() =>
                {
                    DisplayResults?.Invoke(results);
                    SearchComplete?.Invoke(searchText, results);
                });
            }
        }
Ejemplo n.º 25
0
        private void StartOperation(string searchText)
        {
            Stopwatch sw      = Stopwatch.StartNew();
            var       search  = new Search(Build);
            var       results = search.FindNodes(searchText);
            var       elapsed = sw.Elapsed;

            BuildControl.Elapsed = elapsed;
            if (latestSearch == searchText)
            {
                Application.Current.Dispatcher.InvokeAsync(() =>
                {
                    DisplayResults?.Invoke(results);
                });
            }
        }
Ejemplo n.º 26
0
        private void StartOperation()
        {
            var cts = new CancellationTokenSource();

            Interlocked.Exchange(ref currentCancellationTokenSource, cts)?.Cancel();

            var localSearchText = searchText;
            var localMaxResults = maxResults;

            var sw      = Stopwatch.StartNew();
            var results = ExecuteSearch(localSearchText, localMaxResults, cts.Token);
            var elapsed = sw.Elapsed;

            var moreAvailable = results is System.Collections.ICollection collection && collection.Count >= localMaxResults;

            if (!cts.Token.IsCancellationRequested)
            {
                SearchComplete?.Invoke(localSearchText, results, elapsed);
                DisplayResults?.Invoke(results, moreAvailable);
            }
        }
Ejemplo n.º 27
0
        public static void Test()
        {
            int[][] array =
            {
                new [] { 1, 2, 3 },
                new [] { 4, 5, 6 },
                new [] { 7, 8, 9 }
            };
            DisplayResults.Display(Snail(array));

            int[][] array2 =
            {
                new [] {  1,  2,  3, 4 },
                new [] { 12, 13, 14, 5 },
                new [] { 11, 16, 15, 6 },
                new [] { 10,  9,  8, 7 }
            };
            DisplayResults.Display(Snail(array2));

            int[][] array3 = { new int[] { } };
            DisplayResults.Display(Snail(array3));
        }
        /*public static List<int> DynamicArray(int n, List<List<int>> queries)
         *  {
         *  List<int> seqList = new List<int>(n);
         *  List<int> s0 = new List<int>();
         *  List<int> s1 = new List<int>();
         *  int lastAnswer = 0;
         *  foreach(var query in queries)
         *  {
         *      int qn = query[0];
         *      int x = query[1];
         *      int y = query[2];
         *      int seq = (x ^ lastAnswer) % n;
         *      if(qn == 1)
         *      {
         *          if(seq == 0)
         *          {
         *              s0.Add(y);
         *          }
         *          if(seq == 1)
         *          {
         *              s1.Add(y);
         *          }
         *      }
         *      else if(qn == 2)
         *      {
         *          if(seq == 0)
         *          {
         *              lastAnswer = s0[s0.Count-1];
         *          }
         *          if(seq == 1)
         *          {
         *              lastAnswer = s1[s1.Count-1];
         *          }
         *          seqList.Add(lastAnswer);
         *      }
         *  }
         *  return seqList;
         * }*/

        public static void Test()
        {
            int sample = 2;
            List <List <int> > queries = new List <List <int> >();

            queries.Add(new List <int> {
                1, 0, 5
            });
            queries.Add(new List <int> {
                1, 1, 7
            });
            queries.Add(new List <int> {
                1, 0, 3
            });
            queries.Add(new List <int> {
                2, 1, 0
            });
            queries.Add(new List <int> {
                2, 1, 1
            });
            DisplayResults.Display(DynamicArray(sample, queries));
        }
        /*public static long hamming(int n)
         * {
         *  int i = 0, j = 0, k = 0;
         *  List<long> result = new List<long>();
         *  HashSet<long> result2 = new HashSet<long>();
         *  for (k = 0; k <= n / 5 + 1; k++)
         *  {
         *      for (j = 0; j <= n / 3 + 1; j++)
         *      {
         *          for (i = 0; i <= n / 2 + 1; i++)
         *          {
         *              if ((long)Math.Pow(2, i) * (long)Math.Pow(3, j) * (long)Math.Pow(5, k) > 0)
         *                  result.Add((long)Math.Pow(2, i) * (long)Math.Pow(3, j) * (long)Math.Pow(5, k));
         *          }
         *      }
         *  }
         *  result.Sort();
         *  return result[n - 1];
         * }*/
        public static long hamming(int n)
        {
            int         i = 0, j = 0, k = 0;
            List <long> result = new List <long>();

            for (k = 0; k <= 2; k++)
            {
                for (j = 0; j <= 2; j++)
                {
                    for (i = 0; i <= 5; i++)
                    {
                        if ((long)Math.Pow(2, i) * (long)Math.Pow(3, j) * (long)Math.Pow(5, k) > 0)
                        {
                            result.Add((long)Math.Pow(2, i) * (long)Math.Pow(3, j) * (long)Math.Pow(5, k));
                        }
                    }
                }
            }
            result.Sort();
            DisplayResults.Display(result);
            long[] set   = new long[5];
            int    index = 0;

            for (int s = 7; s <= 26; s++)
            {
                set[index++] = result[s - 1];
            }
            if (n > 6)
            {
                int setCoefficient = ((n - 7) / 28) + 1;
                int setIndex       = (n - 28) % 5;
                return(set[setIndex] * (long)Math.Pow(2, setCoefficient - 1));
            }
            else
            {
                return(result[n - 1]);
            }
        }
Ejemplo n.º 30
0
        public static void Test()
        {
            List <long[]> tmp = removNb(26);

            foreach (long[] x in tmp)
            {
                DisplayResults.Display(x);
            }

            List <long[]> tmp2 = removNb(1000003);

            foreach (long[] x in tmp2)
            {
                DisplayResults.Display(x);
            }

            List <long[]> tmp3 = removNb(846);

            foreach (long[] x in tmp3)
            {
                DisplayResults.Display(x);
            }
        }