Example #1
0
 public Phrase(String s, int x, int y, Color c, WebLEAPFrame g) {
   x1 = x;
   y1 = y;
   color = c;
   gui = g;
   canvas = gui.getVisualizer();
   font = new Font("Dialog", 0, 14);
   fmetrics = canvas.getFontMetrics(font);
   text = s;
 }
Example #2
0
 /** Runs the agent. */
 public void run() {
   while (status != Action.DIE) {
     status = Action.CONTINUE;
     Percept p = architecture.sense(this);
     if (visualizer != null) {
       visualizer.show(this, p);
     }
     Action action = program.compute(p);
     if (status != Action.ABORT) {
       architecture.act(this, action);
     }
   }
 }
  public void test() throws InterruptedException {
    children.doSetKeys(new String[] {"1", "2"});
    Node[] nodes = children.getNodes();
    AwtRun run = new AwtRun();
    SwingUtilities.invokeLater(run);
    while (ab.get() == false) {
      Thread.sleep(50);
    }
    children.doSetKeys(new String[] {"1", "3", "2"});
    children.doSetKeys(new String[] {"3", "2", "1"});
    ab.set(false);
    while (ab.get() == false) {
      Thread.sleep(50);
    }
    VisualizerNode vn = (VisualizerNode) Visualizer.findVisualizer(nodes[0]);

    assertTrue("Executed OK", run.ok);
  }
Example #4
0
  public static void main(String[] args) {
    try {
      if (args.length == 0)
        throw new Exception("Usage: java org.seage.problem.tsp.TourProvider {data-tsp-path}");

      long t0 = System.currentTimeMillis();

      System.out.println("Instance: " + args[0]);

      City[] cities = CityProvider.readCities(new FileInputStream(args[0]));

      System.out.println("Cities: " + cities.length);
      System.out.println();

      System.out.println("Read: " + (System.currentTimeMillis() - t0) + " ms");
      t0 = System.currentTimeMillis();

      Integer[] tour = createGreedyTour(cities);
      System.out.println("Creation: " + (System.currentTimeMillis() - t0) / 1000 + " s");
      t0 = System.currentTimeMillis();

      double tourLenght = getTourLenght(tour, cities);
      System.out.println("Evaluation: " + (System.currentTimeMillis() - t0) + " ms");
      t0 = System.currentTimeMillis();

      Visualizer.instance().createGraph(cities, tour, "tour.png", 1000, 1000);
      System.out.println("Visualization: " + (System.currentTimeMillis() - t0) + " ms");

      System.out.println();
      System.out.println("Tour lenght: " + tourLenght);
      System.out.println("Time: " + (System.currentTimeMillis() - t0) / 1000 + " s");

    } catch (Exception ex) {
      ex.printStackTrace();
    }
  }
Example #5
0
 public static void runTest() {
   SystemOut.println("TestReflection");
   Foo foo = new Foo();
   Visualizer.visualize("foo", foo.getClass(), foo);
 }
Example #6
0
 public void rebuildViz() {
   if (visualizer != null) {
     visualizer.rebuild();
   }
 }
Example #7
0
 public void refresh() {
   if (symbolPanel != null) {
     symbolPanel.refresh();
   }
   visualizer.rebuild();
 }