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;
  }
Пример #2
0
  @Override
  public Boolean visit(final ClassOrInterfaceType n1, final Node arg) {
    final ClassOrInterfaceType n2 = (ClassOrInterfaceType) arg;

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

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

    if (!nodesEquals(n1.getTypeArgs(), n2.getTypeArgs())) {
      return Boolean.FALSE;
    }
    if (!nodesEquals(n1.getAnnotations(), n2.getAnnotations())) {
      return Boolean.FALSE;
    }
    return Boolean.TRUE;
  }
 public static Type getSocketReturnParam(String socketNameType) {
   ClassOrInterfaceType socketType = new ClassOrInterfaceType(null, socketNameType);
   socketType.setTypeArgs(Arrays.asList(new WildcardType()));
   return new ReferenceType(socketType, 1);
 }