Remove() публичный Метод

public Remove ( ComponentName name ) : void
name ComponentName
Результат void
		public void RemoveUnbalancedRoot()
		{
			BinaryTreeComponentName tree = new BinaryTreeComponentName();
			DefaultHandler handler1 = new DefaultHandler(new ComponentModel("A", typeof(DefaultHandler), typeof(DefaultHandler)));
			tree.Add(new ComponentName("1000"), handler1);
			tree.Add(new ComponentName("7500"), handler1);
			tree.Add(new ComponentName("6000"), handler1);
			tree.Add(new ComponentName("2000"), handler1);

			tree.Remove(new ComponentName("1000"));
			assertRemoved(tree, 3, new ComponentName("1000"), new ComponentName("6000"));
		}
		public void RemoveBranchNode()
		{
			BinaryTreeComponentName tree = new BinaryTreeComponentName();
			DefaultHandler handler1 = new DefaultHandler(new ComponentModel("A", typeof(DefaultHandler), typeof(DefaultHandler)));

			tree.Add(new ComponentName("1000"), handler1);

			tree.Add(new ComponentName("0500"), handler1);
			tree.Add(new ComponentName("0700"), handler1);
			tree.Add(new ComponentName("0800"), handler1);

			tree.Add(new ComponentName("0400"), handler1);

			tree.Remove(new ComponentName("0500"));
			assertRemoved(tree, 4, new ComponentName("0500"), new ComponentName("0800"));
		}
		public void RemoveSibling()
		{
			BinaryTreeComponentName tree = new BinaryTreeComponentName();
			DefaultHandler handler1 = new DefaultHandler(new ComponentModel("A", typeof(DefaultHandler), typeof(DefaultHandler)));

			tree.Add(new ComponentName("1000"), handler1);
			tree.Add(new ComponentName("0500"), handler1);
			tree.Add(new ComponentName("0500:P=1"), handler1);
			tree.Add(new ComponentName("0500:p=2"), handler1);

			tree.Remove(new ComponentName("0500:p=2"));
			assertRemoved(tree, 3, new ComponentName("0500:P=2"), new ComponentName("0500:P=1"));
		}
		public void RemoveNodeWithSiblings()
		{
			BinaryTreeComponentName tree = new BinaryTreeComponentName();
			DefaultHandler handler1 = new DefaultHandler(new ComponentModel("A", typeof(DefaultHandler), typeof(DefaultHandler)));

			tree.Add(new ComponentName("1000"), handler1);
			tree.Add(new ComponentName("0500"), handler1);
			tree.Add(new ComponentName("0500:P=1"), handler1);
			tree.Add(new ComponentName("0500:p=2"), handler1);
			tree.Add(new ComponentName("0400"), handler1);

			tree.Remove(new ComponentName("0500"));
			Assert.AreEqual(4, tree.Count);
			Assert.AreEqual(4, tree.Handlers.Length);
			Assert.AreEqual(2, tree.GetHandlers(new ComponentName("0500")).Length);
			Assert.IsNotNull(tree.GetHandler(new ComponentName("0500:p=2")));
		}
Пример #5
0
 public override void UnRegister(String key)
 {
     tree.Remove(ToComponentName(key));
 }