示例#1
0
        public void Add(T inNode)
        {
            vertices.Add(new CycleNode <T>(inNode));
            contents.Add(inNode);

            CurrentNode = vertices[0];

            if (vertices.Count == 1)
            {
                vertices[0].Next = vertices[0];
            }
            else
            {
                vertices[vertices.Count - 2].Next = vertices[vertices.Count - 1];
                vertices[vertices.Count - 1].Next = vertices[0];
            }
        }
示例#2
0
        public T Next()
        {
            CurrentNode = CurrentNode.Next;

            return(CurrentNode.Contents);
        }
示例#3
0
 public CycleNode(T contents, CycleNode <T> next)
 {
     Contents = contents;
     Next     = next;
 }