⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 deletevisitor.cs

📁 英语句子自然语言处理统计分析例子 Statistical parsing of English sentences Shows how to generate parse trees for
💻 CS
字号:
using System;

namespace Netron.Lithium
{
	/// <summary>
	///	 Deletion of shapes is implemented via a visitor pattern to handle the fact
	///	 that child nodes have to be deleted before its parent 
	/// </summary>
	public class DeleteVisitor: IVisitor
	{

		#region Fields
		/// <summary>
		/// Occurs when a shape is deleted
		/// </summary>
		public event ShapeData OnDelete;

		/// <summary>
		/// the reference to the abstract
		/// </summary>
		GraphAbstract graphAbstract;

		#endregion

		#region Constructor
		/// <summary>
		/// Constructor
		/// </summary>
		/// <param name="graphAbstract">a GraphAbstract instance</param>
		public DeleteVisitor(GraphAbstract graphAbstract)
		{
			this.graphAbstract = graphAbstract;
		}
		
		#endregion

		/// <summary>
		/// Visits the shape
		/// </summary>
		/// <param name="sh"></param>
		public void Visit(ShapeBase sh)
		{
			//remove from the shape from the Shapes
			if(sh==null) return;
			//strictly speaking we should remove the shape from its parent's childNodes collection first
			graphAbstract.Connections.Remove(sh.connection);
			graphAbstract.Shapes.Remove(sh);
			if(OnDelete!=null)
				OnDelete(sh);
		}

		/// <summary>
		/// Gets whether the visiting is done
		/// </summary>
		public bool IsDone
		{
			get
			{
				// TODO:  Add DeleteVisitor.IsDone getter implementation
				return false;
			}
		}


	}
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -