public string ToChainString() { ChainImpl root = (ChainImpl)Root; string output = "Chain=" + root.Name; for (ChainImpl current = root.next; !current.isRoot; current = current.next) { output += "," + current.Name; } return(output); }
public Chain GetAt(int index) { int i = 0; ChainImpl link = (ChainImpl)Root; do { if (i == index) { return(link); } i++; link = link.next; }while (!link.isRoot); throw new ApplicationException("Not found at " + index); }
public Chain InsertAfter(Chain chain) { if (trace) { log.Trace(GetType().Name + " InsertAfter() " + chain.ToChainString() + " after " + this); } ChainImpl root = (ChainImpl)chain.Root; ChainImpl tail = (ChainImpl)chain.Tail; root.isRoot = false; root.previous = this; tail.next = next; next.previous = tail; next = root; return(root); }
public Chain InsertBefore(Chain chain) { if (trace) { log.Trace(GetType().Name + " InsertBefore() " + chain.ToChainString() + " before " + this); } ChainImpl root = (ChainImpl)chain.Root; ChainImpl tail = (ChainImpl)chain.Tail; root.isRoot = isRoot; isRoot = false; tail.next = this; root.previous = previous; previous.next = root; previous = tail; return(root); }
public Chain Replace(Chain chain) { if (trace) { log.Trace(GetType().Name + " Replace() " + this + " with " + chain.ToChainString()); } ChainImpl root = (ChainImpl)chain.Root; ChainImpl tail = (ChainImpl)chain.Tail; root.isRoot = isRoot; isRoot = false; tail.next = next; root.previous = previous; previous.next = root; next.previous = tail; return(root); }
public ChainImpl(ModelInterface formula) { if (trace) { log.Trace("new "); } if (trace) { log.Indent(); } LinkFormula(formula); previous = this; next = this; if (trace) { log.Outdent(); } }
private ChainImpl() { previous = this; next = this; }