Package hermes.postoffice

Examples of hermes.postoffice.PostOffice


    applet.rectMode(PApplet.CENTER);
  }
 
  @Test
  public void test_SelfInteractionOptimizer() {
    World world = new World(new PostOffice(), new HCamera());
    Group<OptTestBeing> group = new Group<OptTestBeing>(world);
    for(int i = 0; i < 100; i++) {
      group.add(new OptTestBeing());
    }
    world.update();
View Full Code Here


    }
  }
 
  @Test
  public void test_SelfInterOptPerformance() {
    World world = new World(new PostOffice(), new HCamera());
    Group<OptTestBeing> group = new Group<OptTestBeing>(world);
    for(int i = 0; i < 10000; i++) {
      group.add(new OptTestBeing());
    }
    world.update();
    world.register(group, group, new OptTestInter());
    long time = System.nanoTime();
    world.update();
    long elapsed = System.nanoTime() - time;
    System.out.println("Time for 10000 unoptimized rectangle collisions: " + elapsed);
   
    world = new World(new PostOffice(), new HCamera());
    group.setWorld(world);
    world.register(group, group, new OptTestInter(),
        new SelfInteractionOptimizer<OptTestBeing>());
    time = System.nanoTime();
    world.update();
View Full Code Here

 
  /**
   * Constructor that automatically creates PostOffice and HCamera
   */
   public World() {
     this(new PostOffice(), new HCamera());
   }
View Full Code Here

  
   /**
    * Constructor that automatically creates PostOffice
    */
   public World(HCamera view) {
     this(new PostOffice(), view);
   }
View Full Code Here

  
   /**
    * Constructor that automatically creates PostOffice and HCamera, and sets up OSC
    */
    public World(int portIn, int portOut) {
      this(new PostOffice(portIn, portOut), new HCamera());
    }
View Full Code Here

   
    /**
     * Constructor that automatically creates PostOffice and sets up OSC
     */
    public World(int portIn, int portOut, HCamera view) {
      this(new PostOffice(portIn, portOut), view);
    }
View Full Code Here

    assertTrue(tw2.shutdownCalled);
  }
 
  @Test
  public void test_groupOperations() {
    World w = new World(new PostOffice(), new HCamera());
    Group<Being> g1 = new Group<Being>(w);
    // group add
    TestBeing1 tb1 = new TestBeing1();
    g1.add(tb1);
    assertFalse(g1.getObjects().contains(tb1));
View Full Code Here

   
  }
 
  @Test
  public void test_interactions() {
    World w = new World(new PostOffice(), new HCamera());
    TestBeing2 b1 = new TestBeing2();
    TestBeing2 b2 = new TestBeing2();
    w.register(b1, b2, new TestInteractor1());
    w.update();
    w.update();
    assertTrue(b1.interacted);
    assertTrue(b2.interacted);
    w = new World(new PostOffice(), new HCamera());
    b1 = new TestBeing2();
    b2 = new TestBeing2();
    w.register(b1, b2, new TestInteractor1());
    w.update();
    w.update();
    assertTrue(b1.interacted);
    assertTrue(b2.interacted);
    w = new World(new PostOffice(), new HCamera());
    b1 = new TestBeing2();
    b2 = new TestBeing2();
    w.register(b1, b2, new TestInteractor2());
    w.update();
    w.update();
View Full Code Here

    assertFalse(b2.interacted);
  }
 
  @Test
  public void test_multisampledInteractions() {
    World w = new World(new PostOffice(), new HCamera());
    Group<TestBeing3> g1 = new Group<TestBeing3>(w);
    Group<TestBeing3> g2 = new Group<TestBeing3>(w);
    TestBeing3[] beings = new TestBeing3[7];
    g1.add(beings[0] = new TestBeing3(1,0));
    g1.add(beings[1] = new TestBeing3(2,1));
View Full Code Here

    assertEquals(beings[5].getInteractionsWith(beings[1]), 3);
  }
 
  @Test
  public void test_LockUpdateRate() {
    World w = new World(new PostOffice(), new HCamera());
    w.lockUpdateRate(5);
    long time = System.currentTimeMillis();
    w.update();
    long elapsed = System.currentTimeMillis() - time;
    assertEquals(elapsed,200,5);
View Full Code Here

TOP

Related Classes of hermes.postoffice.PostOffice

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.