コード例 #1
0
  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
 public static Type getSocketReturnParam(String socketNameType) {
   ClassOrInterfaceType socketType = new ClassOrInterfaceType(null, socketNameType);
   socketType.setTypeArgs(Arrays.asList(new WildcardType()));
   return new ReferenceType(socketType, 1);
 }