/** * called when one of this node's children updates it's stop-token, * so that this node can potentially take action; maybe by setting * the same stop-token IF the child was the very-last in this node's * list of children. */ private void notifyChildStopTokenChange(LinkedListTree child, LinkedListToken newStop) { // TODO: maybe move to delegates if (isLast(child) && (isSameStopToken(child) || isNoStopToken(child))) { setStopToken(newStop); } }
public LinkedListToken setStopToken(LinkedListToken stopToken) { if (parent != null) { parent.notifyChildStopTokenChange(this, stopToken); } return(this.stopToken = stopToken); }
/** * called when one of this node's children updates it's start-token, * so that this node can potentially take action; maybe by setting * the same start-token IF the child was the very-first in this node's * list of children. */ private void notifyChildStartTokenChange(LinkedListTree child, LinkedListToken newStart) { // TODO: maybe move to delegates if (isFirst(child) && isSameStartToken(child)) { setStartToken(newStart); } }
public void setStartToken(LinkedListToken startToken) { if (parent != null) { parent.notifyChildStartTokenChange(this, startToken); } this.startToken = startToken; }
public void setPrev(LinkedListToken prev) { if (this == prev) { throw new ArgumentException("Token stream loop detected"); } this.prev = prev; if (prev != null) { prev.next = this; } }
public void setNext(LinkedListToken next) { if (this == next) { throw new ArgumentException("Token stream loop detected (" + ToString() + ")"); } this.next = next; if (next != null) { next.prev = this; } }
public void delete() { if (prev != null) { prev.next = next; } if (next != null) { next.prev = prev; } next = prev = null; }
public void beforeInsert(LinkedListToken insert) { if (insert.getPrev() != null) { throw new ArgumentException("beforeInsert(" + insert + ") : prev was not null"); } if (insert.getNext() != null) { throw new ArgumentException("beforeInsert(" + insert + ") : next was not null"); } insert.prev = prev; insert.next = this; if (prev != null) { prev.next = insert; } prev = insert; }
public void afterInsert(LinkedListToken insert) { if (insert.getPrev() != null) { throw new ArgumentException("afterInsert(" + insert + ") : prev was not null"); } if (insert.getNext() != null) { throw new ArgumentException("afterInsert(" + insert + ") : next was not null"); } insert.next = next; insert.prev = this; if (next != null) { next.prev = insert; } next = insert; }
public void setInitialInsertionBefore(LinkedListToken insert) { initialInsertionBefore = insert; }
public void setInitialInsertionAfter(LinkedListToken insert) { initialInsertionAfter = insert; }
public void addToken(int index, LinkedListToken append) { tokenListUpdater.AddToken(this, index, append); }
public void appendToken(LinkedListToken append) { tokenListUpdater.AppendToken(this, append); }