Example #1
0
 // 向后移动一个数据
 public void MoveNext()
 {
     if (!IsEof())
     {
         Current = Current.Next;
     }
     else
     {
         Current = Head;
     }
 }
Example #2
0
        public int ListNodeCount;    //链表数据的个数


        public void Append() //尾部添加数据
        {
            LinkListNode NewNode = new LinkListNode();

            if (IsNull())

            //如果头指针为空
            {
                Head = NewNode;
                Tail = NewNode;
            }
            else
            {
                Tail.Next        = NewNode;
                NewNode.Previous = Tail;
                Tail             = NewNode;
            }
            Current        = NewNode;
            ListNodeCount += 1;//链表数据个数加一
        }
Example #3
0
 public void SetMonFunc(LinkListNode linkListNode, string func)
 {
     if (linkListNode.DataType == "0X")
     {
         linkListNode.MonReadFunc  = 1;
         linkListNode.MonWriteFunc = 15;
     }
     else if (linkListNode.DataType == "1X")
     {
         linkListNode.MonReadFunc = 2;
     }
     else if (linkListNode.DataType == "3X")
     {
         linkListNode.MonReadFunc = 4;
     }
     else if (linkListNode.DataType == "4X")
     {
         linkListNode.MonReadFunc  = 3;
         linkListNode.MonWriteFunc = 16;
     }
 }
Example #4
0
        public void ConfigSet()
        {
            LinkListNode data = new LinkListNode();

            int[] Num_X = new int[4] {
                0, 0, 0, 0
            };

            data = LinkList.Head;

            for (int i = 0; i < LinkList.ListNodeCount; i++)
            {
                if (data.DataType == "0X")
                {
                    Num_X[0] += data.Num;
                }
                else if (data.DataType == "1X")
                {
                    Num_X[1] += data.Num;
                }
                else if (data.DataType == "3X")
                {
                    Num_X[2] += data.Num;
                }
                else if (data.DataType == "4X")
                {
                    Num_X[3] += data.Num;
                }
                data = data.Next;
            }


            dataGridView1.Rows.Add(ReturnLagNum(Num_X));

            for (int i = 0; i < ReturnLagNum(Num_X); i++)
            {
                dataGridView1.Rows[i].HeaderCell.Value = (i + 1).ToString();
            }

            data     = LinkList.Head;
            Num_X[0] = 0; Num_X[1] = 0; Num_X[2] = 0; Num_X[3] = 0;
            for (int i = 0; i < LinkList.ListNodeCount; i++)
            {
                if (data.DataType == "0X")
                {
                    for (int num_0x = 0; num_0x < data.Num; num_0x++)
                    {
                        dataGridView1.Rows[Num_X[0]].Cells[0].Value    = data.DataType + (data.FirstAddr + num_0x);
                        dataGridView1.Rows[Num_X[0]].Cells[0].ReadOnly = true;
                        dataGridView1.Rows[Num_X[0]].Cells[1].Value    = data.ReadNameConst[num_0x];
                        dataGridView1.Rows[Num_X[0]].Cells[1].ReadOnly = true;

                        data.ViewRows[num_0x]  = Num_X[0];
                        data.ViewCells[num_0x] = 2;
                        dataGridView1.Rows[data.ViewRows[num_0x]].Cells[data.ViewCells[num_0x]].Value = 0;



                        Num_X[0]++;
                    }
                }
                else if (data.DataType == "1X")
                {
                    for (int num_1x = 0; num_1x < data.Num; num_1x++)
                    {
                        dataGridView1.Rows[Num_X[1]].Cells[3].Value    = data.DataType + (data.FirstAddr + num_1x);
                        dataGridView1.Rows[Num_X[1]].Cells[3].ReadOnly = true;
                        dataGridView1.Rows[Num_X[1]].Cells[4].Value    = data.ReadNameConst[num_1x];
                        dataGridView1.Rows[Num_X[1]].Cells[4].ReadOnly = true;

                        data.ViewRows[num_1x]  = Num_X[1];
                        data.ViewCells[num_1x] = 5;
                        dataGridView1.Rows[data.ViewRows[num_1x]].Cells[data.ViewCells[num_1x]].Value = 0;


                        Num_X[1]++;
                    }
                }
                else if (data.DataType == "3X")
                {
                    for (int num_3x = 0; num_3x < data.Num; num_3x++)
                    {
                        dataGridView1.Rows[Num_X[2]].Cells[6].Value    = data.DataType + (data.FirstAddr + num_3x);
                        dataGridView1.Rows[Num_X[2]].Cells[6].ReadOnly = true;
                        dataGridView1.Rows[Num_X[2]].Cells[7].Value    = data.ReadNameConst[num_3x];
                        dataGridView1.Rows[Num_X[2]].Cells[7].ReadOnly = true;

                        data.ViewRows[num_3x]  = Num_X[2];
                        data.ViewCells[num_3x] = 8;
                        dataGridView1.Rows[data.ViewRows[num_3x]].Cells[data.ViewCells[num_3x]].Value = 0;


                        Num_X[2]++;
                    }
                }
                else if (data.DataType == "4X")
                {
                    for (int num_4x = 0; num_4x < data.Num; num_4x++)
                    {
                        dataGridView1.Rows[Num_X[3]].Cells[9].Value     = data.DataType + (data.FirstAddr + num_4x);
                        dataGridView1.Rows[Num_X[3]].Cells[9].ReadOnly  = true;
                        dataGridView1.Rows[Num_X[3]].Cells[10].Value    = data.ReadNameConst[num_4x];
                        dataGridView1.Rows[Num_X[3]].Cells[10].ReadOnly = true;

                        data.ViewRows[num_4x]  = Num_X[3];
                        data.ViewCells[num_4x] = 11;
                        dataGridView1.Rows[data.ViewRows[num_4x]].Cells[data.ViewCells[num_4x]].Value = 0;


                        Num_X[3]++;
                    }
                }
                data = data.Next;
            }
        }