Package ch.tatool.element

Examples of ch.tatool.element.Element


   */
  public static Object findHandlerInStackByType(ExecutionContext context, Class<?> type) {
    List<Element> elements = context.getElementStack();
    ListIterator<Element> iterator = elements.listIterator(elements.size());
    while (iterator.hasPrevious()) {
      Element element = iterator.previous();
      for (Object handler : element.getHandlers()) {
        if (type.isAssignableFrom(handler.getClass())) {
          return handler;
        }
      }
    }
View Full Code Here


  public static List<Object> findHandlersInStackByType(ExecutionContext context, Class<?> type) {
    List<Object> handlers = new ArrayList<Object>();
    List<Element> elements = context.getElementStack();
    ListIterator<Element> iterator = elements.listIterator(elements.size());
    while (iterator.hasPrevious()) {
      Element element = iterator.previous();
      for (Object handler : element.getHandlers()) {
        if (type.isAssignableFrom(handler.getClass())) {
          handlers.add(handler);
        }
      }
    }
View Full Code Here

        executionData.setSessionCompleted(1);
        return;
      }
     
      // fetch the new execution element
        Element newElement = elementTree.getTop();
        Executable newExecutable = null;
        if (newElement == null) {
          continueModule = false;
          return;
        }
       
        // fetch the executable executable
        newExecutable = newElement.getExecutable();
        if (newExecutable == null) {
          continueModule = false;
          return;
        }
       
View Full Code Here

        return;
      }
     
      // Now give all adaptors set on the executable element the possibility to adapt the points
      // The adaptors directory change the values in the trials.
      Element activeElement = context.getActiveElement();
      for (Object handler : activeElement.getHandlers()) {
        if (handler instanceof PointsAndLevelHandler.PointAdaptor) {
              ((PointsAndLevelHandler.PointAdaptor) handler).adaptPoints(this, context);
          }
        }
    }
View Full Code Here

        if (iterator == null || ! canExecuteNext()) {
            return false;
        }
       
        // get the next element and push it onto the stack
        Element next = iterator.next();
        ElementUtils.initialize(next);
        context.getExecutor().getExecutionTree().pushElement(next);
        return true;
  }
View Full Code Here

   
    // 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

    return top != null && top.getExecutable() != null;
  }
 
  /** Returns true if the top element contains an element that is yet to be executed. */
  private boolean isTopExecutable(ElementTree tree) {
    Element top = tree.getTop();
    // check whether there is an executable
    if (top != null && top.getExecutable() != null) {
      // check whether it is already executed
      Object executed = top.getProperty(Element.EXECUTED);
      if (executed == null || executed.equals(Boolean.FALSE)) {
        return true;
      }
    }
    return false;
View Full Code Here

    return false;
  }
 
  /** Handles the temporary elements. */
  private boolean hasTemporaryElement(ElementTree tree) {
    Element first = temporaryElements.poll();
    if (first != null) {
      tree.pushElement(first);
      return true;
    } else {
      return false;
View Full Code Here

 
  /**
   * Runs selectors found on the top element until the
   */
  private boolean runTopSelectors(ExecutionContext executionContext, ElementTree tree) {
    Element top = tree.getTop();
    for (Object handler : top.getHandlers()) {
      if (handler instanceof ElementSelector) {
        boolean adapted = ((ElementSelector) handler).selectNextElement(executionContext);
        if (adapted) {
          return true;
        }
View Full Code Here

          return false;
        }
       
        // push a random element
        int index = ((int) ((Math.random() * (long) elementCount))) % elementCount;
        Element element = elements.get(index);
        ElementUtils.initialize(element);
        executionContext.getExecutor().getExecutionTree().pushElement(element);
       
        // increment the trials returned
        executedIterations++;
View Full Code Here

TOP

Related Classes of ch.tatool.element.Element

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.