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;
  }
 @Override
 public void visit(final TypeParameter n, final A arg) {
   visitComment(n.getComment(), arg);
   if (n.getTypeBound() != null) {
     for (final ClassOrInterfaceType c : n.getTypeBound()) {
       c.accept(this, arg);
     }
   }
 }
 @Override
 public void visit(final ClassOrInterfaceType n, final A arg) {
   visitComment(n.getComment(), arg);
   visitAnnotations(n, arg);
   if (n.getScope() != null) {
     n.getScope().accept(this, arg);
   }
   if (n.getTypeArguments() != null) {
     for (final Type t : n.getTypeArguments()) {
       t.accept(this, arg);
     }
   }
 }
 @Override
 public void visit(final ClassOrInterfaceDeclaration n, final A arg) {
   visitComment(n.getComment(), arg);
   visitAnnotations(n, arg);
   n.getNameExpr().accept(this, arg);
   for (final TypeParameter t : n.getTypeParameters()) {
     t.accept(this, arg);
   }
   for (final ClassOrInterfaceType c : n.getExtends()) {
     c.accept(this, arg);
   }
   for (final ClassOrInterfaceType c : n.getImplements()) {
     c.accept(this, arg);
   }
   for (final BodyDeclaration<?> member : n.getMembers()) {
     member.accept(this, arg);
   }
 }
 @Override
 public void visit(final EnumDeclaration n, final A arg) {
   visitComment(n.getComment(), arg);
   visitAnnotations(n, arg);
   n.getNameExpr().accept(this, arg);
   if (n.getImplements() != null) {
     for (final ClassOrInterfaceType c : n.getImplements()) {
       c.accept(this, arg);
     }
   }
   if (n.getEntries() != null) {
     for (final EnumConstantDeclaration e : n.getEntries()) {
       e.accept(this, arg);
     }
   }
   if (n.getMembers() != null) {
     for (final BodyDeclaration<?> member : n.getMembers()) {
       member.accept(this, arg);
     }
   }
 }
Example #6
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);
 }