示例#1
0
  /** Checks in the vertex implementation properties if it can be mapped on the given operator */
  @Override
  public final boolean isMapable(
      MapperDAGVertex vertex, ComponentInstance operator, boolean protectGroupMapping)
      throws WorkflowException {

    return DesignTools.contains(getCandidateOperators(vertex, protectGroupMapping), operator);
  }
示例#2
0
  /**
   * Looks for an operator able to execute currentvertex (preferably the given operator or an
   * operator with same type) If the boolean protectGroupMapping is true and at least one vertex is
   * mapped in the current vertex group, this unique operator is compared to the prefered one.
   * Otherwise, the prefered operator is checked of belonging to available operators of the group.
   *
   * @throws WorkflowException
   */
  @Override
  public final ComponentInstance findOperator(
      MapperDAGVertex currentvertex,
      ComponentInstance preferedOperator,
      boolean protectGroupMapping)
      throws WorkflowException {

    ComponentInstance adequateOp = null;
    List<ComponentInstance> opList = getCandidateOperators(currentvertex, protectGroupMapping);

    if (DesignTools.contains(opList, preferedOperator)) {
      adequateOp = preferedOperator;
    } else {

      // Search among the operators with same type than the prefered one
      for (ComponentInstance op : opList) {
        if (preferedOperator != null
            && op.getComponent()
                .getVlnv()
                .getName()
                .equals(preferedOperator.getComponent().getVlnv().getName())) {
          adequateOp = op;
        }
      }

      // Search among the operators with other type than the prefered one
      if (adequateOp == null) {
        for (ComponentInstance op : opList) {
          adequateOp = op;
          return adequateOp;
        }
      }
    }

    return adequateOp;
  }