예제 #1
0
  @Override
  public void visit(ConstructorDeclaration n, Object arg) {

    Set<String> consParaSet = new HashSet<String>();
    List<String> consParalist = new ArrayList<String>();

    currentConstructorMeta = new ConstructorMeta();
    currentConstructorMeta.constructorName = n.getName();
    currentConstructorMeta.constructorModifier = Modifier.toString(n.getModifiers());

    if (n.getParameters() != null) {
      for (int i = 0; i < n.getParameters().size(); i++) {

        String consPara = n.getParameters().get(i).toString();
        consParalist.add(consPara);
        String[] strings = consPara.split(" ");

        String consParaKey = currentConstructorMeta.constructorName;

        if (MapAndSet.constructorMap.containsKey(consParaKey)) {

          MapAndSet.constructorMap.get(consParaKey).add(consPara);
          MapAndSet.constructorMap.put(consParaKey, consParaSet);

        } else {
          consParaSet.add(consPara);
          MapAndSet.constructorMap.put(consParaKey, consParaSet);
        }

        String usesOrInterfaceKey = strings[0] + "," + currentConstructorMeta.constructorName;

        if (MapAndSet.usesMap.containsKey(usesOrInterfaceKey)) {

          //                    MapAndSet.usesOrInterfaceValue =
          // MapAndSet.usesMap.get(usesOrInterfaceKey);
          //                    MapAndSet.usesOrInterfaceValue =
          // MapAndSet.arrowsUpdate(MapAndSet.usesOrInterfaceValue, Arrows.uses.toString());
          //                    MapAndSet.usesOrInterfaceMap.put(usesOrInterfaceKey,
          // MapAndSet.usesOrInterfaceValue);

        } else if (!MapAndSet.usesMap.containsKey(usesOrInterfaceKey)) {

          MapAndSet.usesMap.put(usesOrInterfaceKey, Arrows.uses.toString());
        }
      }

      currentConstructorMeta.parameterList = consParalist;
      currentMeta.constructorMetas.add(currentConstructorMeta);

    } else {

      System.out.println("to check the ecnomy");
      currentMeta.constructorMetas.add(currentConstructorMeta);
    }

    MapAndSet.classMetaMap.put(MapAndSet.className, currentMeta);
  }
예제 #2
0
 @Override
 public List<Parameter> getParameters() {
   return declaration
       .getParameters()
       .stream()
       .map(
           (parameter) ->
               new Parameter(
                   getContext().resolve(parameter.getType()), parameter.getId().getName()))
       .collect(Collectors.toList());
 }
 @Override
 public void visit(final ConstructorDeclaration 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.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);
     }
   }
   n.getBody().accept(this, arg);
 }
예제 #4
0
  @Override
  public Boolean visit(final ConstructorDeclaration n1, final Node arg) {
    final ConstructorDeclaration n2 = (ConstructorDeclaration) arg;

    // javadoc are checked at CompilationUnit

    if (n1.getModifiers() != n2.getModifiers()) {
      return Boolean.FALSE;
    }

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

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

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

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

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

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

    return Boolean.TRUE;
  }