public JsonResult GetDirectChildren(int nodeId) { TreeHandler handler = new TreeHandler(); IEnumerable <EnrolmentUnit> children = handler.GetDirectChildren(nodeId); return(Json(children.Select(unitSelector), JsonRequestBehavior.AllowGet)); }
private void btnSearch_Click(object sender, System.EventArgs e) { if (!"".Equals(txtNumber.Text)) { TreeHandler.getInstance().insert(txtNumber.Text); } }
private void Form1_Load(object sender, System.EventArgs e) { TreeHandler th = TreeHandler.getInstance(); // // th.addTree(StructureType.AVL,1); th.addTree(StructureType.B, 1); // th.addTree(StructureType.BINARY,1); }
public async Task User_Without_Access_To_Tree_Section_Is_Not_Authorized() { AuthorizationHandlerContext authHandlerContext = CreateAuthorizationHandlerContext(); TreeHandler sut = CreateHandler(userIsAuthorized: true); await sut.HandleAsync(authHandlerContext); Assert.IsFalse(authHandlerContext.HasSucceeded); }
public async Task Unauthorized_User_Is_Not_Authorized() { AuthorizationHandlerContext authHandlerContext = CreateAuthorizationHandlerContext(); TreeHandler sut = CreateHandler(); await sut.HandleAsync(authHandlerContext); Assert.IsFalse(authHandlerContext.HasSucceeded); }
private void ckbSplay_CheckedChanged(object sender, System.EventArgs e) { if (ckbSplay.Checked) { AbstractBinaryTree binaryTree = (AbstractBinaryTree)TreeHandler.getInstance().addTree(StructureType.SPLAY, 1); BinaryView splayView = new BinaryView(binaryTree); splayView.MdiParent = this; views.Add(splayView); insert(); splayView.Show(); } }
public JsonResult TakeSelectedNodes(int[] selectedIds) { if (selectedIds == null || selectedIds.Length == 0) { selectedUnits = null; return(Json(Enumerable.Empty <EnrolmentUnit>(), JsonRequestBehavior.AllowGet)); } IEnumerable <EnrolmentUnit> selected = new List <EnrolmentUnit>(); TreeHandler handler = new TreeHandler(); foreach (var id in selectedIds) { selected = selected.Concat(handler.GetGrandestChildren(id)); } selectedUnits = selected; return(Json("ok", JsonRequestBehavior.AllowGet)); }
private void insert() { TreeHandler th = TreeHandler.getInstance(); th.insert("60"); th.insert("50"); th.insert("30"); th.insert("40"); th.insert("55"); th.insert("58"); th.insert("80"); th.insert("75"); th.insert("45"); th.insert("10"); th.insert("05"); th.insert("57"); th.insert("42"); }
public void CreateLists() { //Create the data source IList <SourceRow> jpSource = new List <SourceRow>(); jpSource.Add(new SourceRow("1", 1, new DateTime(2000, 1, 1), new DateTime(2009, 12, 31))); jpSource.Add(new SourceRow("2A", 2, new DateTime(2000, 1, 1), new DateTime(2004, 12, 31))); jpSource.Add(new SourceRow("2B", 2, new DateTime(2005, 1, 1), new DateTime(2009, 12, 31))); jpSource.Add(new SourceRow("3", 3, new DateTime(2000, 1, 1), new DateTime(2009, 12, 31))); jpSource.Add(new SourceRow("4A", 4, new DateTime(2000, 1, 1), new DateTime(2008, 12, 31))); jpSource.Add(new SourceRow("4B", 4, new DateTime(2009, 1, 1), new DateTime(2009, 12, 31))); //Instantiate handler TreeHandler handler = new TreeHandler(CreatePathFromButtonNode); //Handle root node, and recurse handler.HandleNode(jpSource, 0, null, Period.Infinite); //DISPLAY TREE PATHS IN CONSOLE DisplayResultInConsole(); //A simple assertion. Expect that 3 paths were created. Assert.That(_pathList.Count, Is.EqualTo(3)); }
private void btnInsert_Click(object sender, System.EventArgs e) { TreeHandler.getInstance().insert(txtNumber.Text); foreach (IView view in views) { view.draw(); } // tree2.insertKey(new Key(textBox1.Text)); // // Graphics graph = panel1.CreateGraphics(); // graph.DrawLine(new Pen(Color.DarkBlue),panel1.Bounds.Width/2,0,panel1.Bounds.Width/2,30); // // graph.FillRectangle(new Pen(Color.DarkBlue).Brush,panel1.Bounds.Width/2-9*s.Length/2,30,9*s.Length,13); // graph.DrawRectangle(new Pen(Color.White),0,0,9*s.Length,13); // //Image(Image.FromFile(Application.StartupPath + "\\img\\img-1.bmp"), 0, 0); // graph.DrawString(s.ToUpper(),new Font("Verdana", 8,FontStyle.Bold), new Pen(Color.White).Brush,0,0); // // graph.FillRectangle(new Pen(Color.DarkBlue).Brush,0,39,9*s.Length,13); // graph.DrawRectangle(new Pen(Color.White),0,39,9*s.Length,13); // //Image(Image.FromFile(Application.StartupPath + "\\img\\img-1.bmp"), 0, 0); // graph.DrawString(s.ToUpper(),new Font("Verdana", 8,FontStyle.Bold), new Pen(Color.White).Brush,0,39); }
public override void Entry(IModHelper helper) { this.helper = helper; Logger.monitor = Monitor; Loader.loader = helper.Content; Reflector.reflector = helper.Reflection; ParticleHandler.init(); LevelHandler.initialize(); TreeHandler.init(); ForegroundHandler.init(); Perspective.PerspectiveRenderer.init(); Contact.PainTileHandler.init(); Contact.TileContactMorphHandler.init(); Critters.CritterSpawnData.init(); HarmonyInstance harmony = HarmonyInstance.Create("mabelsyrup.farmhouse"); harmony.Patch( original: AccessTools.Method(typeof(Background), nameof(Background.draw)), prefix: new HarmonyMethod(AccessTools.Method(typeof(Background_draw_Patch), nameof(Background_draw_Patch.Prefix))) ); harmony.Patch( original: AccessTools.Method(typeof(Background), nameof(Background.update)), prefix: new HarmonyMethod(AccessTools.Method(typeof(Background_update_Patch), nameof(Background_update_Patch.Prefix))) ); harmony.Patch( original: AccessTools.Method(typeof(Farmer), nameof(Farmer.MovePosition)), prefix: new HarmonyMethod(AccessTools.Method(typeof(Farmer_MovePosition_Patch), nameof(Farmer_MovePosition_Patch.Prefix))) ); harmony.Patch( original: AccessTools.Method(typeof(Tree), nameof(Tree.draw)), prefix: new HarmonyMethod(AccessTools.Method(typeof(Tree_draw_Patch), nameof(Tree_draw_Patch.Prefix))) ); harmony.Patch( original: AccessTools.Method(typeof(GameLocation), nameof(GameLocation.isCollidingPosition), new Type[] { typeof(Microsoft.Xna.Framework.Rectangle), typeof(xTile.Dimensions.Rectangle), typeof(bool), typeof(int), typeof(bool), typeof(Character) }), prefix: new HarmonyMethod(AccessTools.Method(typeof(GameLocation_isCollidingPosition_Patch), nameof(GameLocation_isCollidingPosition_Patch.Prefix))) ); harmony.Patch( original: AccessTools.Method(typeof(Farmer), nameof(Farmer.Update)), postfix: new HarmonyMethod(AccessTools.Method(typeof(Farmer_Update_Patch), nameof(Farmer_Update_Patch.Postfix))) ); harmony.Patch( original: AccessTools.Method(typeof(GameLocation), nameof(GameLocation.draw)), prefix: new HarmonyMethod(AccessTools.Method(typeof(GameLocation_draw_Patch), nameof(GameLocation_draw_Patch.Prefix))) ); helper.Events.GameLoop.DayStarted += newDay; helper.Events.Display.RenderedWorld += drawExtraLayers; helper.Events.GameLoop.TimeChanged += performTenMinuteUpdate; helper.Events.Player.Warped += performLocationSetup; helper.Events.GameLoop.UpdateTicked += performTickUpdate; helper.Events.GameLoop.GameLaunched += GameLoop_GameLaunched; helper.Events.GameLoop.SaveLoaded += GameLoop_SaveLoaded; }
private void btnDelete_Click(object sender, System.EventArgs e) { TreeHandler.getInstance().delete(txtNumber.Text); }