Пример #1
0
        public void RunFind(object obj)
        {
            T key = (T)obj;

            while (firstSorting || secondSorting)
            {
                bool findingInitially = true;
                findEvent.WaitOne();
                lock (changeLocker)
                {
                    if (findingInitially)
                    {
                        Monitor.PulseAll(changeLocker);
                        findingInitially = false;
                    }
                    try
                    {
                        T foundKey = finder.Find(key, this.m1);
                    }
                    catch (KeyNotFoundException e)
                    {
                    }
                    Monitor.PulseAll(changeLocker);
                }
            }
        }
Пример #2
0
 public ComboBoxBinder(string value, IEnumerable <string> hints, ComboBoxStyle style)
 {
     if (style == ComboBoxStyle.DropDownList)
     {
         Debug.Assert(Finder.Find(hints, value));
     }
     Init(hints, style, value);
 }
Пример #3
0
 private void Awake()
 {
     if (Finder.Find <MusicPlayer>() == null)
     {
         var gameObject = new GameObject();
         gameObject.AddComponent <MusicPlayer>();
     }
 }
Пример #4
0
        private void Awake()
        {
            _audioSource      = GetComponent <AudioSource>();
            _audioSource.clip = Finder.Find <LevelMenuSettings>().cubeSoundPlayer.clickSound;

            AudioSettings.Instance.SoundEnabled  += OnSoundEnabled;
            AudioSettings.Instance.SoundDisabled += OnSoundDisabled;
        }
Пример #5
0
        public void FillTreeItem(string filter = "")
        {
            // Ищим объекты
            var selectFinderList = Finder.Find(_finderList, filter);

            // Заполняем дерево
            _treeItem.Fill(selectFinderList);
        }
Пример #6
0
 /// <summary>
 /// Finds the entities in the specified document.
 /// </summary>
 /// <param name="tokens">The tokens.</param>
 /// <param name="entityFinder">The entity finder.</param>
 /// <returns>The document after it is processed.</returns>
 public Token[] Find(Token[] tokens, string entityFinder)
 {
     if (!Finders.TryGetValue(entityFinder, out var Finder))
     {
         return(tokens);
     }
     return(Finder.Find(tokens));
 }
Пример #7
0
            public void Returns_Empty_Results()
            {
                var list   = new List <Person>();
                var finder = new Finder(list);

                var result = finder.Find(FinderOption.Closest);

                Assert.Equal(Pair.Empty, result);
            }
Пример #8
0
        private void OnDestroy()
        {
            var figureLoader = Finder.Find <FigureLoader>();

            if (figureLoader != null)
            {
                figureLoader.FigureLoaded -= OnFigureLoaded;
            }
        }
Пример #9
0
        public void Returns_Closest_Two_For_Two_People()
        {
            var list = new List<Person>() { sue, greg };
            var finder = new Finder(list);

            var result = finder.Find(FindType.ClosestInAge);

            Assert.Same(sue, result.OlderPerson);
            Assert.Same(greg, result.YoungerPerson);
        }
Пример #10
0
        public void Returns_Null_When_Given_Empty_List()
        {
            var list   = new List <Person>();
            var finder = new Finder(list);

            var result = finder.Find(FinderFlag.Closest);

            Assert.Null(result.Younger);
            Assert.Null(result.Older);
        }
Пример #11
0
        public void Returns_Empty_Results_When_Given_Empty_List()
        {
            var list = new List<Person>();
            var finder = new Finder(list);

            var result = finder.Find(By.Closest);

            Assert.Null(result.Younger);
            Assert.Null(result.Older);
        }
Пример #12
0
        public void Returns_Closest_Two_For_Four_People()
        {
            var list = new List<Person>() { greg, mike, sarah, sue };
            var finder = new Finder(list);

            var result = finder.Find(By.Closest);

            Assert.Same(sue, result.Younger);
            Assert.Same(greg, result.Older);
        }
Пример #13
0
        public void Returns_Furthest_Two_For_Four_People()
        {
            var list = new List<Person>() { greg, mike, sarah, sue };
            var finder = new Finder(list);

            var result = finder.Find(FindType.MaximumDiff);

            Assert.Same(sue, result.Person1);
            Assert.Same(sarah, result.Person2);
        }
Пример #14
0
        public void Returns_Empty_Results_When_Given_One_Person()
        {
            var list = new List<Person>() { sue };
            var finder = new Finder(list);

            var result = finder.Find(FindType.MinimumDiff);

            Assert.Null(result.Person1);
            Assert.Null(result.Person2);
        }
Пример #15
0
        public void Returns_Closest_Two_For_Two_People()
        {
            var list = new List<Person>() { sue, greg };
            var finder = new Finder(list);

            var result = finder.Find(FindType.MinimumDiff);

            Assert.Same(sue, result.Person1);
            Assert.Same(greg, result.Person2);
        }
Пример #16
0
        public void Returns_Empty_Results_When_Given_Empty_List()
        {
            var list   = new List <Person>();
            var finder = new Finder(list);

            var result = finder.Find(FindType.ClosestAge);

            Assert.Null(result.YongerPerson);
            Assert.Null(result.OlderPerson);
        }
        public void Returns_Empty_Results_When_Given_Empty_List()
        {
            var list   = new List <Person>();
            var finder = new Finder();

            var result = finder.Find(list, Criteria.Clossest);

            Assert.Null(result.PersonMinor);
            Assert.Null(result.PersonMajor);
        }
Пример #18
0
        public void ReturnsFurthestTwoForFourPeople()
        {
            var list = new List<Person> { greg, mike, sarah, sue };
            var finder = new Finder(list);

            var result = finder.Find(FinderType.Furthest);

            Assert.Same(sue, result.YoungerPerson);
            Assert.Same(sarah, result.OlderPerson);
        }
Пример #19
0
        public void ReturnsClosestTwoForTwoPeople()
        {
            var list = new List<Person> { sue, greg };
            var finder = new Finder(list);

            var result = finder.Find(FinderType.Closest);

            Assert.Same(sue, result.YoungerPerson);
            Assert.Same(greg, result.OlderPerson);
        }
Пример #20
0
        public void Returns_Closest_Two_For_Four_People()
        {
            var list = new List<Thing>() { greg, mike, sarah, sue };
            var finder = new Finder(list);

            var result = finder.Find(FT.One);

            Assert.AreEqual(sue, result.P1);
            Assert.AreEqual(greg, result.P2);
        }
Пример #21
0
        public void Returns_Furthest_Two_For_Two_People()
        {
            var list = new List<Person>() { greg, mike };
            var finder = new Finder(list);

            var result = finder.Find(FT.Two);

            Assert.Same(greg, result.P1);
            Assert.Same(mike, result.P2);
        }
Пример #22
0
        public void Returns_Empty_Results_When_Given_Empty_List()
        {
            var list = new List<Person>();
            var finder = new Finder(list);

            var result = finder.Find(FindThe.Closest);

            Assert.Null(result.Person1);
            Assert.Null(result.Person2);
        }
Пример #23
0
        public void ReturnsEmptyResultsWhenGivenOnePerson()
        {
            var list = new List<Person> { sue };
            var finder = new Finder(list);

            var result = finder.Find(FinderType.Closest);

            Assert.Null(result.YoungerPerson);
            Assert.Null(result.OlderPerson);
        }
Пример #24
0
        public void Returns_Furthest_Two_For_Four_People()
        {
            var list = new List<Person>() { greg, mike, sarah, sue };
            var finder = new Finder(list);

            var result = finder.Find(FindType.FurthestInAge);

            Assert.Same(sue, result.OlderPerson);
            Assert.Same(sarah, result.YoungerPerson);
        }
Пример #25
0
        public void Returns_EmptyResults_WhenGivenEmptyList()
        {
            var list   = new List <Person>();
            var finder = new Finder(list);

            var result = finder.Find(TimeSpanFilter.Closest);

            Assert.Null(result.Person1);
            Assert.Null(result.Person2);
        }
        public void Returns_Empty_Results_When_Given_Empty_List()
        {
            var list   = new List <Person>();
            var finder = new Finder(list);

            var result = finder.Find(SearchType.Closest);

            Assert.IsNull(result.Oldest);
            Assert.IsNull(result.Younger);
        }
Пример #27
0
        public void Returns_Empty_Results_When_Given_Empty_List()
        {
            var list   = new List <Person>();
            var finder = new Finder(list);

            var result = finder.Find(AgeDifference.Smallest);

            Assert.Null(result.FirstPerson);
            Assert.Null(result.SecondPerson);
        }
Пример #28
0
        public void Returns_Empty_Results_When_Given_One_Person()
        {
            var list = new List<Person>() { sue };
            var finder = new Finder(list);

            var result = finder.Find(ResultType.Closest);

            Assert.Null(result.PersonOne);
            Assert.Null(result.PersonTwo);
        }
Пример #29
0
        public void Returns_Furthest_Two_For_Four_People()
        {
            var list = new List<Person>() { greg, mike, sarah, sue };
            var finder = new Finder(list);

            var result = finder.Find(ResultType.Furthest);

            Assert.Same(sue, result.PersonOne);
            Assert.Same(sarah, result.PersonTwo);
        }
Пример #30
0
        public void Returns_Furthest_Two_For_Four_People()
        {
            var list = new List<Thing>() { greg, mike, sarah, sue };
            var finder = new Finder(list);

            var result = finder.Find(FT.Two);

            Assert.Same(sue, result.P1);
            Assert.Same(sarah, result.P2);
        }
Пример #31
0
        public void Returns_Closest_Two_For_Two_People()
        {
            var list = new List<Person>() { sue, greg };
            var finder = new Finder(list);

            var result = finder.Find(ResultType.Closest);

            Assert.Same(sue, result.PersonOne);
            Assert.Same(greg, result.PersonTwo);
        }
Пример #32
0
        public void Returns_Empty_Results_When_Given_One_Person()
        {
            var list = new List<Thing>() { sue };
            var finder = new Finder(list);

            var result = finder.Find(FT.One);

            Assert.Null(result.P1);
            Assert.Null(result.P2);
        }
Пример #33
0
        public void Returns_Closest_Two_For_Two_People()
        {
            var list = new List<Thing>() { sue, greg };
            var finder = new Finder(list);

            var result = finder.Find(FT.One);

            Assert.Same(sue, result.P1);
            Assert.Same(greg, result.P2);
        }
Пример #34
0
        public void Returns_Empty_Results_When_Given_One_Person()
        {
            var list = new List<Person>() { sue };
            var finder = new Finder(list);

            var result = finder.Find(FindType.ClosestInAge);

            Assert.Null(result.OlderPerson);
            Assert.Null(result.YoungerPerson);
        }
Пример #35
0
        public void Returns_Empty_Results_When_Given_Empty_List()
        {
            var list   = new PersonList();
            var finder = new Finder(list);

            var result = finder.Find(Find.Closest);

            Assert.IsNull(result.Person1);
            Assert.IsNull(result.Person2);
        }
Пример #36
0
        public void Returns_Empty_Results_When_Given_Empty_List()
        {
            var list   = new List <Thing>();
            var finder = new Finder(list);

            var result = finder.Find(FT.One);

            Assert.Null(result.P1);
            Assert.Null(result.P2);
        }
Пример #37
0
        public void Returns_Empty_Results_When_Given_Empty_List()
        {
            var list = new List <Person>();
            IPeopleCompareFilter filter = new FurthestBirthdateCompareFilter();
            var finder = new Finder(list, filter);

            var result = finder.Find();

            Assert.Null(result.Person1);
            Assert.Null(result.Person2);
        }
Пример #38
0
        static void Main(string[] args)
        {
            Generator gen    = new Generator();
            Finder    finder = new Finder();
            //---- problem space
            int x         = 6;
            int y         = 6;
            int hc        = 35;
            int xTileSize = 2;
            int yTileSize = 2;
            int n         = 2;

            int myX = 2;
            int myY = 4;


            /* int x = 100;
            *  int y = 100;
            *  int hc = 5000;
            *  int xTileSize = 5;
            *  int yTileSize = 5;
            *  int n = 20;
            *
            *  int myX = 40;
            *  int myY = 25;*/

            //-------------------

            var data = gen.Generate(x, y, xTileSize, yTileSize, hc);

            List <HotelTilePoint> result = finder.Find(myX, myY, n, x, y, xTileSize, yTileSize, data);


            Console.WriteLine($" my current x {myX} my current y {myY} ");

            foreach (HotelTilePoint t in result)
            {
                Console.WriteLine(t);
            }

            /*  TileIdClaculator t = new TileIdClaculator();
             *
             * List<int> nears= t.findNears(0, x, y, xTileSize, yTileSize);
             * nears.Sort();
             * foreach (int near in nears)
             * {
             *    Console.WriteLine(near);
             * }
             */

            // Console.WriteLine(i);

            Console.ReadKey();
        }
Пример #39
0
        public void Find_WhenSearchTextIsLicense12345_ReturnsNoResults()
        {
            Finder finder = new Finder();

            finder.Dir      = _tempDir;
            finder.FileMask = "*.*";
            finder.FindText = "license12345";

            var resultItems = finder.Find().Items;

            Assert.AreEqual(0, resultItems.Count);
        }
Пример #40
0
        public void Find_WhenSearchMaskIsTxt1_NoFindsText()
        {
            Finder finder = new Finder();

            finder.Dir      = _tempDir;
            finder.FileMask = "*.txt1";
            finder.FindText = "a";

            var resultItems = finder.Find().Items;

            Assert.AreEqual(0, resultItems.Count);
        }
Пример #41
0
 private void DoFindWork()
 {
     try
     {
         _finder.Find();
     }
     catch (Exception e)
     {
         MessageBox.Show(e.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
         OnFinderFileProcessed(this, new FinderEventArgs(new Finder.FindResultItem(), new Stats(), Status.Cancelled, _finder.IsSilent));
     }
 }
Пример #42
0
            static bool CanShowNameOrLevel(CubeLevelConfigurationHolder levelHolder)
            {
                if (levelHolder == null)
                {
                    return(false);
                }

                var testMode = Finder.Find <LevelMenuMetaLoader>().TestMode;
                var isOpened = levelHolder.LevelConfiguration.IsOpened;

                return(testMode || isOpened);
            }
Пример #43
0
        public void Returns_Empty_Results_When_Given_Empty_List()
        {
            var finder = new Finder(
                new BirthdayDifferenceRepository(new List <Person.Person>()),
                AlgorithmsFactory.GetSmallestBirthdayDifference()
                );

            var result = finder.Find();

            Assert.Null(result.YoungerPerson);
            Assert.Null(result.OlderPerson);
        }
Пример #44
0
        public void Find_WhenSearchTextIsNewYorkNoRegExpr_FindsNoMatches()
        {
            Finder finder = new Finder();

            finder.Dir      = _tempDir;
            finder.FileMask = "*.*";
            finder.FindText = "New York";

            var resultItems = finder.Find().ItemsWithMatches.ToList();

            Assert.AreEqual(0, resultItems.Count);
        }
Пример #45
0
        private void TestFinder(string testName, int numFiles, int fileSizeInChars, string regExExpression = null)
        {
            CreateSpeedDir();

            WriteFiles(numFiles, fileSizeInChars);


            StopWatch stopWatch = new StopWatch();

            stopWatch.Start();

            Finder finder = new Finder();

            finder.Dir      = _speedDir;
            finder.FileMask = "*.*";

            if (regExExpression == null)
            {
                finder.FindText = "it";
            }
            else
            {
                finder.FindText         = regExExpression;
                finder.FindTextHasRegEx = true;
            }

            var findResult = finder.Find();

            Assert.AreEqual(numFiles, findResult.Stats.Files.Total);
            //Assert.AreEqual(5000, findResult.Stats.Matches.Found);


            stopWatch.Stop();

            if (_addToAllTestResults)
            {
                AddToAllTestResults(testName, numFiles, fileSizeInChars);
            }
            else
            {
                Console.WriteLine("=================================================");
                Console.WriteLine("Num Files = " + numFiles + ", File Size=" + fileSizeInChars + " chars ");
                Console.WriteLine("==================================================");

                StopWatch.PrintCollection(stopWatch.Milliseconds);
                Console.WriteLine("");
            }

            StopWatch.Collection.Clear();

            DeleteSpeedDir();
        }
Пример #46
0
            public void Furthest_Option_Returns_Pair_With_Highest_Age_Difference()
            {
                var list = new List <Person>()
                {
                    greg, mike, sarah, sue
                };
                var finder = new Finder(list);

                var result = finder.Find(FinderOption.Closest);

                Assert.Same(sue, result.YoungerPerson);
                Assert.Same(greg, result.OlderPerson);
            }
Пример #47
0
            public void Closest_Option_Returns_Pair_With_Lowest_Age_Difference()
            {
                var list = new List <Person>()
                {
                    sue, greg
                };
                var finder = new Finder(list);

                var result = finder.Find(FinderOption.Closest);

                Assert.Same(sue, result.YoungerPerson);
                Assert.Same(greg, result.OlderPerson);
            }
Пример #48
0
        public void Returns_Closest_Two_For_Four_People()
        {
            var list = new List <Person>()
            {
                greg, mike, sarah, sue
            };
            var finder = new Finder(list);

            var result = finder.Find(FindType.ClosestAge);

            Assert.Same(sue, result.YongerPerson);
            Assert.Same(greg, result.OlderPerson);
        }
Пример #49
0
        public void Returns_Furthest_Two_For_Two_People()
        {
            var list = new List <Person>()
            {
                greg, mike
            };
            var finder = new Finder(list);

            var result = finder.Find(FindType.FurthestAge);

            Assert.Same(greg, result.YongerPerson);
            Assert.Same(mike, result.OlderPerson);
        }
Пример #50
0
        public void Returns_Closest_Two_On_Finding_Closest_Two_In_List_Of_Four_People()
        {
            var list = new List <Person>()
            {
                greg, mike, sarah, sue
            };
            var finder = new Finder(list);

            var result = finder.Find(FindTypes.ClosestTwo);

            Assert.Same(sue, result.YoungerPerson);
            Assert.Same(greg, result.OlderPerson);
        }
Пример #51
0
        public void Returns_Furthest_Two_For_Two_People()
        {
            var list = new List<Thing>() { greg, mike };
            var finder = new Finder(list);

            var result = finder.Find(FT.Two);

            Assert.AreEqual(greg, result.P1);
            Assert.AreEqual(mike, result.P2);
        }
Пример #52
0
        public void Returns_Furthest_Two_For_Two_People()
        {
            var list = new List<Person>() { greg, mike };
            var finder = new Finder(list);

            var result = finder.Find(FindType.FurthestAge);

            Assert.Same(greg, result.YongerPerson);
            Assert.Same(mike, result.OlderPerson);
        }