protected Manager(int toCreate, int willCreate) { activeHead = null; reserveHead = null; this.stats.currActiveNodes = 0; this.stats.currReserveNodes = 0; this.stats.peakActiveNodes = 0; this.stats.peakNumNodes = 0; this.stats.currNumNodes = 0; this.stats.beginToCreate = toCreate; this.stats.willCreate = willCreate; this.createReserve(toCreate); }
public TimeEventManager(int toCreate, int willCreate) { activeHead = null; reserveHead = null; this.currTime = 0.0f; this.prevTime = 0f; this.stats.currActiveNodes = 0; this.stats.currReserveNodes = 0; this.stats.peakActiveNodes = 0; this.stats.peakNumNodes = 0; this.stats.currNumNodes = 0; this.stats.beginToCreate = toCreate; this.stats.willCreate = willCreate; this.createReserve(toCreate); }
protected ManNode() { next = null; prev = null; }
protected void baseRemove(Enum imgName, Index index = Index.Index_Null) { ManNode node = this.baseFind(imgName, index); Debug.Assert(node != null); if (activeHead == node) { activeHead = activeHead.next; if(activeHead != null) activeHead.prev = null; } else if (node.prev != null) { node.prev.next = node.next; if (node.next != null) { node.next.prev = node.prev; } } addReserve(node); this.stats.currActiveNodes--; }
protected void baseDestroy() { activeHead = null; }
private void addReserve(ManNode node) { node.next = reserveHead; if(reserveHead != null) reserveHead.prev = node; reserveHead = node; }
private void addActive(ManNode node) { node.next = activeHead; if (activeHead != null) activeHead.prev = node; activeHead = node; this.stats.currActiveNodes++; if (stats.currActiveNodes > stats.peakActiveNodes) { stats.peakActiveNodes = stats.currActiveNodes; } }
protected ManNode detachReserveHead() { if (this.reserveHead == null) { // Create more so that we can detatch this.createReserve(stats.willCreate); } ManNode node = this.reserveHead; this.reserveHead = this.reserveHead.next; // Taking it off the list if (node.next != null) { node.next.prev = node.prev; } this.stats.currReserveNodes--; node.next = null; node.prev = null; return node; }
private void addReserve(ManNode node) { node.next = reserveHead; if (reserveHead != null) reserveHead.prev = node; reserveHead = node; this.stats.currReserveNodes++; }
private void addActivePriority(TimeEvent node) { TimeEvent curr = (TimeEvent)this.activeHead; if (activeHead == null) { activeHead = node; } else { while (curr.next != null && ((TimeEvent)curr).time < ((TimeEvent)node).time) { if (((TimeEvent)curr.next).time > ((TimeEvent)node).time) { break; } curr = (TimeEvent)curr.next; } if (this.activeHead == curr) { node.next = curr; node.prev = curr.prev; curr.prev = node; this.activeHead = node; } else { node.next = curr.next; curr.next = node; node.prev = curr; if (node.next != null) { node.next.prev = node; } } } }