Package cz.matfyz.aai.fantom.message

Examples of cz.matfyz.aai.fantom.message.MessageMove


   
    ActorMove[] moves = new ActorMove[] {
        new ActorMove(fantomas, n2, null),
        new ActorMove(joker, n1, null)
    };
    g.placeActors(new MessageMove(moves));
    moves = new ActorMove[] {
        new ActorMove(poirot, n3, null),
        new ActorMove(batman, n4, null)
    };
    g.placeActors(new MessageMove(moves));
   
    assertSame(n2, fantomas.getCurrentPosition());
    assertSame(n1, joker.getCurrentPosition());
    assertSame(n3, poirot.getCurrentPosition());
    assertSame(n4, batman.getCurrentPosition());
   
    assertEquals(1, fantomas.getNumberOfTickets(tram));
    assertEquals(1, fantomas.getNumberOfTickets(bus));
    assertEquals(0, fantomas.getNumberOfTickets(universal));
   
    assertEquals(1, joker.getNumberOfTickets(tram));
    assertEquals(1, joker.getNumberOfTickets(bus));
    assertEquals(0, fantomas.getNumberOfTickets(universal));
   
    moves = new ActorMove[] {
        new ActorMove(fantomas, n1, tram),
        new ActorMove(joker, n6, bus)
    };
    try {
      g.moveActors(g.getActors(ClientType.PHANTOM), new MessageMove(moves));
      fail("Movement message verification failed - phantoms moved in wrong order");
    }
    catch(ProtocolException e) {
    }
  }
View Full Code Here


   
    ActorMove[] moves = new ActorMove[] {
        new ActorMove(fantomas, n2, null),
        new ActorMove(joker, n1, null)
    };
    g.placeActors(new MessageMove(moves));
    moves = new ActorMove[] {
        new ActorMove(poirot, n4, null),
        new ActorMove(batman, n3, null),
        new ActorMove(japp, n5, null),
    };
    g.placeActors(new MessageMove(moves));
   
    assertSame(n2, fantomas.getCurrentPosition());
    assertSame(n1, joker.getCurrentPosition());
    assertSame(n4, poirot.getCurrentPosition());
    assertSame(n3, batman.getCurrentPosition());
    assertSame(n5, japp.getCurrentPosition());
   
    moves = new ActorMove[] {
        new ActorMove(batman, n2, bus),
        new ActorMove(japp, n6, tram),
    };
    g.moveActors(g.getActors(ClientType.DETECTIVE), new MessageMove(moves));
   
    assertSame(n4, poirot.getCurrentPosition());
    assertSame(n2, batman.getCurrentPosition());
    assertSame(n6, japp.getCurrentPosition());
   
    moves = new ActorMove[] {
        new ActorMove(batman, n3, bus),
        new ActorMove(japp, n5, tram),
    };
    try {
      g.moveActors(g.getActors(ClientType.DETECTIVE), new MessageMove(moves));
      fail("Mesage verification failed - one of the detectives did not move");
    }
    catch(ProtocolException e) {     
    }
  }
View Full Code Here

      moves = agent.move();
    else {
      moves = agent.place();
      sentPlacement = true;
    }
    MessageMove msg = new MessageMove(moves);
   
    sendMessage(msg);
   
    // Re-load the message for this graph
    msg = new MessageMove(graph, msg.serialize());
    graph.updateActors(msg);
  }
View Full Code Here

   *
   * @throws ServerException if the message to the server was not sent.
   */
  protected void sendPlacement() throws ServerException {
    ActorMove[] moves = agent.move();
    MessageMove msg = new MessageMove(moves);
   
    sendMessage(msg);
   
    msg = new MessageMove(graph, msg.serialize());
    graph.placeActors(msg);
  }
View Full Code Here

TOP

Related Classes of cz.matfyz.aai.fantom.message.MessageMove

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.