/// <summary> /// 变成环形 /// </summary> /// <param name="last">最后一个</param> public void Recyle(SingleTrackNode <T> last) { if (last == null) { return; } this.current.NextNode = last; if (last.NextNode != null) { this.current = last.NextNode; } last.NextNode = this; }
/// <summary> /// 移动到下一节点 /// </summary> /// <param name="item">操作的数据</param> /// <returns></returns> public SingleTrackNode <T> Next(T item) { if (this.NextNode == null) { this.NextNode = new SingleTrackNode <T>(item); this.current = this.NextNode; return(this); } this.current.NextNode = new SingleTrackNode <T>(item); if (this.current.NextNode != null) { this.current = this.current.NextNode; } return(this); }
/// <summary> /// Initializes a new instance of the <see cref="SingleTrackNode{T}"/> class. /// </summary> /// <param name="current">The current.</param> /// <param name="next">The next.</param> public SingleTrackNode(T current, SingleTrackNode <T> next) { this.Current = current; this.NextNode = next; }
/// <summary> /// 清空 /// </summary> public void Clear() { this.NextNode = null; this.current = null; }