コード例 #1
0
  public void addCategory(
      String category, String variableIdent, TypeSpecification element, TypeBody declarationType)
      throws JselException {

    ListOfCategories typeLoc = null;

    if (declarationType != null) {
      typeLoc = (ListOfCategories) allCategorizedClasses.get(declarationType.getFcn());

      // !! job: what happens with missing categories??
      if (typeLoc == null) {
        //		typeLoc = new ListOfCategories( declarationType.getFcn(  );
        //		allCategorizedClasses.put( declarationType.getFcn(), typeLoc );
      } else {

        // !! put in here (and all category constructors a complexity helper method
        typeLoc.add(
            new ArchitecturalCategory(
                ((SourceMarker) element).getSourceURL(),
                ((SourceMarker) element).getLine(),
                ((SourceMarker) element).getColumn(),
                variableIdent,
                category));
      }
    }
  }
コード例 #2
0
  public void visit(Method p) {
    // !! detect Connection >> prepareCall( )

    int start = p.getAst().getFirstToken().getLine();
    int end = p.getAst().getLastToken().getLine();
    TypeBody enclosingType = p.getEnclosingType();
    final String fcn = enclosingType.getFcn();

    if (((end - start) < 3)
        && (p.getName().toString().startsWith("get") || p.getName().toString().startsWith("set"))) {
      try {
        String keyGetterSetter = fcn + GETTERSETTER;
        Integer getterCounter = (Integer) allGetterSetterCounterForClasses.get(keyGetterSetter);
        if (getterCounter == null) {
          allGetterSetterCounterForClasses.put(keyGetterSetter, new Integer(1));
          ListOfCategories typeLoc = (ListOfCategories) allCategorizedClasses.get(fcn);
          if (typeLoc != null) {
            typeLoc.setType(fcn);
          }
        } else {
          allGetterSetterCounterForClasses.put(
              keyGetterSetter, new Integer(getterCounter.intValue() + 1));
        }
      } catch (Exception e) {
        e.printStackTrace();
      }

    } else {
      try {
        Integer getterCounter = (Integer) allGetterSetterCounterForClasses.get(fcn);
        if (getterCounter == null) {
          allGetterSetterCounterForClasses.put(fcn, new Integer(1));
          ListOfCategories typeLoc = (ListOfCategories) allCategorizedClasses.get(fcn);
          if (typeLoc != null) {
            typeLoc.setType(fcn);
          }
        } else {
          allGetterSetterCounterForClasses.put(fcn, new Integer(getterCounter.intValue() + 1));
        }
      } catch (Exception e) {
        e.printStackTrace();
      }
    }
  }