Package ch.tatool.element

Examples of ch.tatool.element.ElementTree


 
  /** Updates the stack
   * @return true if another element is ready for execution
   */
  public boolean updateElementStack(ExecutionContext executionContext) {
    ElementTree tree = executionContext.getExecutor().getExecutionTree();
   
    // push the root element onto the stack if the stack is empty
    if (tree.getElementStack().isEmpty()) {
      tree.pushElement(tree.getRootElement());
      ElementUtils.initialize(tree.getRootElement());
    }
   
    // make sure we don't loop forever
    int x=0;
    while (x < 100) {
      if (isTopExecutable(tree)) {
        return true;
      }
      else if (runTopSelectors(executionContext, tree)) {
        continue;
      }
      else if (hasTemporaryElement(tree)) {
        continue;
      }
      /*else if (isTopMarkedForReexecution(tree)) {
        return true;
      }*/
      // top element is used, pop it from the stack
      else {
        tree.popElement();
        // check whether the whole tree has been executed
        if (tree.getElementStack().isEmpty()) {
          return false;
        }
      }
    }
   
    // remove the Execution outcome property if set
    Misc.getOutcomeProperty().clearValue(executionContext);
   
    // ensure that the top element contains an executable element
    Element top = tree.getTop();
    return top != null && top.getExecutable() != null;
  }
View Full Code Here


      compoundElement.getPrimary().setProperty(Element.EXECUTED, null);
            setExecutePrimary(true);
    }
   
    // handle primary case
    ElementTree tree = context.getExecutor().getExecutionTree();
    if (isExecutePrimary() || compoundElement.getSecondary() == null) {
      tree.pushElement(compoundElement.getPrimary());
      ElementUtils.initialize(compoundElement.getPrimary());
      return true;
    } else {
            // we also initialize the secondary element on each run
      ElementUtils.initialize(compoundElement.getSecondary());
          tree.pushElement(compoundElement.getSecondary());
          setExecuteSecondary(true);
            return true;
        }
  }
View Full Code Here

    this.strategy = strategy;
  }
 
  public void initialize(Executor executor, Module module) {
    executor.setExecutionStrategy(strategy);
    ElementTree tree = executor.getExecutionTree();
    tree.setRootElement(rootElement);
  }
View Full Code Here

 
  /** Updates the stack
   * @return true if another element is ready for execution
   */
  public boolean updateElementStack(ExecutionContext executionContext) {
    ElementTree tree = executionContext.getExecutor().getExecutionTree();
   
    // push the root element onto the stack if the stack is empty
    if (tree.getElementStack().isEmpty()) {
      tree.pushElement(tree.getRootElement());
      ElementUtils.initialize(tree.getRootElement());
    }
   
    // make sure we don't loop forever
    int x=0;
    while (x < 100) {
      if (isTopExecutable(tree)) {
        return true;
      }
      else if (runTopSelectors(executionContext, tree)) {
        continue;
      }
      else if (hasTemporaryElement(tree)) {
        continue;
      }
      /*else if (isTopMarkedForReexecution(tree)) {
        return true;
      }*/
      // top element is used, pop it from the stack
      else {
        tree.popElement();
        // check whether the whole tree has been executed
        if (tree.getElementStack().isEmpty()) {
          return false;
        }
      }
    }
   
    // remove the Execution outcome property if set
    Misc.getOutcomeProperty().clearValue(executionContext);
   
    // ensure that the top element contains an executable element
    Element top = tree.getTop();
    return top != null && top.getExecutable() != null;
  }
View Full Code Here

TOP

Related Classes of ch.tatool.element.ElementTree

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.