Пример #1
0
    //전위 순회 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;
            }
        }
    }
Пример #2
0
    public EditorNode()
    {
        golLangNode = new GolLangNode(new GolLangLine());

        blocks = new List <Block>();

        parents = null;

        leftSibling = null;

        rightSibling = null;

        children = new List <EditorNode>();
    }
Пример #3
0
    public GolLangNode(GolLangLine line)
    {
        this.line = line;

        parents = null;

        leftSibling = null;

        rightSibling = null;

        children = new List <GolLangNode>();

        isVisited = false;
    }
Пример #4
0
    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;
        }
    }
Пример #5
0
    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>();
    }
Пример #6
0
 public GolLangTree(GolLangNode head)
 {
     this.head = head;
 }
Пример #7
0
 public GolLangTree()
 {
     head = null;
 }