protected void FillReserveListIfEmpty(int n) { if (pReserve == null) { pReserve = this.derivedCreateNode(); DLink head = pReserve; for (int x = 0; x < n - 1; x++) { pReserve.pNext = this.derivedCreateNode(); pReserve.pNext.pPrev = pReserve; pReserve = pReserve.pNext; } pReserve = head; nNumReserved = n; } }
public static DLink AddToFront(ref DLink pHead, DLink pNode) { if (pHead == null) { pHead = pNode; pNode.pNext = null; pNode.pPrev = null; } else { pNode.pPrev = null; pNode.pNext = pHead; pHead.pPrev = pNode; pHead = pNode; } return(pNode); }
public DLink baseRemove(DLink node) { if (node == null) { return(null); } if (pActive is null) { return(null); } DLink.RemoveNode(ref pActive, node); this.derivedWash(node); --mNumActive; ++nNumReserved; return(node); }
public static void RemoveNode(ref DLink pHead, DLink pNode) { if (pNode.pPrev != null) { pNode.pPrev.pNext = pNode.pNext; } else { pHead = pNode.pNext; } if (pNode.pNext != null) { pNode.pNext.pPrev = pNode.pPrev; } pNode.Clear(); }
public DLink AddToFront() { FillReserveListIfEmpty(nGrowthSize); if (pReserve != null) { pReserve.pPrev = null; } DLink node = pReserve; this.derivedWash(node); pReserve = pReserve.pNext; node.pNext = null; node.pPrev = null; node = DLink.AddToFront(ref pActive, node); pActive = node; ++mNumActive; --nNumReserved; return(node); }
public DLink AddBefore(ref DLink node) { if (node == null || baseFind(node) == null) { return(null); } FillReserveListIfEmpty(nGrowthSize); if (pReserve != null) { pReserve.pPrev = null; } DLink nNode = pReserve; pReserve = pReserve.pNext; DLink head = pActive; if (node == pActive) { return(AddToFront()); } else { node.pPrev.pNext = nNode; nNode.pPrev = node.pPrev; node.pPrev = nNode; nNode.pNext = node; ++mNumActive; --nNumReserved; } pActive = head; return(nNode); }
protected override void derivedWash(DLink node) { Image image = (Image)node; image.Wash(); }
public void Clear() { this.pNext = null; this.pPrev = null; }
protected override void derivedWash(DLink node) { SpriteNode pNode = (SpriteNode)node; pNode.Wash(); }
abstract protected void derivedWash(DLink node);
abstract protected bool derivedCompare(DLink nodeA, DLink nodeB);