Package org.scotlandyard.engine.boardmap

Examples of org.scotlandyard.engine.boardmap.Link


    return new HashSet<Coordinate>(coordinates.values());
  }

  @Override
  public Link getLink(final String coordinateA, final String coordinateB) {
    Link link = null;
    for(Link l:this.links){
      if(l.getOtherEnd(getCoordinate(coordinateA))==getCoordinate(coordinateB)){
        link=l;
        break;
      }
View Full Code Here


    {
      nodeMap = linkList.item(i).getAttributes();
      final String toNode = nodeMap.getNamedItem("to").getNodeValue();
      final String fromNode = nodeMap.getNamedItem("from").getNodeValue();
      final TransportationMethod type = TransportationMethod.valueOf(nodeMap.getNamedItem("type").getNodeValue());
      final Link link = new LinkImpl(this, type, coordinates.get(toNode), coordinates.get(fromNode));
      links.add(link);
    }
  }
View Full Code Here

    game = GameImpl.getNewInstance("2", creator, boardMap);
    final Game game2 = GameImpl.getNewInstance("3", creator, boardMap);
    final Coordinate coor = new CoordinateImpl(boardMap, 1.1, 2.2);
    final Coordinate coor1 = new CoordinateImpl(boardMap, 1.6, 2.6);
    //Token token = new TokenImpl(detective, TransportationMethod.BUS);
    final Link route = new LinkImpl(boardMap, TransportationMethod.BUS, coor, coor1);
    //token.setNumberOfTickets(10);

    detective.setTokens(game, TransportationMethod.BUS, 10);
    final Token token = detective.getTokens(game).get(TransportationMethod.BUS);
View Full Code Here

        );
  }

  @Test//TODO add description here
  public void testCreateLinkBoardMapTransportationMethodDoubleDoubleDoubleDouble() throws GameException{
    final Link link =BoardMapFactory.createLink(TransportationMethod.UG, 0, 1, 2, 3);
    final Coordinate coordinateA  = link.getCoordinateA();
    final Coordinate coordinateB  = link.getCoordinateB();
    assertNotNull(
        "the link map should not be null",
        link.getBoardMap()
        );
    assertNotNull(
        "the coordinate map should not be null",
        coordinateA.getBoardMap()
        );
View Full Code Here

  @Test//TODO add description here
  public void testCreateLinkTransportationMethodCoordinateCoordinate() throws GameException{
    final Coordinate cA  = BoardMapFactory.createCoordinate(0,1);
    final Coordinate cB  = BoardMapFactory.createCoordinate(2,3);
    final Link link =BoardMapFactory.createLink(TransportationMethod.UG, cA, cB);
    final Coordinate coordinateA  = link.getCoordinateA();
    final Coordinate coordinateB  = link.getCoordinateB();
    assertNotNull(
        "the link map should not be null",
        link.getBoardMap()
        );
    assertNotNull(
        "the coordinate map should not be null",
        coordinateA.getBoardMap()
        );
View Full Code Here

    GameEngine.instance().getBoardMaps().remove("Auckland");
  }
 
  @Test//TODO add description here
  public final void testEqualsObject() throws GameException{
    Link other = new LinkImpl(boardMap, TransportationMethod.BUS, a, b);
    Assert.assertTrue(link.equals(other));
    Link other2 = new LinkImpl(boardMap, TransportationMethod.TAXI, a, b);
    Assert.assertFalse(link.equals(other2));
    Link other3 = new LinkImpl(boardMap, TransportationMethod.BUS, a, new CoordinateImpl(boardMap,11,22));
    Assert.assertFalse(link.equals(other3));
    Link other4 = new LinkImpl(boardMap, TransportationMethod.BUS, new CoordinateImpl(boardMap,11,20), b);
    Assert.assertFalse(link.equals(other4));
  }
View Full Code Here

TOP

Related Classes of org.scotlandyard.engine.boardmap.Link

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.