?? queue.cs
字號(hào):
using System;
namespace DataTypeDemo
{
/// <summary>
/// Queue 的摘要說(shuō)明。
/// </summary>
public class Queue : linkList
{
private node qhead;
private node rear;
public Queue()
{
//
// TODO: 在此處添加構(gòu)造函數(shù)邏輯
//
this.qhead = null;
this.rear = null;
}
/**
*CreateQueue
*
* <PARAM>
* <RETURN> -
* <NOTES>
* <HISTORY> 2004/6/21 by LiJun
*/
public void CreateQueue()
{
base.CreateLinkList();
this.rear = base.treil;
this.qhead = base.head;
}
/**
*CreateQueue
*
* <PARAM> object[] data
* <RETURN> -
* <NOTES>
* <HISTORY> 2004/6/21 by LiJun
*/
public void CreateQueue(object[] data)
{
this.CreateQueue();
base.CreateLinkList(data);
this.rear = base.treil.Up;
this.qhead = base.head.Next;
}
/**
*JoinQueue
*
* <PARAM> object data
* <RETURN> -
* <NOTES>
* <HISTORY> 2004/6/21 by LiJun
*/
public void JoinQueue(object data)
{
base.AddNode(data);
this.rear = base.treil.Up;
}
/**
*OutQueue
*
* <PARAM>
* <RETURN>object
* <NOTES>
* <HISTORY> 2004/6/21 by LiJun
*/
public object OutQueue()
{
object d = null;
if(this.isEmpty() != true)
{
this.qhead = base.head.Next;
d = this.qhead.Data;
base.DeleteNode(1);
//this.qhead = base.head.Next;
}
return d;
}
/**
*isEmpty
*
* <PARAM>
* <RETURN> bool
* <NOTES>
* <HISTORY> 2004/6/21 by LiJun
*/
public bool isEmpty()
{
if(this.qhead == this.rear)
{
return true;
}
else
{
return false;
}
}
/**
*SetEmpty
*
* <PARAM>
* <RETURN> -
* <NOTES>
* <HISTORY> 2004/6/21 by LiJun
*/
public override void SetEmpty()
{
base.SetEmpty ();
this.CreateQueue();
}
}
}
?? 快捷鍵說(shuō)明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -