Exemplo n.º 1
0
        public void OverviewFor(string t, string p, ref bool b, ref SearchSet obj, ArrayList list)
        {
            PartOfSpeech pos         = Wnlib.PartOfSpeech.of(p);
            SearchSet    ss          = Wnlib.WNDB.is_defined(t, pos);
            MorphStr     ms          = new Wnlib.MorphStr(t, pos);
            bool         checkmorphs = false;

            checkmorphs = AddSearchFor(t, pos, list);             // do a search
            string m;

            if (checkmorphs)
            {
                WN.hasmatch = true;
            }

            if (!hasmatch)
            {
                // loop through morphs (if there are any)
                while ((m = ms.next()) != null)
                {
                    if (m != t)
                    {
                        ss = ss + WNDB.is_defined(m, pos);
                        AddSearchFor(m, pos, list);
                    }
                }
            }
            b   = ss.NonEmpty;
            obj = ss;
        }
Exemplo n.º 2
0
//--------------------------------------------------------------------------------------------------
//  Create/sort search sets according to radii
//--------------------------------------------------------------------------------------------------
        private void GenerateSearchSets()
        {
            for (int i = 0; i < m_Radius + 1; i++)
            {
                m_SearchSets[i] = new SearchSet(i);

                for (int y = -m_Radius; y < m_Radius + 1; y++)
                {
                    for (int x = -m_Radius; x < m_Radius + 1; x++)
                    {
                        CircleEntry entry = m_Matrices[i, y + m_Radius, x + m_Radius];

                        if (entry == null)
                        {
                            continue;
                        }
                        if (entry.Distance > m_Radius)
                        {
                            continue;
                        }

                        m_SearchSets[i].AddEntry(entry);

                        m_nEntries++;
                    }
                }
            }
        }
Exemplo n.º 3
0
        public void OverviewFor(string t, string p, ref bool b, ref SearchSet obj, ArrayList list)
        {
            PartOfSpeech pos         = Wnlib.PartOfSpeech.of(p);
            SearchSet    ss          = Wnlib.WNDB.is_defined(t, pos);
            MorphStr     ms          = new Wnlib.MorphStr(t, pos);
            bool         checkmorphs = false;

            hasmatch = false;                         //TODO: if this isn't reset then morphs aren't checked on subsequent searches - check for side effects of resetting this manually

            checkmorphs = AddSearchFor(t, pos, list); // do a search
            string m;

            if (checkmorphs)
            {
                WN.hasmatch = true;
            }

            if (!hasmatch)
            {
                // loop through morphs (if there are any)
                while ((m = ms.next()) != null)
                {
                    if (m != t)
                    {
                        ss = ss + WNDB.is_defined(m, pos);
                        AddSearchFor(m, pos, list);
                    }
                }
            }
            b   = ss.NonEmpty;
            obj = ss;
        }
Exemplo n.º 4
0
        public void ControllerShouldSearchCorrect_NotEmptySearchSet_Page2()
        {
            var searchSet = new SearchSet()
            {
                SelectedPage = 2,
                Filter = new ContactsFilter()
                {
                    Name = "K"
                }
            };

            var paginationSet = (_controller.Search(searchSet) as OkNegotiatedContentResult<PaginationSet<ContactViewModel>>).Content;

            var entities = paginationSet.Items.ToDomainObjects<Contact>();

            var expected =
                _contacts.OrderBy(x => x.Id)
                .Filter(searchSet.Filter)
                .Skip((searchSet.SelectedPage - 1) * _controller.PageSize)
                .Take(_controller.PageSize);

            Assert.AreEqual(paginationSet.CurrentPage, 2);
            Assert.AreEqual(paginationSet.TotalPages, 2);
            Assert.AreEqual(paginationSet.TotalItems, 5);
            Assert.AreEqual(paginationSet.ItemsPerPage, 4);

            CollectionAssert.AreEqual(expected, entities, new ContactsComparer());
        }
        /// <summary>
        /// 検索中の状態レポートを生成する.
        /// </summary>
        /// <param name="searchSet"></param>
        /// <returns></returns>
        private SearchReport CreateSearchReport(SearchSet searchSet)
        {
            var searchReport = new SearchReport();

            // 要求されているシリーズスキルリスト.
            var needSeriesList = this.Requirements.RequirementSkillList.SeriesList;

            // 必要シリーズスキルを一つずつチェックする.
            foreach (var needSeries in needSeriesList)
            {
                // 発動しているかどうかをチェック.
                var count = searchSet.GetSeriesCount(needSeries.Index);
                if (needSeries.Skill.Need <= count)
                {
                    // 満たしているスキルに登録.
                    searchReport.SatisfyList.Add(needSeries.Index);
                }
                else
                {
                    // 満たしていないスキルに登録.
                    searchReport.UnsatisfyList.Add(needSeries.Index);
                    searchReport.UnsatisfyBaseList.Add(new SkillBase(
                                                           needSeries.Index,
                                                           needSeries.Skill.Need - count));
                }
            }

            // 要求されているスキルリスト.
            var needSkillList = this.Requirements.RequirementSkillList.SkillList;

            // 必要スキルを一つずつチェックする.
            foreach (var needSkill in needSkillList)
            {
                // 検索セットが必要スキルLvを満たしている場合.
                var sumLv = searchSet.GetSkillLvSum(needSkill.Index);
                if (needSkill.Lv <= sumLv)
                {
                    // 満たしているスキルに登録.
                    searchReport.SatisfyList.Add(needSkill.Index);
                }
                else
                {
                    // 満たしていないスキルに登録.
                    searchReport.UnsatisfyList.Add(needSkill.Index);
                    searchReport.UnsatisfyBaseList.Add(new SkillBase(
                                                           needSkill.Index,
                                                           needSkill.Lv - sumLv));
                }
            }

            // 空き、不足スロット状況を格納.
            searchSet.GetBlankSlot(searchReport.BlankSlotList, searchReport.LackSlotList);

            // 生成したリポートを返す.
            return(searchReport);
        }
Exemplo n.º 6
0
        static int nItems = 0;  // <Debug> Counting how many phrases we loaded
        // Use existing resources in isolated files
        private static void ExtractVocabulary()
        {
            // <Debug> Use of absoluate locations pending removed into internal resources or project files
            // <Notice> Make sure all files encoded in UTF8
            string WordNetDictLocation = @"H:\Projects\按项目分类 - 执行和创造用\-- Productions\SIS\Libraries\Dict\Libraries In Use\WordNetDictFiles\";    // Trailing '\' is necessary

            string[] TestWordTypes   = new string[] { "adj", "adv", "noun", "verb" };
            string   RawWordListFile = @"H:\Projects\按项目分类 - 执行和创造用\-- Productions\SIS\Libraries\Wikipedia and Wikidict\VocabularyList\UnProcessedWordsList.txt";

            // string WikiFiles = @"H:\Projects\按项目分类 - 执行和创造用\-- Productions\SIS\Libraries\Wikipedia and Wikidict\VocabularyList\WikiTitles.txt";
            // string WiktionaryFile = @"H:\Projects\按项目分类 - 执行和创造用\-- Productions\SIS\Libraries\Wikipedia and Wikidict\VocabularyList\WiktionaryTitles.txt";
            //string WiktionaryAbstractFile = "";
            //string WikipediaAbstractFile = "";

            // Load Phrases
            // Iterate through all vocabularies and populate phrases, mark its word type accordingly
            // <Improvement> Notice specifics about verbs are not decided yet
            // <Improvement> Notice specifics about words other than noun, verb, adj and adv are not decided yet (currently all disposed)

            /// Stage One: WN Vocabulary
            /// <Improvement> Currently this stage is takes most of loading speed, use a text/binary file instead
            // Set up library
            WNCommon.path = WordNetDictLocation;

            // For each word we test to see whether they are of proper type
            foreach (string word in File.ReadLines(RawWordListFile))
            {
                nItems++;

                // Extract information
                bool bUseSeperator = false;
                for (int i = 0; i < TestWordTypes.Length; i++)
                {
                    WordType  pos       = WordNetLibrary.WordType.of(TestWordTypes[i]);
                    SearchSet searchSet = WordNetLibrary.WordNetDatabase.FindPossibleDefinitions(word, pos);
                    if (searchSet.NonEmpty == true)
                    {
                        if (bUseSeperator)
                        {
                            OutputSeperator();
                        }
                        else
                        {
                            // Begin a new word only if we can find any definition
                            OutputNewWord(word);
                            // Mark using seperator next time
                            bUseSeperator = true;
                        }
                        OutputDefinition(TestWordTypes[i], "Empty");
                    }
                }
            }
        }
Exemplo n.º 7
0
        private bool TryGetId(string Id, out HubScriptItem Target)
        {
            Target = SearchSet.Cast <HubScriptItem>().FirstOrDefault(( HubScriptItem HSI ) => HSI.Id == Id);

            if (Target == null)
            {
                Logger.Log(ID, "Target is gone after Status Report returned", LogType.WARNING);
                return(false);
            }

            return(true);
        }
Exemplo n.º 8
0
        IEnumerable <Search> FindAllSearch(string word)
        {
            var       list   = new ArrayList();
            SearchSet bobj2  = null;
            bool      sucess = false;

            _wordNet.OverviewFor(word, "noun", ref sucess, ref bobj2, list);
            _wordNet.OverviewFor(word, "verb", ref sucess, ref bobj2, list);
            _wordNet.OverviewFor(word, "adj", ref sucess, ref bobj2, list);
            _wordNet.OverviewFor(word, "adv", ref sucess, ref bobj2, list);
            return(list.OfType <Wnlib.Search>());
        }
Exemplo n.º 9
0
//--------------------------------------------------------------------------------------------------
        public bool SearchConcentricCircles(
            Map map,
            int start,
            ClockDirection clockDirection,
            SearchDirection searchDirection,
            Tour tour
            )
        {
            int incr = (searchDirection == SearchDirection.Outwards ? 1 : -1);

            for (int i = start;; i += incr)
            {
                if (i < 0 || i > m_Radius)
                {
                    return(false);
                }

                SearchSet ss = m_SearchSets[i];

                SortedList <double, CircleEntry> entries = ss.Entries;

                if (entries == null)
                {
                    continue;
                }

                IList <CircleEntry> values;

                if (clockDirection == ClockDirection.Clockwise)
                {
                    List <CircleEntry> list = new List <CircleEntry>(entries.Values);
                    list.Reverse();
                    values = list;
                }
                else
                {
                    values = entries.Values;
                }

                foreach (CircleEntry entry in values)
                {
                    if (tour(map, entry.X, entry.Y))
                    {
                        return(true);
                    }
                }

                return(false);
            }
        }
Exemplo n.º 10
0
        private void testoverview(string pos)
        {
            SearchSet bobj = null;             // = new SearchSet();

            WordNetClasses.WN wnc = new WordNetClasses.WN(@"C:\Program Files\WordNet\3.0\dict\");
            bool      b           = false;// sets word found - true/false
            ArrayList list;

            System.IO.StreamReader indexFile = new System.IO.StreamReader(@"C:\Program Files\WordNet\3.0\dict\index." + pos);
            //StreamWriter foundNouns = new StreamWriter(@"C:\found " + pos + ".txt");
            StreamWriter lostNouns = new StreamWriter(@"C:\lost " + pos + ".txt");

            string currentLine = indexFile.ReadLine();
            string indexLine   = string.Empty;

            while (currentLine != null)
            {
                string currentWord = currentLine.Substring(0, currentLine.IndexOf(' '));

                // this transformation doesn't reflect the library's
                // true transformations - it transforms internally
                // in index lookup
                //currentWord = currentWord.Replace("-"," ").Replace("_"," ");
                //currentWord = currentWord.Replace("_"," ");

                if (currentWord.Length > 0)
                {
                    list = new ArrayList();
                    wnc.OverviewFor(currentWord, pos, ref b, ref bobj, list);

                    if (!b)
                    {
                        // set a breakpoint here to single-step and find
                        // out why a word isn't picked up from the index
                        wnc.OverviewFor(currentWord, pos, ref b, ref bobj, list);
                        lostNouns.WriteLine(currentWord);
                    }
                    else
                    {
                        //foundNouns.WriteLine(currentWord);
                    }
                }

                currentLine = indexFile.ReadLine();
            }

            //foundNouns.Close();
            lostNouns.Close();
            MessageBox.Show("done");
        }
Exemplo n.º 11
0
        public static ArrayList GetSenses(string pos, string noun)
        {
            string pos2 = null;

            switch (pos)
            {
            case "N":
                pos2 = "noun"; break;

            case "V":
                pos2 = "verb"; break;

            case "A":
                pos2 = "adj"; break;

            case "R":
                pos2 = "adv"; break;
            }
            bool      b    = false;
            SearchSet boj  = null;
            ArrayList list = new ArrayList();

            wnc.OverviewFor(noun, pos2, ref b, ref boj, list);
            ArrayList senses = new ArrayList();

            for (int i = 0; i < list.Count; i++)
            {
                Search vs  = (Search)list[i];
                int    cut = (int)Math.Ceiling(vs.senses.Count * percent / 100.0);
                if (cut < threshold)
                {
                    cut = threshold;
                }
                if (vs.taggedSenses > 0 && tagged_only)
                {
                    cut = vs.taggedSenses;
                }
                foreach (SynSet ss in vs.senses)
                {
                    if (--cut < 0)
                    {
                        break;
                    }
                    senses.Add((vs.word + '#' + pos + '#' + (ss.sense + 1).ToString()).ToLower());
                }
            }
            return(senses);
        }
Exemplo n.º 12
0
        public async void Search(string Query, IEnumerable <string> AccessTokens = null)
        {
            if (AccessTokens == null)
            {
                AccessTokens = new TokenManager().AuthList.Remap(x => ( string )x.Value);
            }

            Searching = true;
            SHSearchLoader SHLoader = new SHSearchLoader(Query, AccessTokens);

            SearchSet.Clear();
            SearchSet.ConnectLoader(SHLoader);
            await SearchSet.LoadMoreItemsAsync(0);

            Searching = false;
        }
        /// <summary>
        /// 重複チェック.
        /// </summary>
        /// <returns></returns>
        private bool CheckDuplicate(SearchSet searchSet)
        {
            // この検索セットの組み合わせをユニークに表すKEY文字列を取得.
            var key = searchSet.GetKey();

            if (this.DicDoneKey.ContainsKey(key))
            {
                // 重複あり.
                return(true);
            }

            // まだ検索していないパターンの場合は検索を継続.
            this.DicDoneKey.Add(key, searchSet);

            // 重複なし.
            return(false);
        }
Exemplo n.º 14
0
        public void OverviewFor(string t, string p, ref bool b, ref SearchSet obj, List <Search> list)
        {
            SearchSet ss = null;

            if (string.IsNullOrWhiteSpace(p))
            {
                OverviewFor(t, PartsOfSpeech.Adjective.ToString(), ref b, ref obj, list);
                OverviewFor(t, PartsOfSpeech.Adverb.ToString(), ref b, ref obj, list);
                OverviewFor(t, PartsOfSpeech.Noun.ToString(), ref b, ref obj, list);
                OverviewFor(t, PartsOfSpeech.Verb.ToString(), ref b, ref obj, list);

                ss = obj;
            }
            else
            {
                PartOfSpeech pos = PartOfSpeech.Of(p);

                if (!string.IsNullOrWhiteSpace(pos?.Key))
                {
                    ss = netData.Is_defined(t, pos);
                    Morph ms = new Morph(t, pos, netData);
                    hasmatch = AddSearchFor(t, pos, list);

                    //TODO: if this isn't reset then morphs aren't checked on subsequent searches - check for side effects of resetting this manually
                    if (!hasmatch)
                    {
                        string m;
                        // loop through morphs (if there are any)
                        while ((m = ms.Next()) != null)
                        {
                            if (m != t)
                            {
                                ss += netData.Is_defined(m, pos);
                                AddSearchFor(m, pos, list);
                            }
                        }
                    }
                }
            }

            b   = ss?.NonEmpty ?? false;
            obj = ss;
        }
        /// <summary>
        /// 検索処理(本体)
        /// </summary>
        /// <remarks>再帰処理を呼び出す準備を行う</remarks>
        /// <param name="resultData"></param>
        /// <returns></returns>
        private void SearchMain(ResultData resultData)
        {
            this.SetProgress(0);

            // 開始時点の空の検索セットを生成.
            var searchSet = new SearchSet();

            // 検索前に確定している前提条件を反映.
            // ・使用しない
            // ・固定装備
            foreach (var requirementData in this.Requirements.RequirementDataList)
            {
                var part     = requirementData.Part;
                var partData = searchSet.GetPart(part);
                switch (requirementData.TermsType)
                {
                // 使用しない.
                case TermsType.Unused:
                    partData.State = PartState.Unuse;
                    break;

                // 固定装備部位
                case TermsType.Fixed:
                    // 部位毎に固定データを生成してセットする.
                    partData.SetFixed(requirementData.FixedIndex);
                    break;
                }
            }

            // 初期検索状況リポートを生成.
            var searchReport = this.CreateSearchReport(searchSet);

            // 未確定部位リストを生成.
            var remainingPartList = this.GetUnsettledPartList(searchSet);

            if (remainingPartList.Any())
            {
                // 再帰検索処理に渡す.
                this.RecursionSearch(resultData, searchSet, searchReport, remainingPartList, false, 0, 1, 100);
            }

            this.SetProgress(100);
        }
        /// <summary>
        /// 指定部位よりもPart順で後位の未確定部位リストを取得.
        /// </summary>
        /// <returns></returns>
        private List <PartDataBase> GetUnsettledPartList(SearchSet searchSet, Part lastPart)
        {
            // 検索順序リスト.
            // この順序で再帰処理がまわる為、順序は意識する必要がある
            // ・装飾品は再帰処理に入る前のループで扱うため、処理不要
            // ・武器は未使用か固定の2択なので処理不要
            // ・護石は同じシリーズ護石で下位、上位がある為、再帰処理の中では最初に確定する.
            var searchList = new List <PartDataBase>
            {
                searchSet.Head,
                searchSet.Body,
                searchSet.Arm,
                searchSet.Waist,
                searchSet.Leg,
                searchSet.Amulet,
            };

            // 検索順序リストの順で、最終セットされた部位よりも後ろでかつ、未確定の部位のリストを生成する.
            // 組み合わせは総当りで検索するが、
            // 未確定部位リストの前方には戻らない(順序違いの同じ組み合わせが出てくるから)
            // lastPartには一つ上位のレイヤで確定した部位が入っている為、
            // 以降に検索すべきはlastPartより後方の未確定部位のみとなる。
            var hitLast           = Part.Non == lastPart;
            var unsettledPartList = new List <PartDataBase>();

            foreach (var part in searchList)
            {
                // フラグがONでかつ、未確定部位ならばリストに追加.
                if (hitLast && PartState.Unsettled == part.State)
                {
                    unsettledPartList.Add(part);
                }
                // 最終格納部位を見つけたらフラグON
                else if (part.Part == lastPart)
                {
                    hitLast = true;
                }
            }

            // 全部位のリストを返す.
            return(unsettledPartList);
        }
Exemplo n.º 17
0
        private void GenerateOctants()
        {
            for (int i = 0; i < N; i++)
            {
                m_Octants[i] = new SearchSet(i);
            }

            for (int y = -m_Radius; y < m_Radius + 1; y++)
            {
                for (int x = -m_Radius; x < m_Radius + 1; x++)
                {
                    OctantEntry entry = m_Matrix[y + m_Radius, x + m_Radius];

                    //if( entry.Distance != 0 )
                    //{
                    m_Octants[entry.Octant].AddEntry(entry);
                    m_nEntries++;
                    //}
                }
            }
        }
Exemplo n.º 18
0
        private void MessageBus_OnDelivery(Message Mesg)
        {
            switch (Mesg.Content)
            {
            case AppKeys.SP_PROCESS_COMP:

                LocalBook     SBook = ( LocalBook )Mesg.Payload;
                HubScriptItem HSC   = SearchSet.Cast <HubScriptItem>().FirstOrDefault(x => x.Id == SBook.ZItemId);

                if (HSC == null)
                {
                    Logger.Log(ID, "Book is not from Sharer's hub", LogType.DEBUG);
                }
                else
                {
                    HSC.InCollection = SBook.ProcessSuccess;
                }

                break;

            case AppKeys.HS_REPORT_SUCCESS:

                Tuple <string, DRequestCompletedEventArgs> Payload = (Tuple <string, DRequestCompletedEventArgs>)Mesg.Payload;
                SearchItemUpdate(Payload.Item2, Payload.Item1);

                break;

            case AppKeys.HS_REPORT_FAILED:

                Tuple <string, string> ErrorPayload = (Tuple <string, string>)Mesg.Payload;

                HubScriptItem HSI;
                if (TryGetId(ErrorPayload.Item1, out HSI))
                {
                    HSI.ErrorMessage = ErrorPayload.Item2;
                }

                break;
            }
        }
Exemplo n.º 19
0
//--------------------------------------------------------------------------------------------------
        public bool SearchCircle(
            Map map,
            int radius,
            ClockDirection clockDirection,
            Tour tour
            )
        {
            SearchSet ss = m_SearchSets[radius];

            SortedList <double, CircleEntry> entries = ss.Entries;

            if (entries == null)
            {
                return(false);
            }

            IList <CircleEntry> values;

            if (clockDirection == ClockDirection.Clockwise)
            {
                List <CircleEntry> list = new List <CircleEntry>(entries.Values);
                list.Reverse();
                values = list;
            }
            else
            {
                values = entries.Values;
            }

            foreach (CircleEntry entry in values)
            {
                if (tour(map, entry.X, entry.Y))
                {
                    return(true);
                }
            }

            return(false);
        }
Exemplo n.º 20
0
        public bool SearchOctant(
            Map map,
            Compass compass,
            int start,
            SearchDirection direction,
            Tour tour
            )
        {
            SearchSet oc   = m_Octants[(int)compass];
            int       incr = direction == SearchDirection.Outwards ? 1 : -1;

            for (int i = start;; i += incr)
            {
                if (i < 0 || i > m_Radius)
                {
                    return(false);
                }

                EntrySet entrySet = oc.GetEntrySet(i);

                if (entrySet == null)
                {
                    continue;
                }

                List <Entry> entries = entrySet.Entries;

                foreach (OctantEntry entry in entries)
                {
                    if (tour(map, entry.X, entry.Y))
                    {
                        return(true);
                    }
                }

                return(false);
            }
        }
Exemplo n.º 21
0
        public IHttpActionResult Search(SearchSet searchSet)
        {
            int itemsCount;

            var entities = _contactsService.GetContacts()
                           .OrderBy(x => x.Id)
                           .Filter(searchSet.Filter)
                           .GetCount(out itemsCount)
                           .Skip((searchSet.SelectedPage - 1) * PageSize)
                           .Take(PageSize);

            var vms = entities.ToBussinessObjects <ContactViewModel>();

            var response = new PaginationSet <ContactViewModel>()
            {
                CurrentPage  = searchSet.SelectedPage,
                Items        = vms,
                TotalItems   = itemsCount,
                ItemsPerPage = PageSize
            };

            return(Ok(response));
        }
        /// <summary>
        /// 未確定部位リストを取得.
        /// </summary>
        /// <returns></returns>
        private List <PartDataBase> GetUnsettledPartList(SearchSet searchSet)
        {
            // 検索順序リスト.
            // この順序で再帰処理がまわる為、順序は意識する必要がある
            // ・装飾品は再帰処理に入る前のループで扱うため、処理不要
            // ・武器は未使用か固定の2択なので処理不要
            // ・護石は同じシリーズ護石で下位、上位がある為、再帰処理の中では最後に確定する.
            var searchList = new List <PartDataBase>
            {
                searchSet.Accessory,
                searchSet.Head,
                searchSet.Body,
                searchSet.Arm,
                searchSet.Waist,
                searchSet.Leg,
                searchSet.Amulet,
            };

            // 未確定部位だけのリストにして返却.
            return(searchList
                   .Where(part => PartState.Unsettled == part.State)
                   .ToList());
        }
Exemplo n.º 23
0
//--------------------------------------------------------------------------------------------------
//  Create/sort search sets according to radii
//--------------------------------------------------------------------------------------------------
    private void GenerateSearchSets()
    {
        foreach( int[] point in m_SpiralPattern )
        {
            SpiralEntry entry       = new SpiralEntry( point[0], point[1] );
            int         range       = entry.Distance;

            SearchSet   searchSet;

            if( m_SearchSets[range] == null )
            {
                searchSet = new SearchSet( range );
                m_SearchSets[range] = searchSet;
            }
            else
            {
                searchSet = m_SearchSets[range];
            }

            searchSet.AddEntry( entry );
            m_nEntries++;
        }
    }
        /// <summary>
        /// 検索中の状態レポートを生成する.
        /// </summary>
        /// <param name="searchSet"></param>
        /// <returns></returns>
        private SearchReport CreateSearchReport(SearchSet searchSet)
        {
            var searchReport = new SearchReport();

            // スキルの評価.
            {
                // 要求されているシリーズスキルリスト.
                var needSeriesList = this.Requirements.RequirementSkillList.SeriesList;

                // 必要シリーズスキルを一つずつチェックする.
                foreach (var needSeries in needSeriesList)
                {
                    // 発動しているかどうかをチェック.
                    var count = searchSet.GetSeriesCount(needSeries.Index);
                    if (needSeries.Skill.Need <= count)
                    {
                        // 満たしているスキルに登録.
                        searchReport.SatisfyList.Add(needSeries.Index);
                    }
                    else
                    {
                        // 満たしていないスキルに登録.
                        searchReport.UnsatisfyList.Add(needSeries.Index);
                        searchReport.UnsatisfyBaseList.Add(new SkillBase(
                                                               needSeries.Index,
                                                               needSeries.Skill.Need - count));
                    }
                }

                // 要求されているスキルリスト.
                var needSkillList = this.Requirements.RequirementSkillList.SkillList;

                // 必要スキルを一つずつチェックする.
                foreach (var needSkill in needSkillList)
                {
                    // 検索セットが必要スキルLvを満たしている場合.
                    var sumLv = searchSet.GetSkillLvSum(needSkill.Index);
                    if (needSkill.Lv <= sumLv)
                    {
                        // 満たしているスキルに登録.
                        searchReport.SatisfyList.Add(needSkill.Index);
                    }
                    else
                    {
                        // 満たしていないスキルに登録.
                        searchReport.UnsatisfyList.Add(needSkill.Index);
                        searchReport.UnsatisfyBaseList.Add(new SkillBase(
                                                               needSkill.Index,
                                                               needSkill.Lv - sumLv));
                    }
                }
            }

            // スロットの評価.
            {
                // 現在のセットが装備している全てのスロットのLvリスト
                var equippedSlotLvList = searchSet.GetEquippedSlotLvList();

                // 必要スロットリスト
                var needBlankSlotList = this.CandidateSet.GetNeedBlankSlotLvList();
                var needSlotLvList    = searchSet.Accessory.GetNeedSlotLvListWithNeedBlank(needBlankSlotList);

                // 装備スロットを下位Lvから走査.
                // 必要スロットLvと装備スロットLvを低いほうから順番に比較して、
                // 必要スロットLv <= 装備スロットLvであれば格納可能と判定する.
                var needIndex = 0;
                foreach (var equippedLv in equippedSlotLvList)
                {
                    // 必要スロットがまだ残っていてかつ装備Lvが必要Lvを超えていれば装備可能.
                    if (needIndex < needSlotLvList.Count &&
                        needSlotLvList[needIndex] <= equippedLv)
                    {
                        // 装備可能なので必要Indexを進める.
                        needIndex++;
                    }
                }

                // 残っている必要スロットを不足リストに追加.
                for (; needIndex < needSlotLvList.Count; needIndex++)
                {
                    searchReport.LackSlotList.Add(needSlotLvList[needIndex]);
                }
            }

            // 生成したリポートを返す.
            return(searchReport);
        }
Exemplo n.º 25
0
        /// <summary>
        /// Create or modify a lexeme with no word form basis, gets tricky with best fit scenarios
        /// </summary>
        /// <param name="word">just the text of the word</param>
        /// <returns>A lexeme</returns>
        public static ILexeme CreateOrModifyLexeme(ILanguage language, string word, ref List <string> processedWords)
        {
            word = word.ToLower();

            Regex rgx = new Regex("[^a-z -]");

            word = rgx.Replace(word, "");

            if (string.IsNullOrWhiteSpace(word) || word.All(ch => ch == '-'))
            {
                return(null);
            }

            ILexeme newLex = ConfigDataCache.Get <ILexeme>(string.Format("{0}_{1}", language.Name, word));

            if (newLex == null)
            {
                newLex = language.CreateOrModifyLexeme(word, LexicalType.None, new string[0]);
            }

            if (newLex.IsSynMapped || processedWords.Any(wrd => wrd.Equals(word)))
            {
                if (!processedWords.Any(wrd => wrd.Equals(word)))
                {
                    processedWords.Add(word);
                }

                return(newLex);
            }

            processedWords.Add(word);

            bool          exists    = true;
            SearchSet     searchSet = null;
            List <Search> results   = new List <Search>();

            WordNet.OverviewFor(word, string.Empty, ref exists, ref searchSet, results);

            //We in theory have every single word form for this word now
            if (exists && results != null)
            {
                LexicalType[] invalidTypes = new LexicalType[] { LexicalType.Article, LexicalType.Conjunction, LexicalType.ProperNoun, LexicalType.Pronoun, LexicalType.None };

                foreach (SynonymSet synSet in results.SelectMany(result => result.senses))
                {
                    //grab semantics somehow
                    List <string> semantics  = new List <string>();
                    var           indexSplit = synSet.defn.IndexOf(';');
                    string        definition = synSet.defn.Substring(0, indexSplit < 0 ? synSet.defn.Length - 1 : indexSplit).Trim();
                    string[]      defWords   = definition.Split(' ');

                    foreach (string defWord in defWords)
                    {
                        var currentWord = defWord.ToLower();
                        currentWord = rgx.Replace(currentWord, "");

                        if (currentWord.Equals(word) || string.IsNullOrWhiteSpace(word) || word.All(ch => ch == '-') || word.IsNumeric())
                        {
                            continue;
                        }

                        var defLex = language.CreateOrModifyLexeme(currentWord, LexicalType.None, new string[0]);

                        if (defLex != null && !defLex.ContainedTypes().Any(typ => invalidTypes.Contains(typ)))
                        {
                            semantics.Add(currentWord);
                        }
                    }

                    var type = MapLexicalTypes(synSet.pos.Flag);
                    newLex = language.CreateOrModifyLexeme(word, type, semantics.ToArray());
                    var newDict = newLex.GetForm(type, semantics.ToArray(), false);

                    ///wsns indicates hypo/hypernymity so
                    int baseWeight = synSet.words[Math.Max(0, synSet.whichword - 1)].wnsns;
                    newDict.Severity = baseWeight;
                    newDict.Elegance = Math.Max(0, newDict.Name.SyllableCount() * 3);
                    newDict.Quality  = synSet.words.Count();

                    foreach (Lexeme synWord in synSet.words)
                    {
                        ///wsns indicates hypo/hypernymity so
                        int mySeverity = synWord.wnsns;
                        int myElegance = Math.Max(0, synWord.word.SyllableCount() * 3);
                        int myQuality  = synWord.semcor?.semcor ?? 0;

                        //Don't bother if this word is already the same word we started with
                        if (synWord.word.Equals(newDict.Name, StringComparison.InvariantCultureIgnoreCase))
                        {
                            continue;
                        }

                        //it's a phrase
                        if (synWord.word.Contains("_"))
                        {
                            string[] words = synWord.word.Split('_');

                            //foreach (string phraseWord in words)
                            //{
                            //    //make the phrase? maybe later
                            //}
                        }
                        else
                        {
                            var newWord = synWord.word.ToLower();
                            newWord = rgx.Replace(newWord, "");

                            if (newWord.Equals(word) || string.IsNullOrWhiteSpace(newWord) || newWord.All(ch => ch == '-') || newWord.IsNumeric())
                            {
                                continue;
                            }

                            newDict.MakeRelatedWord(language, synWord.word, true);
                        }
                    }
                }
            }

            newLex.IsSynMapped = true;
            newLex.SystemSave();
            newLex.PersistToCache();

            return(newLex);
        }
Exemplo n.º 26
0
 public IActionResult Results(SearchSet set)
 {
     return(View(set));
 }
Exemplo n.º 27
0
//--------------------------------------------------------------------------------------------------
//  Create/sort search sets according to radii
//--------------------------------------------------------------------------------------------------
    private void GenerateSearchSets()
    {
        for( int i=0; i<m_Radius+1; i++)
        {
            m_SearchSets[i]= new SearchSet( i );

            for( int y=-m_Radius; y<m_Radius+1; y++)
            {
                for( int x=-m_Radius; x<m_Radius+1; x++)
                {
                    CircleEntry entry = m_Matrices[i,y+m_Radius,x+m_Radius];

                    if( entry == null ) continue;
                    if( entry.Distance > m_Radius ) continue;

                    m_SearchSets[i].AddEntry( entry );

                    m_nEntries++;
                }
            }
        }
    }
Exemplo n.º 28
0
        public static ArrayList GetVerbSenses(string verb, int percent, int threshold)
        {
            WordNetClasses.WN wnc = new WordNetClasses.WN(Wnlib.WNCommon.path);
            bool      b           = false;
            SearchSet boj         = null;
            ArrayList list        = new ArrayList();

            wnc.OverviewFor(verb, "verb", ref b, ref boj, list);
            Search    vs     = (Search)list[0];
            ArrayList senses = new ArrayList();
            int       cut    = (int)Math.Ceiling(vs.senses.Count * percent / 100.0);

            if (cut < threshold)
            {
                cut = threshold;
            }
            foreach (SynSet ss in vs.senses)
            {
                /*
                 * if(--cut<0)
                 *      break;
                 */
                VerbSense vsense = new VerbSense();
                vsense.Sense   = verb + "#v#" + (ss.sense + 1).ToString();
                vsense.Structs = new ArrayList();
                foreach (SynSetFrame frame in ss.frames)
                {
                    SyntaxStruct st = new SyntaxStruct();
                    switch (frame.fr.str)
                    {
                    case "1":
                        st.Check = new SyntaxChecker(VerbSense.CheckForm1);
                        break;

                    case "2":
                        st.Check = new SyntaxChecker(VerbSense.CheckForm1);
                        break;

                    case "3":
                        st.Check = new SyntaxChecker(VerbSense.CheckForm1);
                        break;

                    case "4":
                        st.Check = new SyntaxChecker(VerbSense.CheckForm4);
                        break;

                    case "5":
                        st.Check = new SyntaxChecker(VerbSense.CheckForm5);
                        break;

                    case "6":
                        st.Check = new SyntaxChecker(VerbSense.CheckForm6);
                        break;

                    case "7":
                        st.Check = new SyntaxChecker(VerbSense.CheckForm7);
                        break;

                    case "8":
                        st.Check = new SyntaxChecker(VerbSense.CheckForm8);
                        break;

                    case "9":
                        st.Check = new SyntaxChecker(VerbSense.CheckForm8);
                        break;

                    case "10":
                        st.Check = new SyntaxChecker(VerbSense.CheckForm8);
                        break;

                    case "11":
                        st.Check = new SyntaxChecker(VerbSense.CheckForm8);
                        break;

                    case "12":
                        st.Check = new SyntaxChecker(VerbSense.CheckForm12);
                        st.Input = "TO";
                        break;

                    case "13":
                        st.Check = new SyntaxChecker(VerbSense.CheckForm12);
                        st.Input = "ON";
                        break;

                    case "14":
                        st.Check = new SyntaxChecker(CheckForm14);
                        break;

                    case "15":
                        st.Check = new SyntaxChecker(VerbSense.CheckForm15);
                        st.Input = "TO";
                        break;

                    case "16":
                        st.Check = new SyntaxChecker(VerbSense.CheckForm15);
                        st.Input = "FROM";
                        break;

                    case "17":
                        st.Check = new SyntaxChecker(VerbSense.CheckForm15);
                        st.Input = "WITH";
                        break;

                    case "18":
                        st.Check = new SyntaxChecker(VerbSense.CheckForm15);
                        st.Input = "OF";
                        break;

                    case "19":
                        st.Check = new SyntaxChecker(VerbSense.CheckForm15);
                        st.Input = "ON";
                        break;

                    case "20":
                        st.Check = new SyntaxChecker(VerbSense.CheckForm20);
                        break;

                    case "21":
                        st.Check = new SyntaxChecker(VerbSense.CheckForm20);
                        break;

                    case "22":
                        st.Check = new SyntaxChecker(VerbSense.CheckForm22);
                        break;

                    case "23":
                        st.Check = new SyntaxChecker(VerbSense.CheckForm1);
                        break;

                    case "24":
                        st.Check = new SyntaxChecker(VerbSense.CheckForm24);
                        break;

                    case "25":
                        st.Check = new SyntaxChecker(VerbSense.CheckForm25);
                        break;

                    case "26":
                        st.Check = new SyntaxChecker(VerbSense.CheckForm26);
                        break;

                    case "27":
                        st.Check = new SyntaxChecker(VerbSense.CheckForm12);
                        break;

                    case "28":
                        st.Check = new SyntaxChecker(VerbSense.CheckForm28);
                        break;

                    case "29":
                        st.Check = new SyntaxChecker(VerbSense.CheckForm29);
                        break;

                    case "30":
                        st.Check = new SyntaxChecker(VerbSense.CheckForm30);
                        break;

                    case "31":
                        st.Check = new SyntaxChecker(VerbSense.CheckForm15);
                        st.Input = "WITH";
                        break;

                    case "32":
                        st.Check = new SyntaxChecker(VerbSense.CheckForm32);
                        break;

                    case "33":
                        st.Check = new SyntaxChecker(VerbSense.CheckForm33);
                        break;

                    case "34":
                        st.Check = new SyntaxChecker(VerbSense.CheckForm26);
                        break;

                    case "35":
                        st.Check = new SyntaxChecker(VerbSense.CheckForm32);
                        break;
                    }
                    vsense.Structs.Add(st);
                }
                senses.Add(vsense);
            }
            return(senses);
        }
        /// <summary>
        /// 検索処理(本体)
        /// </summary>
        /// <remarks>装飾品の検索条件を設定して再起処理に渡す</remarks>
        /// <param name="resultData"></param>
        /// <returns></returns>
        private void SearchMain(ResultData resultData)
        {
            this.SetProgress(0);

            // 開始時点の空の検索セットを生成.
            var searchSet = new SearchSet();

            // 検索前に確定している前提条件を反映.
            foreach (var requirementData in this.Requirements.RequirementDataList)
            {
                var part     = requirementData.Part;
                var partData = searchSet.GetPart(part);
                switch (requirementData.TermsType)
                {
                // 使用しない.
                case TermsType.Unused:
                    partData.State = PartState.Unuse;
                    break;

                // 固定装備部位
                case TermsType.Fixed:
                    // 部位毎に固定データを生成してセットする.
                    partData.SetFixed(requirementData.FixedIndex);
                    break;
                }
            }

            // 検索状況リポートを生成..
            var searchReport = this.CreateSearchReport(searchSet);

            // 装飾品の組み合わせを取得.
            // 装飾品の組み合わせは、装飾品0個もひとつの組み合わせとみなす為、0件はありえない.
            // 「使用しない」設定であっても0個の組み合わせ1件を返すようになっている.
            var candidateAccessory = this.CandidateSet.GetCandidate(Part.Accessory, searchReport);

            // 装飾品の組み合わせ毎に走査.
            var allCount = candidateAccessory.GetCount();
            var unit     = 100 / allCount;

            for (var i = 0; i < allCount; i++)
            {
                var accessoryData = candidateAccessory.GetAt(i);

                // 無効装備は無視.
                if (null == accessoryData || !accessoryData.Enable)
                {
                    continue;
                }

                // 候補装備.
                var accessory = accessoryData.PartData;

                // 進捗の最小単位を計算.
                var begin = i * unit;
                var end   = (i + 1) * unit;

                // 新たな候補をセットして.
                searchSet.SetPart(Part.Accessory, accessory);

                // 再帰検索処理に渡す.
                var result = this.RecursionSearch(resultData, searchSet, Part.Non, 0, begin, end);

                // セットした候補を外す.
                searchSet.RemovePart(Part.Accessory);

                // 処理中断の場合.
                if (result < 0)
                {
                    break;
                }
            }

            this.SetProgress(100);
        }
Exemplo n.º 30
0
    private void GenerateOctants()
    {
        for( int i=0; i<N; i++)
            m_Octants[i]= new SearchSet( i );

        for( int y=-m_Radius; y<m_Radius+1; y++)
        {
            for( int x=-m_Radius; x<m_Radius+1; x++)
            {
                OctantEntry entry = m_Matrix[y+m_Radius,x+m_Radius];

                //if( entry.Distance != 0 ) 
                //{
                    m_Octants[entry.Octant].AddEntry( entry );
                    m_nEntries++;
                //}
            }
        }
    }
        /// <summary>
        /// 再帰検索処理.
        /// </summary>
        /// <param name="resultData">結果を格納</param>
        /// <param name="uppserSet">上位検索セット</param>
        /// <param name="remainingPartList">残未確定部位リスト</param>
        /// <param name="abstractArmorMode">仮想防具モードかどうか</param>
        /// <param name="upperReport">上位検索状況情報</param>
        /// <param name="nest">再帰階層</param>
        /// <param name="pBegin">この処理の開始時点の進捗</param>
        /// <param name="pEnd">この処理の終了時点の進捗</param>
        /// <returns>この処理で確定したセットの数(マイナスの場合は処理中断)</returns>
        private int RecursionSearch(ResultData resultData, SearchSet uppserSet, SearchReport upperReport, List <PartDataBase> remainingPartList, bool abstractArmorMode, int nest, int pBegin, int pEnd)
        {
            // 呼び出され回数をインクリメント
            this.TotalCalled++;

            // 階層をインクリメント.
            var curNest = nest + 1;

            // キャンセルされたか調べる
            if (this.IsCancel())
            {
                // キャンセルされたとき
                return(-1);
            }

            // ネストで見つかった確定セット数を格納する.
            var determined = 0;

            // この処理での進捗幅.
            var partUnit = pEnd - pBegin;

            // このネストで検索する部位.
            var part = remainingPartList.ElementAt(0);

            // 残りの部位.
            var unsettledPartList = remainingPartList.ToList();

            unsettledPartList.RemoveAt(0);

            // 候補装備リスト管理データを作成.
            var candidateListCtrl = abstractArmorMode
                ? this.CandidateSet.GetArmorAbstract(part.Part, upperReport)
                : this.CandidateSet.GetCandidate(part.Part, upperReport);

            // 候補装備数.
            var allCount = candidateListCtrl.GetCount();

            // 検索セットを複製.
            var searchSet = new SearchSet(uppserSet);

            // 装備毎に走査.
            // 進捗管理の為に i が必要.
            for (var i = 0; i < allCount; i++)
            {
                var candidateData = candidateListCtrl.GetAt(i);

                // 無効装備は無視.
                if (null == candidateData || !candidateData.Enable)
                {
                    continue;
                }

                // 候補装備.
                var candidate = candidateData.PartData;

                // 進捗の最小単位を計算.
                var begin = pBegin;
                var end   = pBegin;
                if (0 < partUnit)
                {
                    // 候補装備毎の進捗単位を計算.
                    // 要素数を取得.
                    var candidateUnit = partUnit / allCount;
                    if (0 < candidateUnit)
                    {
                        begin = pBegin + (i * candidateUnit);
                        end   = begin + candidateUnit;
                    }
                }

                // 新たな候補をセットして.
                searchSet.SetPart(part.Part, candidate);

                // 検索数上限に到達しているかどうかをチェック.
                if (0 < Ssm.Config.SerchLimitCount &&
                    Ssm.Config.SerchLimitCount <= resultData.GetSatisfiedCount())
                {
                    Log.Write("検索結果上限[{0}件]に到達したので処理中断".Fmt(Ssm.Config.SerchLimitCount));
                    break;
                }

                // 検索状況リポートを生成.
                var searchReport = this.CreateSearchReport(searchSet);

                // 現状のセットが検索条件を満たすかどうかチェック.
                // スキルが要求を満たしている場合.
                if (!searchReport.UnsatisfyList.Any())
                {
                    ////////////////
                    // スキル満足 //
                    ////////////////

                    // スロットが必要数を満たしている場合.
                    if (!searchReport.LackSlotList.Any())
                    {
                        //////////
                        // 完成 //
                        //////////
                        resultData.AddSatisfiedSet(new ResultSet(searchSet));
                        determined += 1;

                        // 上位互換装備を候補リストから除く.
                        candidateListCtrl.RemoveUpwardCompatibility(candidate, searchReport);
                        continue;
                    }

                    // スロットが不足している場合、下記条件のいずれかにヒットしたら検索終了
                    // ・未確定防具が残っていない場合.
                    // ・抽象化防具を使用しない場合.
                    var abstractPartList = searchSet.GetUnsettledArmorList();
                    if (!abstractPartList.Any() || !Ssm.Config.UseArmorAbstract)
                    {
                        //////////////////////////
                        // スロット不足 → 終了 //
                        //////////////////////////

                        // 解析を実施する場合は解析結果に追加.
                        if (this.AnalyzeFactors)
                        {
                            // スロット不足で不十分な組み合わせ.
                            resultData.AddShortageSlot(searchReport.GetLackSlotKey(), new ResultSet(searchSet));
                        }

                        // これ以上の検索は不要.
                        continue;
                    }

                    //////////////////////////////////////////
                    // スロット不足 → 抽象化防具検索モード //
                    //////////////////////////////////////////
                    // >>>>再帰呼び出し<<<< //
                    // 検索処理を再帰呼び出し.
                    var result = this.RecursionSearch(resultData, searchSet, searchReport, abstractPartList, true, curNest, begin, end);
                    // >>>>再帰呼び出し<<<<

                    // 条件を満たす組み合わせが見つかった場合.
                    if (0 < result)
                    {
                        // 結果に登録.
                        determined += result;
                    }
                    else if (result < 0)
                    {
                        // 処理中断の場合.
                        return(result);
                    }
                }
                else
                {
                    ////////////////
                    // スキル不足 //
                    ////////////////

                    // 残りの部位が残っていない場合はスキル不足で不十分な組み合わせ.
                    if (!unsettledPartList.Any())
                    {
                        // 下記の条件を全て満たしている場合は解析結果に登録.
                        // ・不足しているスキルが一つ
                        // ・スロットは満たしている
                        // ・解析を実施する場合.
                        if (this.AnalyzeFactors &&
                            !searchReport.LackSlotList.Any() &&
                            1 == searchReport.UnsatisfyList.Count)
                        {
                            // スキル不足で不十分な組み合わせ.
                            resultData.AddShortageSkill(searchReport.GetUnsatisfyKey(), new ResultSet(searchSet));
                        }

                        // これ以上の検索は不要.
                        continue;
                    }

                    //////////////////////////////////
                    // スキル不足 → 通常検索モード //
                    //////////////////////////////////
                    // >>>>再帰呼び出し<<<<
                    // 検索処理を再帰呼び出し.
                    var result = this.RecursionSearch(resultData, searchSet, searchReport, unsettledPartList, false, curNest, begin, end);
                    // >>>>再帰呼び出し<<<<

                    // 条件を満たす組み合わせが見つかった場合.
                    if (0 < result)
                    {
                        // 結果に登録.
                        determined += result;
                    }
                    else if (result < 0)
                    {
                        // 処理中断の場合.
                        return(result);
                    }
                }
            }

            // 進捗を更新.
            if (0 < partUnit)
            {
                this.SetProgress((int)pEnd);
            }

            return(determined);
        }
        /// <summary>
        /// 再帰検索処理.
        /// </summary>
        /// <param name="resultData">結果を格納</param>
        /// <param name="searchSet">現在までの検索状態</param>
        /// <param name="lastFixedPart">最終確定部位</param>
        /// <param name="nest">再帰階層</param>
        /// <param name="pBegin">この処理の開始時点の進捗</param>
        /// <param name="pEnd">この処理の終了時点の進捗</param>
        /// <returns>この処理で確定したセットの数(マイナスの場合は処理中断)</returns>
        private int RecursionSearch(ResultData resultData, SearchSet searchSet, Part lastFixedPart, int nest, int pBegin, int pEnd)
        {
            // 呼び出され回数をインクリメント
            this.TotalCalled++;

            // 階層をインクリメント.
            var curNest = nest + 1;

            // キャンセルされたか調べる
            if (this.IsCancel())
            {
                // キャンセルされたとき
                return(-1);
            }

            // この組み合わせで見つかった確定セット数.
            var determined = 0;

            // 進捗幅.
            var progressUnit = pEnd - pBegin;

            // 重複チェック.
            if (Ssm.Config.EnableDuplicateCheck && this.CheckDuplicate(searchSet))
            {
                // 既に検索済みのパターンの場合はこれ以上の検索不要.
                this.OverlapCount++;
                return(0);
            }

            // 検索数上限に到達しているかどうかをチェック.
            if (0 < Ssm.Config.SerchLimitCount && Ssm.Config.SerchLimitCount <= resultData.GetSatisfiedCount())
            {
                Log.Write("検索結果上限[{0}]件に到達したので中断".Fmt(Ssm.Config.SerchLimitCount));
                return(-1);
            }

            // 未確定部位リストを格納
            // ・通常再帰処理の場合は未確定部位・・防具か護石
            // ・スロットのみ不足している場合は抽象化防具を割り当て可能な未確定防具部位のリストを格納.
            var abstractArmorMode = false;
            List <PartDataBase> unsettledPartList;

            // 検索状況リポートを生成..
            var searchReport = this.CreateSearchReport(searchSet);

            // 現状のセットが検索条件を満たすかどうかチェック.
            // スキルが要求を満たしているかどうかチェック.
            if (!searchReport.UnsatisfyList.Any())
            {
                // スロットが必要数を満たしているかチェック.
                if (!searchReport.LackSlotList.Any())
                {
                    // スロットも満たしていれば完成.
                    resultData.AddSatisfiedSet(new ResultSet(searchSet));
                    return(1);
                }

                // スロットが不足している場合、下記条件のいずれかにヒットしたら検索終了
                // ・未確定防具が残っていない場合.
                // ・抽象化防具を使用しない場合.
                unsettledPartList = searchSet.GetUnsettledArmorList();
                if (!unsettledPartList.Any() || !Ssm.Config.UseArmorAbstract)
                {
                    // 解析を実施する場合.
                    if (this.AnalyzeFactors)
                    {
                        // スロット不足で不十分な組み合わせ.
                        resultData.AddShortageSlot(searchReport.GetLackSlotKey(), new ResultSet(searchSet));
                    }

                    // これ以上の検索は不要.
                    return(0);
                }

                // 未確定防具が残っている場合.
                // 抽象化防具検索モードへ移行.
                abstractArmorMode = true;
            }
            else
            {
                // スキルが不足している場合は未確定部位リストを取得.
                unsettledPartList = this.GetUnsettledPartList(searchSet, lastFixedPart);

                // 未確定防具が残っていない場合はスキル不足で不十分な組み合わせ.
                if (!unsettledPartList.Any())
                {
                    // 下記の条件を全て満たしている場合.
                    // ・不足しているスキルが一つ
                    // ・スロットは満たしている
                    // ・解析を実施する場合.
                    if (this.AnalyzeFactors &&
                        !searchReport.LackSlotList.Any() &&
                        1 == searchReport.UnsatisfyList.Count)
                    {
                        // スキル不足で不十分な組み合わせ.
                        resultData.AddShortageSkill(searchReport.GetUnsatisfyKey(), new ResultSet(searchSet));
                    }

                    // これ以上の検索は不要.
                    return(0);
                }
            }

            // 部位毎の進捗単位を計算.
            var partUnit = 0;

            if (0 < progressUnit && 0 < unsettledPartList.Count)
            {
                partUnit = progressUnit / unsettledPartList.Count;
            }

            // 未確定部位毎に走査.
            // 進捗計算のために i が必要
            for (var i = 0; i < unsettledPartList.Count; i++)
            {
                // 未確定部位.
                var unsettledPart = unsettledPartList[i];

                // 未確定部位の候補装備のリスト管理データを格納.
                var candidatePart = abstractArmorMode
                    ? this.CandidateSet.GetArmorAbstract(unsettledPart.Part, searchReport)
                    : this.CandidateSet.GetCandidate(unsettledPart.Part, searchReport);

                // 候補装備数.
                var allCount = candidatePart.GetCount();

                // 最後の未確定部位でかつ、候補装備が存在しない場合.
                if ((i + 1) == unsettledPartList.Count && 0 == allCount)
                {
                    // 進捗の最小単位を計算.
                    var begin = pBegin;
                    var end   = pBegin + (i * partUnit);

                    // 部位を取得.
                    var part = searchSet.GetPart(unsettledPart.Part);

                    // 候補なしにセット.
                    part.State = PartState.NotExist;

                    // >>>>再帰呼び出し<<<<
                    // 検索処理を再帰呼び出し.
                    var result = this.RecursionSearch(resultData, searchSet, unsettledPart.Part, curNest, begin, end);
                    // >>>>再帰呼び出し<<<<

                    // 未確定に戻して処理継続.
                    part.State = PartState.Unsettled;

                    // 条件を満たす組み合わせが見つかった場合.
                    if (0 < result)
                    {
                        // 結果に登録.
                        determined += result;
                    }
                    else if (result < 0)
                    {
                        // 処理中断の場合.
                        return(-1);
                    }

                    continue;
                }

                // 装備毎に走査.
                // 進捗管理の為に j が必要.
                for (var j = 0; j < allCount; j++)
                {
                    var candidateData = candidatePart.GetAt(j);

                    // 無効装備は無視.
                    if (null == candidateData || !candidateData.Enable)
                    {
                        continue;
                    }

                    // 候補装備.
                    var candidate = candidateData.PartData;

                    // 進捗の最小単位を計算.
                    var begin = pBegin;
                    var end   = pBegin;
                    if (0 < partUnit)
                    {
                        // 候補装備毎の進捗単位を計算.
                        // 要素数を取得.
                        var candidateUnit = partUnit / allCount;
                        if (0 < candidateUnit)
                        {
                            begin = pBegin + (i * partUnit) + (j * candidateUnit);
                            end   = begin + candidateUnit;
                        }
                    }

                    // 新たな候補をセットして.
                    searchSet.SetPart(unsettledPart.Part, candidate);

                    // >>>>再帰呼び出し<<<<
                    // 検索処理を再帰呼び出し.
                    var result = this.RecursionSearch(resultData, searchSet, unsettledPart.Part, curNest, begin, end);
                    // >>>>再帰呼び出し<<<<

                    // セットした候補を外す.
                    searchSet.RemovePart(unsettledPart.Part);

                    // 条件を満たす組み合わせが見つかった場合.
                    if (0 < result)
                    {
                        // 結果に登録.
                        determined += result;

                        // 上位互換装備を候補リストから除く.
                        candidatePart.RemoveUpwardCompatibility(candidate, searchReport);
                    }
                    else if (result < 0)
                    {
                        // 処理中断の場合.
                        return(-1);
                    }
                }
            }

            // 進捗を更新.
            if (1 <= (pEnd - pBegin))
            {
                this.SetProgress((int)pEnd);
            }

            return(determined);
        }