コード例 #1
0
ファイル: UsersNTerms.cs プロジェクト: wmioduszewski/Yandex
 public override void onQueryAction(QueryAction queryAction)
 {
     for (int i = queryAction.nTerms - 1; i >= 0; i--)
     {
         currentList.Add(queryAction.terms[i]);
     }
 }
コード例 #2
0
        public static User GetCentroid(List <User> users)
        {
            var allTerms = new BinarySearchSet <int>(Comparer <int> .Default);

            foreach (var user in users)
            {
                foreach (var term in user.terms)
                {
                    allTerms.Add(term);
                }
            }

            return(new User()
            {
                userId = -1, terms = allTerms
            });
        }
コード例 #3
0
        public override void onQueryAction(QueryAction queryAction)
        {
            for (int i = queryAction.nUrls - 1; i >= 0; i--)
            {
                if (!currentDomains.Add(queryAction.domains[i]))
                {
                    continue;
                }

                if (!domainsTerms.ContainsKey(queryAction.domains[i]))
                {
                    domainsTerms.Add(queryAction.domains[i], new BinarySearchSet <int>(Comparer <int> .Default));
                }

                BinarySearchSet <int> domainSet = domainsTerms[queryAction.domains[i]];

                for (int term = queryAction.nTerms - 1; term >= 0; term--)
                {
                    domainSet.Add(queryAction.terms[term]);
                }
            }

            currentDomains.Clear();
        }