Пример #1
0
  // This method searches for the method specified to start the SD production.
  @Override
  public String[] getNewClasses(ISequence subM, int depth) {

    ArrayList<String> classesToAdd = new ArrayList<String>();

    if (depth > 0) {
      for (IClass clazz : Model.classes) {
        if (clazz.getName().equals(subM.getToClass())) {
          classesToAdd.add(subM.getFromClass());
          for (IMethod m : clazz.getMethods()) {
            if ((m.getName()).equals(subM.getCalledMethod())) {
              if (this.getArgumentsType(m.getDescription()).equals(subM.getArguments())) {
                classesToAdd.remove(subM.getFromClass());
                for (ISequence innerSM : m.getSubMethods()) {
                  classesToAdd.add(innerSM.getFromClass());
                  this.getNewClasses(innerSM, depth - 1);
                }
              }
            }
          }
        }
      }
    }

    return classesToAdd.toArray(new String[classesToAdd.size()]);
  }
Пример #2
0
 // This is the code where methods are called to generate the UML output.
 public void acceptUML(IVisitor v) {
   v.preVisit(this);
   for (IClass c : Model.classes) {
     c.acceptUML(v);
   }
   v.visit(this);
   v.postVisit(this);
 }
Пример #3
0
 public void acceptSpotters(IVisitor v) {
   v.preVisit(this);
   for (IClass c : Model.classes) {
     c.acceptSpotters(v);
   }
   v.visit(this);
   v.postVisit(this);
   System.out.println("maybe");
 }
Пример #4
0
  @Override
  public void acceptSequence(IVisitor v, int depth) {

    v.preVisit(this);
    for (IClass c : Model.classes) {
      c.acceptSequence(v, depth);
    }
    v.visit(this);
    v.postVisit(this);

    return;
  }
Пример #5
0
 @Override
 // pass in short name
 public IClass getNamedClass(String s) {
   if (s.contains("/")) {
     s = s.split("/")[s.split("/").length - 1];
   }
   if (s.contains(".")) {
     s = s.split("\\.")[s.split("\\.").length - 1];
   }
   for (IClass clazz : Model.classes) {
     if (clazz.getName().equals(s)) {
       return clazz;
     }
   }
   return null;
 }
Пример #6
0
 public void setClassNames(Collection<IClass> classes) {
   for (IClass c : classes) {
     Model.classNames.add(c.getName());
     Model.fullClassNames.add(c.getFullName());
   }
 }