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

📄 struct.cs

📁 使用C#写的数据结构库(从链表到图)
💻 CS
字号:
using System;

namespace DataTypeDemo
{
	/// <summary>
	/// stuct 的摘要说明。
	/// </summary>
	public class Struct : linkList
	{
		private node top;
		//private int length;
		private node botton;
		//private linkList link;
		/*public int Length
		{
			get{return this.length;}
			set{this.length = value;}
		}*/

		public Struct()
		{
			//
			// TODO: 在此处添加构造函数逻辑
			//
			top = null;
			botton = null;
			//base.length = 0;
			//link = null;
		}
		
		/**
		*isEmpty
		* checked The stuct was empty
		* <PARAM> 
		* <RETURN> -
		* <NOTES> 
		* <HISTORY> 2004/6/21 by LiJun
		*/
		public bool isEmpty()
		{
			bool isempty;
			if(this.top == this.botton)
			{
				isempty = true;
			}
			else
			{
				isempty = false;
			}
			return isempty;
		}
		
		/**
		*CreateStruct
		* Create empty struct
		* <PARAM> 
		* <RETURN> -
		* <NOTES> 
		* <HISTORY> 2004/6/21 by LiJun
		*/
		public void CreateStruct()
		{
			//link = new linkList();
			base.CreateLinkList();
			this.botton = base.head;
			//this.top = this.botton;
		}

		
		/**
		*CreateStruct
		* object[] data
		* <PARAM> 
		* <RETURN> -
		* <NOTES> 
		* <HISTORY> 2004/6/21 by LiJun
		*/
		public void CreateStruct(object[] data)
		{
			this.CreateStruct();
			base.CreateLinkList(data);
			this.botton = base.head;
			this.top = base.treil.Up;
			//System.Windows.Forms.MessageBox.Show(this.length.ToString());
			//System.Windows.Forms.MessageBox.Show(link.Treil.Up.Up.Data.ToString());
		}

		
		/**
		*Push
		* 
		* <PARAM> object data
		* <RETURN> -
		* <NOTES> 
		* <HISTORY> 2004/6/21 by LiJun
		*/
		public void Push(object data)
		{
			if(this.isEmpty() != true)
			{
				base.AddNode(data);
				this.top = base.treil.Up;
			}
			//System.Windows.Forms.MessageBox.Show(this.length.ToString());
		}

		
		/**
		*Pop
		* 
		* <PARAM> 
		* <RETURN> -
		* <NOTES> 
		* <HISTORY> 2004/6/21 by LiJun
		*/
		public object Pop()
		{
			object d = null;
			if(this.isEmpty() != true)
			{	
				this.top = base.treil.Up;			
				d = this.top.Data;
				base.DeleteNode();
				//this.top = base.treil.Up;
			}
			//System.Windows.Forms.MessageBox.Show(this.top.Up.Data.ToString());
			return d;
		}
		
		/**
		*SetEmpty
		* 
		* <PARAM> 
		* <RETURN> -
		* <NOTES> 
		* <HISTORY> 2004/6/21 by LiJun
		*/
		public override void SetEmpty()
		{
			if(this.isEmpty() != true)
			{
				base.SetEmpty();
				this.CreateStruct();
			}
		}

	}
}

⌨️ 快捷键说明

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