//전위 순회 Enumerator public IEnumerator GetEnumerator() { head.unvisit(); now = head; while (true) { if (!now.isVisited) { now.isVisited = true; yield return(now); } GolLangNode temp = now.getFirstUnvisitedChild(); if (temp != null) { now = temp; } else if (now.hasRightSibling()) { now = now.rightSibling; } else if (now.parents != null) { now = now.parents; } else { break; } } }
public EditorNode() { golLangNode = new GolLangNode(new GolLangLine()); blocks = new List <Block>(); parents = null; leftSibling = null; rightSibling = null; children = new List <EditorNode>(); }
public GolLangNode(GolLangLine line) { this.line = line; parents = null; leftSibling = null; rightSibling = null; children = new List <GolLangNode>(); isVisited = false; }
public void addChild(GolLangNode child) { children.Add(child); child.parents = this; if (children.Count > 1) { GolLangNode now = children[0]; while (now.rightSibling != null) { now = now.rightSibling; } now.rightSibling = child; child.leftSibling = now; } }
public EditorNode(Block firstBlock) { golLangNode = new GolLangNode(new GolLangLine()); golLangNode.line.keywords.Add(firstBlock.keyword); blocks = new List <Block>(); blocks.Add(firstBlock); firstBlock.node = this; parents = null; leftSibling = null; rightSibling = null; children = new List <EditorNode>(); }
public GolLangTree(GolLangNode head) { this.head = head; }
public GolLangTree() { head = null; }