Пример #1
0
        public void setNoTerminal(String noTerminal, token nextToken)
        {
            String  tokenRequired = nextToken.getName();
            String  nameLastNode  = nodesWaited[nodesWaited.Count - 1].getName();
            Boolean isError       = true;

            foreach (RowSA row in this.tableSA)
            {
                String nameNoTerminal = row.getRow();
                String column         = row.getCol();
                if (column == tokenRequired && nameNoTerminal == noTerminal && nameNoTerminal == nameLastNode)
                {
                    NodeTree nodeToUse         = new NodeTree(codeUsing.ToString(), nameNoTerminal);
                    NodeTree nodeParentFromUse = nodesWaited[nodesWaited.Count - 1].getParent();
                    nodeParentFromUse.setNewChild(nodeToUse);
                    nodeToUse.setNodeParent(nodeParentFromUse);
                    this.nodeUsing = nodeToUse;
                    String values = row.getVal();
                    setTokensToWait(values);
                    this.codeUsing++;
                    isError = false;
                    break;
                }
            }
            if (isError == true && nameLastNode.Equals("Q'"))
            {
                nodesWaited.RemoveAt(nodesWaited.Count - 1);
                setNoTerminal(noTerminal, nextToken);
            }
        }
Пример #2
0
        public Tree(String nodeName)
        {
            codeUsing = 0;
            String nodeCode = codeUsing.ToString();

            rootNode  = new NodeTree("node" + nodeCode, nodeName);
            nodeUsing = rootNode;
        }
Пример #3
0
        public TreeAS(String nodeName)
        {
            nodesWaited = new List <NodeWaited>();
            matrixSA matrix = new matrixSA();

            this.tableSA = matrix.getTable();
            codeUsing    = 0;
            String nodeCode = codeUsing.ToString();

            rootNode  = new NodeTree("node" + nodeCode, nodeName);
            nodeUsing = rootNode;
            nodesWaited.Add(new NodeWaited(nodeName, rootNode));
        }
Пример #4
0
        public void addNodeTree(token tokenSet, NodeWaited nodeInsert)
        {
            codeUsing++;
            NodeTree parent = nodeInsert.getParent();
            String   name   = nodeInsert.getName();

            if (this.nodeWaitValue.Contains(nodeInsert.getName()))
            {
                String newName = tokenSet.getVal();
                name = newName;
            }
            NodeTree newNode = new NodeTree("node" + codeUsing.ToString(), name);

            newNode.setNodeParent(parent);
            parent.setNewChild(newNode);
            nodesWaited.RemoveAt(nodesWaited.Count - 1);
        }
Пример #5
0
        public void setValues(String values)
        {
            String[]        valuesToInsert  = values.Split('.');
            List <NodeTree> childsNodeUsing = nodeUsing.getChilds();

            foreach (String item in valuesToInsert)
            {
                if (valuesToInsert[valuesToInsert.Length - 1].Equals("reduce") == false)
                {
                    codeUsing++;

                    NodeTree nodeInsert = new NodeTree("node" + codeUsing.ToString(), item);
                    nodeInsert.setNodeParent(this.nodeUsing);
                    childsNodeUsing.Add(nodeInsert);
                }
            }
            this.nodeUsing.setChilds(childsNodeUsing);
            setNewNodeUsing();
        }
Пример #6
0
 public void setNodeParent(NodeTree node)
 {
     this.nodeParent = node;
 }
Пример #7
0
 public void setNewChild(NodeTree child)
 {
     this.childs.Add(child);
 }
Пример #8
0
 public void setParent(NodeTree parent)
 {
     this.parent = parent;
 }
Пример #9
0
 public NodeWaited(String name, NodeTree parent)
 {
     this.name   = name;
     this.parent = parent;
 }