Exemplo n.º 1
0
        protected override void IndexEntries(MutableObject mutable)
        {
            var sortList = new List <List <MutableObject> >();

            foreach (var entry in Scope.GetEntries(mutable))
            {
                sortList.Add(entry.ToList());
            }

            sortList.Sort(
                (mut1, mut2) =>
            {
                var sortMult   = SortDescending.GetFirstValue(mutable) ? -1 : 1;
                var sortResult = SortDiscriminant.GetValue(mut1).CompareTo(SortDiscriminant.GetValue(mut2));
                if (sortResult == 0)
                {
                    sortResult =
                        SecondarySortDiscriminant.GetValue(mut1)
                        .CompareTo(SecondarySortDiscriminant.GetValue(mut2));
                }
                return(sortResult * sortMult);
            });

            int i = 0;

            foreach (var element in sortList)
            {
                SortIndexTarget.SetValue(i++, element);
            }
        }
Exemplo n.º 2
0
        protected override List <MutableObject> SortEntries(List <MutableObject> mutableEntryList, List <MutableObject> sortableList)
        {
            var sortedList = sortableList.ToList();

            sortedList.Sort(
                (mut1, mut2) =>
            {
                var sortMult   = SortDescending.GetValue(mutableEntryList) ? -1 : 1;
                var sortResult = SortDiscriminant.GetLastKeyValue(mut1).CompareTo(SortDiscriminant.GetLastKeyValue(mut2));
                if (sortResult == 0)
                {
                    sortResult =
                        SecondarySortDiscriminant.GetLastKeyValue(mut1)
                        .CompareTo(SecondarySortDiscriminant.GetLastKeyValue(mut2));
                }
                return(sortResult * sortMult);
            });

            return(sortedList);
        }