Exemplo n.º 1
0
 /// <summary>
 /// Creates a program from given directive. The method assumes that given directive node contains the whole program in a tree form, i.e. that its successors are already set. Method will not change the node nor any of its successors.
 /// </summary>
 /// <param name="treeRoot"></param>
 public SolutionProgram(DirectiveNode treeRoot)
 {
     this.directivesList = new List <DirectiveNode>()
     {
         treeRoot
     };
     this.mainEntryPoint = new directiveEntryPoint(treeRoot);
 }
Exemplo n.º 2
0
 /// <summary>
 /// Creates a program from a list of directives. That will be executed one by one in given order. These directives should NOT have the property nextDirective set as it will be set here. If it was already set, the original value will be lost.
 /// The method assumes that all these directives are isolated, i.e. that their nextDirective is directiveTerminal or null.
 /// </summary>
 /// <param name="list"></param>
 public SolutionProgram(List <DirectiveNode> list)
 {
     this.directivesList = list;
     this.mainEntryPoint = new directiveEntryPoint(list[0]);
     for (int i = 0; i < list.Count - 1; i++)
     {
         list[i].setSuccessor(list[i + 1], list[i].successors.count - 1);
     }
     if (list.Last().type != NodeType.dirTerminal)
     {
         list.Last().setSuccessor(new directiveTerminal(), list.Last().successors.count - 1);
     }
     removeDirSequence();
 }