//交换节点 public void Swap(DLinkNode targetNode) { DLinkNode prethis = this.Previous; DLinkNode nextthis = this.Next; this.Delete(); if (nextthis == targetNode) { targetNode.AddAfter(this); } else if (prethis == targetNode) { targetNode.InsretBefor(this); } else /*if (nextthis != targetNode && prethis != targetNode)*/ { targetNode.AddAfter(this); targetNode.Delete(); if (prethis == null) { nextthis.InsretBefor(targetNode); } else { prethis.AddAfter(targetNode); } } }
public bool MoveNext() { if (end) { return(false); } if (node.IsEnd) { DLinkNode FackTail = new DLinkNode(); FackTail.AddAfter(node); end = true; } node = node.Next; return(true); }