コード例 #1
0
 /**
  * Prior to fixing the bug, the contacts HashMap will accumulate entries even after resets; After
  * fixing the bug is should be cleared after a reset.
  */
 public void testBug526() {
   SensorTargetMediatorFactory.addMediator(CookieCutterSensor.class, SimpleTarget.class, mediator);
   CookieCutterSensor sensor = new CookieCutterSensor(999);
   Mover mover = new SimpleTarget(new java.awt.geom.Point2D.Double(0, 0), 999);
   mediator.doEnterRange(sensor, mover);
   assertEquals(1, mediator.contacts.size());
   sensor = new CookieCutterSensor(999);
   mover = new SimpleTarget(new java.awt.geom.Point2D.Double(0, 0), 999);
   mediator.doEnterRange(sensor, mover);
   assertEquals(2, mediator.contacts.size());
   Schedule.reset();
   assertEquals(0, mediator.contacts.size());
 }
コード例 #2
0
 public void go() {
   SimEntityBaseA a = new EntityA("A");
   SimEntityBaseA b = new EntityB("B");
   SimEntityBaseA c = new EntityC("C");
   System.out.println("SimEventMethods in " + a.getClass().toString() + ":");
   System.out.println(a.describeSimEventMethods());
   System.out.println("---------------");
   System.out.println("SimEventMethods in " + b.getClass().toString() + ":");
   System.out.println(b.describeSimEventMethods());
   System.out.println("---------------");
   System.out.println("SimEventMethods in " + c.getClass().toString() + ":");
   System.out.println(c.describeSimEventMethods());
   System.out.println("---------------");
   Schedule.reset();
   Schedule.setVerbose(true);
   Schedule.stopAtTime(5.0);
   Schedule.startSimulation();
 }