public static Intent CreateIntent(Context context, ISearchGroup searchGroup)
        {
            Intent intent = new Intent(context, typeof(SearchedSessionsActivity));

            intent.PutExtra(typeof(ISearchGroup).Name, Parcels.Wrap(searchGroup));
            return(intent);
        }
 public static SearchedSessionsFragment NewInstance(ISearchGroup searchGroup)
 {
     var fragment = new SearchedSessionsFragment();
     var bundle = new Bundle();
     bundle.PutParcelable(typeof(ISearchGroup).Name, Parcels.Wrap(searchGroup));
     fragment.Arguments = bundle;
     return fragment;
 }
Example #3
0
        public static SearchedSessionsFragment NewInstance(ISearchGroup searchGroup)
        {
            var fragment = new SearchedSessionsFragment();
            var bundle   = new Bundle();

            bundle.PutParcelable(typeof(ISearchGroup).Name, Parcels.Wrap(searchGroup));
            fragment.Arguments = bundle;
            return(fragment);
        }
Example #4
0
            public ISearchGroup <T> Next()
            {
                //if (Debugging.AssertsEnabled) Debugging.Assert(iter.hasNext()); // No reasonable way to do this in .NET
                ISearchGroup <T> group = iter.Current;

                if (group.SortValues == null)
                {
                    throw new ArgumentException("group.sortValues is null; you must pass fillFields=true to the first pass collector");
                }
                return(group);
            }
        private void InitToolbar(ISearchGroup searchGroup)
        {
            SetSupportActionBar(binding.toolbar);

            var bar = SupportActionBar;

            if (bar != null)
            {
                bar.SetDisplayHomeAsUpEnabled(true);
                bar.SetDisplayShowHomeEnabled(true);
                bar.SetDisplayShowTitleEnabled(false);
                bar.SetHomeButtonEnabled(true);
            }

            binding.toolbar.Title = searchGroup.Name;
        }
Example #6
0
            private void UpdateNextGroup(int topN, ShardIter <T> shard)
            {
                while (shard.Iter.MoveNext())
                {
                    ISearchGroup <T> group = shard.Next();
                    bool             isNew = !groupsSeen.TryGetValue(group.GroupValue, out MergedGroup <T> mergedGroup) || mergedGroup == null;
                    //System.out.println("    next group=" + (group.groupValue == null ? "null" : ((BytesRef) group.groupValue).utf8ToString()) + " sort=" + Arrays.toString(group.sortValues));

                    if (isNew)
                    {
                        // Start a new group:
                        //System.out.println("      new");
                        mergedGroup = new MergedGroup <T>(group.GroupValue);
                        mergedGroup.MinShardIndex = shard.ShardIndex;
                        if (Debugging.AssertsEnabled)
                        {
                            Debugging.Assert(group.SortValues != null);
                        }
                        mergedGroup.TopValues        = group.SortValues;
                        groupsSeen[group.GroupValue] = mergedGroup;
                        mergedGroup.IsInQueue        = true;
                        queue.Add(mergedGroup);
                    }
                    else if (mergedGroup.IsProcessed)
                    {
                        // This shard produced a group that we already
                        // processed; move on to next group...
                        continue;
                    }
                    else
                    {
                        //System.out.println("      old");
                        bool competes = false;
                        for (int compIDX = 0; compIDX < groupComp.Comparers.Length; compIDX++)
                        {
                            int cmp = groupComp.Reversed[compIDX] * groupComp.Comparers[compIDX].CompareValues(group.SortValues[compIDX],
                                                                                                               mergedGroup.TopValues[compIDX]);
                            if (cmp < 0)
                            {
                                // Definitely competes
                                competes = true;
                                break;
                            }
                            else if (cmp > 0)
                            {
                                // Definitely does not compete
                                break;
                            }
                            else if (compIDX == groupComp.Comparers.Length - 1)
                            {
                                if (shard.ShardIndex < mergedGroup.MinShardIndex)
                                {
                                    competes = true;
                                }
                            }
                        }

                        //System.out.println("      competes=" + competes);

                        if (competes)
                        {
                            // Group's sort changed -- remove & re-insert
                            if (mergedGroup.IsInQueue)
                            {
                                queue.Remove(mergedGroup);
                            }
                            mergedGroup.TopValues     = group.SortValues;
                            mergedGroup.MinShardIndex = shard.ShardIndex;
                            queue.Add(mergedGroup);
                            mergedGroup.IsInQueue = true;
                        }
                    }

                    mergedGroup.Shards.Add(shard);
                    break;
                }

                // Prune un-competitive groups:
                while (queue.Count > topN)
                {
                    MergedGroup <T> group = queue.Max;
                    queue.Remove(group);
                    //System.out.println("PRUNE: " + group);
                    group.IsInQueue = false;
                }
            }
 public override void OnCreate(Bundle savedInstanceState)
 {
     base.OnCreate(savedInstanceState);
     searchGroup = Parcels.Unwrap<ISearchGroup>(Arguments.GetParcelable(typeof(ISearchGroup).Name) as IParcelable);
 }
Example #8
0
 public override void OnCreate(Bundle savedInstanceState)
 {
     base.OnCreate(savedInstanceState);
     searchGroup = Parcels.Unwrap <ISearchGroup>(Arguments.GetParcelable(typeof(ISearchGroup).Name) as IParcelable);
 }
 public static Intent CreateIntent(Context context, ISearchGroup searchGroup)
 {
     Intent intent = new Intent(context,  typeof(SearchedSessionsActivity));
     intent.PutExtra(typeof(ISearchGroup).Name, Parcels.Wrap(searchGroup));
     return intent;
 }
        private void InitToolbar(ISearchGroup searchGroup)
        {
            SetSupportActionBar(binding.toolbar);

            var bar = SupportActionBar;
            if (bar != null)
            {
                bar.SetDisplayHomeAsUpEnabled(true);
                bar.SetDisplayShowHomeEnabled(true);
                bar.SetDisplayShowTitleEnabled(false);
                bar.SetHomeButtonEnabled(true);
            }

            binding.toolbar.Title =searchGroup.Name;
        }