static void Main() { ListSort ls = new ListSort(); Console.WriteLine("---- Descending Sort ----"); ls.sortDescending(); Console.WriteLine(""); Console.WriteLine("---- Ascending Sort ----"); ls.sortAscending(); }
/// <summary> /// List sorting functionality /// </summary> /// <param name="thisEntry">the entry you want to sort</param> /// <param name="sort">the sorting type</param> private void ReorderListEntry(SceneConfig thisEntry, ListSort sort) { if (thisEntry == null) { return; } // get our current index var index = GetConfigIndex(thisEntry); // remove the old entry sceneConfig.config.RemoveAt(index); switch (sort) { case ListSort.MovetoTop: { // insert at the top sceneConfig.config.Insert(0, thisEntry); break; } case ListSort.MoveToBottom: { // add it to the end sceneConfig.config.Add(thisEntry); break; } case ListSort.MoveUp: { var newIndex = (index - 1); sceneConfig.config.Insert(newIndex, thisEntry); break; } case ListSort.MoveDown: { var newIndex = (index + 1); sceneConfig.config.Insert(newIndex, thisEntry); break; } } }
public void Run() { Dictionary <string, string> cfg = new Dictionary <string, string>() { { "AUTO_CONFIG", "true" }, { "MODEL", "true" } }; using (Context ctx = new Context(cfg)) { ListSort IntList = ctx.MkListSort("List_of_Int", ctx.IntSort); ListSort RealList = ctx.MkListSort("List_of_Real", ctx.RealSort); ListSort IntListList = ctx.MkListSort("List_of_IntList", IntList); Expr l1 = IntList.ConsDecl[ctx.MkInt(10), IntList.Nil]; Console.WriteLine(l1); Console.WriteLine(IntListList.ConsDecl[l1, IntListList.ConsDecl[l1, IntListList.Nil]]); Console.WriteLine(RealList.ConsDecl[ctx.MkReal("1/3"), RealList.Nil]); Console.WriteLine(l1.Sort); } }
public void Run() { Dictionary <string, string> cfg = new Dictionary <string, string>() { { "AUTO_CONFIG", "true" }, { "MODEL", "true" } }; using (Context ctx = new Context(cfg)) { ListSort L = ctx.MkListSort("List", ctx.IntSort); FuncDecl cons = L.ConsDecl; FuncDecl car = L.HeadDecl; FuncDecl cdr = L.TailDecl; Expr nil = L.Nil; Expr l1 = cons[ctx.MkInt(10), cons[ctx.MkInt(20), nil]]; Console.WriteLine(l1); Console.WriteLine(cdr[l1].Simplify()); Console.WriteLine(car[l1].Simplify()); Console.WriteLine(ctx.MkEq(l1, nil).Simplify()); } }
public ActionResult Index(StudentListModel model, string sortCol, bool?sortDesc, int?page) { model.Name = string.IsNullOrWhiteSpace(model.Name) ? "" : model.Name; model.ClassId = string.IsNullOrWhiteSpace(model.ClassId) ? "" : model.ClassId; var list = StudentBiz.QueryData(model.ClassId, model.Name); if (!string.IsNullOrWhiteSpace(sortCol)) { ListSort <StudentInfo> .GetList(list, sortCol, sortDesc.Value); } int currentPageIndex = page.HasValue ? page.Value - 1 : 0; int pageSize = 2; while (currentPageIndex > 0 && list.Count <= currentPageIndex * pageSize) { currentPageIndex--; } model.List = new MvcPaging.PagedList <StudentInfo>(list, currentPageIndex, pageSize); return(PartialView("List", model.List)); }
public static void SetSortDirection(DependencyObject obj, ListSort value) { obj.SetValue(SortDirectionProperty, value); }
public new void Sort(int index, int count, IComparer <T> comparer) { base.Sort(index, count, comparer); ListSort?.Invoke(); }
public new void Sort(IComparer <T> comparer) { base.Sort(comparer); ListSort?.Invoke(); }
public new void Sort(Comparison <T> comparison) { base.Sort(comparison); ListSort?.Invoke(); }
public new void Sort() { base.Sort(); ListSort?.Invoke(); }