Exemple #1
0
  public static void explode(String name, int typeLevel, int snapLevel, Obj obj, Obj excluded) {
    GraphViz typeDiagram = new GraphViz();
    GraphViz objDiagram = new GraphViz();
    GraphViz snapshotDiagram = new GraphViz();
    Vector<Obj> typeLimited = new Vector<Obj>();
    Vector<Obj> snapLimited = new Vector<Obj>();
    Vector<Obj> objLimited = new Vector<Obj>();

    send(typeWalker, "reset");
    send(objWalker, "reset");
    send(snapshotWalker, "reset");
    set(typeWalker, "excluded", excluded);
    set(snapshotWalker, "excluded", excluded);
    set(objWalker, "excluded", excluded);
    set(typeWalker, "limit", Int(typeLevel));
    set(snapshotWalker, "limit", Int(snapLevel));
    set(objWalker, "limit", Int(1));
    set(
        typeWalker,
        "limitHandler",
        Op(
            (o) -> {
              typeLimited.add(o);
              return o;
            }));
    set(
        snapshotWalker,
        "limitHandler",
        Op(
            (o) -> {
              snapLimited.add(o);
              return o;
            }));
    set(
        objWalker,
        "limitHandler",
        Op(
            (o) -> {
              objLimited.add(o);
              return o;
            }));

    diagram = typeDiagram;
    send(typeWalker, "walk", obj);
    diagram = objDiagram;
    send(objWalker, "walk", obj);
    diagram = snapshotDiagram;
    send(snapshotWalker, "walk", obj);
    for (Obj o : typeLimited) if (!typeDiagram.hasNode(o)) typeDiagram.removeEdgesTo(o);
    for (Obj o : snapLimited) if (!snapshotDiagram.hasNode(o)) snapshotDiagram.removeEdgesTo(o);
    for (Obj o : objLimited) if (!objDiagram.hasNode(o)) objDiagram.removeEdgesTo(o);

    typeDiagram.graphViz("src/test/explode/" + name + "class.dot");
    objDiagram.graphViz("src/test/explode/" + name + "obj.dot");
    snapshotDiagram.graphViz("src/test/explode/" + name + "snap.dot");
  }
Exemple #2
0
 public static void generatediagram(Obj obj, String name) {
   GraphViz objDiagram = new GraphViz();
   Vector<Obj> limited = new Vector<Obj>();
   send(objWalker, "reset");
   set(objWalker, "limit", Int(2));
   set(
       snapshotWalker,
       "limitHandler",
       Op(
           (o) -> {
             limited.add(o);
             return o;
           }));
   diagram = objDiagram;
   send(objWalker, "walk", obj);
   for (Obj o : limited) if (!objDiagram.hasNode(o)) objDiagram.removeEdgesTo(o);
   objDiagram.graphViz("src/test/" + name + "obj.dot");
   System.out.println("Object Diagram Generated");
 }
Exemple #3
0
 public static void generateSnapshotContentsDiagram(Obj obj, String name, Obj excluded) {
   GraphViz snapshotDiagram = new GraphViz();
   Vector<Obj> limited = new Vector<Obj>();
   send(snapshotWalker, "reset");
   set(snapshotWalker, "excluded", excluded);
   set(snapshotWalker, "limit", Int(10));
   set(
       snapshotWalker,
       "limitHandler",
       Op(
           (o) -> {
             limited.add(o);
             return o;
           }));
   diagram = snapshotDiagram;
   for (Obj o : iterate(get(obj, "objects"))) send(snapshotWalker, "walk", o);
   for (Obj o : limited) if (!snapshotDiagram.hasNode(o)) snapshotDiagram.removeEdgesTo(o);
   snapshotDiagram.graphViz("src/test/" + name + "snap.dot");
   System.out.println("Snapshot Diagram Generated");
 }