欢迎来到天天文库
浏览记录
ID:35448425
大小:105.46 KB
页数:17页
时间:2019-03-24
《线性表的应用——仓库管理和图的应用——工程工期控制问题》由会员上传分享,免费在线阅读,更多相关内容在工程资料-天天文库。
1、usingSystem;usingSystem.Collections.Generic;usingSystem.Text;namespaceLJH.ListNodeEE{publicclassObjects{privateintnumber;privatestringname;privateintcounter;/*货物编号*//*货物名称*//*货物数量*/軸III卜I黑I詛I卜曲卜LI詛kI詛I卜卜〃构造函数publicObjects(intnum,string{number=num;name=Name;counter=count;}publicintNu
2、mber{get{returnnumber;}set{number=value;}}publicstringName{get{returnname;}set{name=value;}Name,intcount)亡由卜I卜II詛I卜k卜I卜returncounter;countervalue;publicintCounterget{}set{}}}//结点类publicclassListNode{publicListNode(Objectsbugs){goods=bugs;}///III前一个IIIpublicListNod
3、ePrevious;//////后一个IIIpublicListNodeNext;publicListNodenext{get{returnNext;}set{Next二value;}}//////值IIIpublicObjectsgoods:publicObjectsGoods亡由亡由returngoods;goods=value;卜II艸I卜I卜卜I卜publicclassClists{publicClists(){〃构造函数//初始化ListCountValue=0;Head=n
4、ull;Tail=null;}///III表名IIIprivatestringclistname=〃”;publicstringClistName{get{returnc1istname;}set{clistname=value;}}///III头指针IIIprivateListNodeHead;///尾指针///privateListNodeTail;III詛I曲I卜I詛I卜卜I黑I卜II斡I卜II詛IIIII詛///III当前指针///5、mmary>privateListNodeCurrent;publicListNodecurrent{get{returnCurrent;}set{Current二value;}}///III链表数据的个数IIIprivateintListCountValue;///III尾部添加数据IIIpublicvoidAppend(ObjectsDataValue){ListNodeNewNode=newListNode(DataValue);if(IsNullO)〃如果头指针为空{Ta订Ne6、wNode;Head=NewNode;}else它由IIIIII卜IIIIIII卜I詛I卜III詛III曲III詛Tail.Next=NewNode;NewNode.Previous=Tai1;Tail=NewNode:}Current=NewNode;〃链表数据个数加一ListCountValue+二1;}//////删除当前的数据///publicvoidDelete(){〃若为空链表if(IIsNullO){//若删除头if(IsBofO){Head=Current.Next;Current=Head;ListCou7、ntValue-=1;return;}〃若删除尾if(IsEofO)岸由Tai1=Current・Previous;Tail,next=null;Current=Tail;ListCountValue-二1;return;}〃若删除中间数据Current.Previous.Next二Current.Next;Current=Current.Previous;ListCountValue-二1;return;}//////向后移动一个数据IIIpublicvoidMoveNext(){if(!IsEof())Current=8、Current.Next;}///
5、mmary>privateListNodeCurrent;publicListNodecurrent{get{returnCurrent;}set{Current二value;}}///III链表数据的个数IIIprivateintListCountValue;///III尾部添加数据IIIpublicvoidAppend(ObjectsDataValue){ListNodeNewNode=newListNode(DataValue);if(IsNullO)〃如果头指针为空{Ta订Ne
6、wNode;Head=NewNode;}else它由IIIIII卜IIIIIII卜I詛I卜III詛III曲III詛Tail.Next=NewNode;NewNode.Previous=Tai1;Tail=NewNode:}Current=NewNode;〃链表数据个数加一ListCountValue+二1;}//////删除当前的数据///publicvoidDelete(){〃若为空链表if(IIsNullO){//若删除头if(IsBofO){Head=Current.Next;Current=Head;ListCou
7、ntValue-=1;return;}〃若删除尾if(IsEofO)岸由Tai1=Current・Previous;Tail,next=null;Current=Tail;ListCountValue-二1;return;}〃若删除中间数据Current.Previous.Next二Current.Next;Current=Current.Previous;ListCountValue-二1;return;}//////向后移动一个数据IIIpublicvoidMoveNext(){if(!IsEof())Current=
8、Current.Next;}///
此文档下载收益归作者所有