Package net.sf.jcontracts.antlr.collections

Examples of net.sf.jcontracts.antlr.collections.AST


        return t;
    }

    public AST create(Token tok)
    {
        AST t = create();
        t.initialize(tok);
        return t;
    }
View Full Code Here


        return create(t);
    }

    public AST dupList(AST t)
    {
        AST result = dupTree(t);
        for (AST nt = result; t != null; nt = nt.getNextSibling())
        {
            t = t.getNextSibling();
            nt.setNextSibling(dupTree(t));
        }
View Full Code Here

        return result;
    }

    public AST dupTree(AST t)
    {
        AST result = dup(t);
        if (t != null)
        {
            result.setFirstChild(dupList(t.getFirstChild()));
        }
        return result;
    }
View Full Code Here

    {
        if (nodes == null || nodes.length == 0)
        {
            return null;
        }
        AST root = nodes[0];
        AST tail = null;
        if (root != null)
        {
            root.setFirstChild(null);
        }
        for (int i = 1; i < nodes.length; i++)
        {
            if (nodes[i] != null)
            {
                if (root == null)
                {
                    root = tail = nodes[i];
                }
                else if (tail == null)
                {
                    root.setFirstChild(nodes[i]);
                    tail = root.getFirstChild();
                }
                else
                {
                    tail.setNextSibling(nodes[i]);
                    tail = tail.getNextSibling();
                }
                while (tail.getNextSibling() != null)
                {
                    tail = tail.getNextSibling();
                }
            }
        }

        return root;
View Full Code Here

    {
        if (t == null)
        {
            return false;
        }
        AST sibling;
        for (sibling = this; sibling != null && t != null; t = t.getNextSibling())
        {
            if (!sibling.equals(t))
            {
                return false;
            }
            if (sibling.getFirstChild() != null && !sibling.getFirstChild().equalsList(t.getFirstChild()))
            {
                return false;
            }
            sibling = sibling.getNextSibling();
        }

        return sibling == null && t == null;
    }
View Full Code Here

    {
        if (sub == null)
        {
            return true;
        }
        AST sibling;
        for (sibling = this; sibling != null && sub != null; sub = sub.getNextSibling())
        {
            if (sibling.getType() != sub.getType())
            {
                return false;
            }
            if (sibling.getFirstChild() != null && !sibling.getFirstChild().equalsListPartial(sub.getFirstChild()))
            {
                return false;
            }
            sibling = sibling.getNextSibling();
        }

        return sibling != null || sub == null;
    }
View Full Code Here

        return getText();
    }

    public String toStringList()
    {
        AST t = this;
        String ts = "";
        if (t.getFirstChild() != null)
        {
            ts = ts + " (";
        }
        ts = ts + " " + toString();
        if (t.getFirstChild() != null)
        {
            ts = ts + ((BaseAST) t.getFirstChild()).toStringList();
        }
        if (t.getFirstChild() != null)
        {
            ts = ts + " )";
        }
        if (t.getNextSibling() != null)
        {
            ts = ts + ((BaseAST) t.getNextSibling()).toStringList();
        }
        return ts;
    }
View Full Code Here

        return ts;
    }

    public String toStringTree()
    {
        AST t = this;
        String ts = "";
        if (t.getFirstChild() != null)
        {
            ts = ts + " (";
        }
        ts = ts + " " + toString();
        if (t.getFirstChild() != null)
        {
            ts = ts + ((BaseAST) t.getFirstChild()).toStringList();
        }
        if (t.getFirstChild() != null)
        {
            ts = ts + " )";
        }
        return ts;
    }
View Full Code Here

TOP

Related Classes of net.sf.jcontracts.antlr.collections.AST

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.