private static void makeNodes(int numLines) { if(currLine == null) { currLine = new Node(""); currLine.next = new Node(""); Node curr = currLine.next; Node last=currLine; curr.last=last; for(int i=2;i<numLines;i++) { curr.next=new Node(""); curr=curr.next; curr.last = last.next; last = last.next; } curr.next=currLine; currLine.last = curr; } else { if(numLines>numNodes) { Node curr = currLine; Node last = currLine.last; for(int i=0;i<numLines-numNodes;i++) { Node n = new Node(""); n.next=curr; n.last=last; last.next=n; curr.last=n; last=n; } } else { for(int i=0;i<numNodes-numLines;i++) { currLine.last = currLine.last.last; currLine.last.next = currLine; } } } }
public static void AddLine(string s) { currLine = currLine.last; currLine.str=s; if(BufferChanged!=null) BufferChanged(currLine); }
public Node(string str) { next=null; this.str=str; }