@Override
 public void visit(final MethodDeclaration n, final A arg) {
   visitComment(n.getComment(), arg);
   visitAnnotations(n, arg);
   if (n.getTypeParameters() != null) {
     for (final TypeParameter t : n.getTypeParameters()) {
       t.accept(this, arg);
     }
   }
   n.getElementType().accept(this, arg);
   n.getNameExpr().accept(this, arg);
   if (n.getParameters() != null) {
     for (final Parameter p : n.getParameters()) {
       p.accept(this, arg);
     }
   }
   if (n.getThrows() != null) {
     for (final ReferenceType name : n.getThrows()) {
       name.accept(this, arg);
     }
   }
   if (n.getBody() != null) {
     n.getBody().accept(this, arg);
   }
 }
 @Override
 public void visit(final UnionType n, final A arg) {
   visitComment(n.getComment(), arg);
   visitAnnotations(n, arg);
   for (ReferenceType element : n.getElements()) {
     element.accept(this, arg);
   }
 }
Example #3
0
  @Override
  public Boolean visit(final ReferenceType n1, final Node arg) {
    final ReferenceType n2 = (ReferenceType) arg;

    if (n1.getArrayCount() != n2.getArrayCount()) {
      return Boolean.FALSE;
    }
    if (!nodeEquals(n1.getType(), n2.getType())) {
      return Boolean.FALSE;
    }
    if (!nodesEquals(n1.getAnnotations(), n2.getAnnotations())) {
      return Boolean.FALSE;
    }
    List<List<AnnotationExpr>> n1a = n1.getArraysAnnotations();
    List<List<AnnotationExpr>> n2a = n2.getArraysAnnotations();

    if (n1a != null && n2a != null) {
      if (n1a.size() != n2a.size()) {
        return Boolean.FALSE;
      } else {
        int i = 0;
        for (List<AnnotationExpr> aux : n1a) {
          if (!nodesEquals(aux, n2a.get(i))) {
            return Boolean.FALSE;
          }
          i++;
        }
      }
    } else if (n1a != n2a) {
      return Boolean.FALSE;
    }
    return Boolean.TRUE;
  }
Example #4
0
  @Override
  public Boolean visit(final UnionType n1, final Node arg) {
    final UnionType n2 = (UnionType) arg;

    List<ReferenceType> n1Elements = n1.getElements();
    List<ReferenceType> n2Elements = n2.getElements();

    if (n1Elements != null && n2Elements != null) {
      if (n1Elements.size() != n2Elements.size()) {
        return Boolean.FALSE;
      } else {
        int i = 0;
        for (ReferenceType aux : n1Elements) {
          if (aux.accept(this, n2Elements.get(i))) {
            return Boolean.FALSE;
          }
          i++;
        }
      }
    } else if (n1Elements != n2Elements) {
      return Boolean.FALSE;
    }
    return Boolean.TRUE;
  }