private Expression generateCopyExpression(
      DefinedParamType type,
      String inputParmId,
      int inputIndex,
      String outputParamId,
      int outputIndex) {
    // GOAL: ((InputSocket<Mat>) inputs[0]).getValue().assignTo(((OutputSocket<Mat>)
    // outputs[0]).getValue());
    final ClassOrInterfaceType outputType = new ClassOrInterfaceType("OutputSocket");
    final ClassOrInterfaceType inputType = new ClassOrInterfaceType("InputSocket");
    outputType.setTypeArgs(Collections.singletonList(type.getType()));
    inputType.setTypeArgs(Collections.singletonList(type.getType()));

    final MethodCallExpr copyExpression =
        new MethodCallExpr(
            getOrSetValueExpression(
                new EnclosedExpr(new CastExpr(inputType, arrayAccessExpr(inputParmId, inputIndex))),
                null),
            "assignTo",
            Collections.singletonList(
                getOrSetValueExpression(
                    new EnclosedExpr(
                        new CastExpr(outputType, arrayAccessExpr(outputParamId, outputIndex))),
                    null)));
    copyExpression.setComment(
        new BlockComment(
            " Sets the value of the input Mat to the output because this operation does not have a destination Mat. "));
    return copyExpression;
  }
Example #2
0
  @Override
  public Boolean visit(final MethodCallExpr n1, final Node arg) {
    final MethodCallExpr n2 = (MethodCallExpr) arg;

    if (!nodeEquals(n1.getScope(), n2.getScope())) {
      return Boolean.FALSE;
    }

    if (!objEquals(n1.getName(), n2.getName())) {
      return Boolean.FALSE;
    }

    if (!nodesEquals(n1.getArgs(), n2.getArgs())) {
      return Boolean.FALSE;
    }

    if (!nodesEquals(n1.getTypeArgs(), n2.getTypeArgs())) {
      return Boolean.FALSE;
    }

    return Boolean.TRUE;
  }