Package es.mahulo.battleship.model

Examples of es.mahulo.battleship.model.Ship


  public void addShipTest() {
   
    Client c = Client.create();
    WebResource r = c.resource("http://localhost:8080/BattleShip/rest/game/addship/1802");
   
    Ship ship = new Ship();
    ArrayList<Cell> cells = new ArrayList<Cell>();
    ship.setCells(cells);
   
    ArrayList<Ship> ships = new ArrayList<Ship>();
    ships.add(ship);
   
    ArrayShip arrayShip = new ArrayShip();
View Full Code Here


    Cell cell5 = new Cell();
    cell5.setX(9);
    cell5.setY(5);
    cells.add(cell5);
    
    Ship ship1 = new Ship();
    ship1.setShipConfig(shipConfig1);
    ship1.setCells(cells);
   
    ships.add(ship1);
   
   
    cells = new ArrayList<Cell>();
    Cell cell6 = new Cell();
    cell6.setX(7);
    cell6.setY(4);
    cells.add(cell6);
   
   
    Cell cell7 = new Cell();
    cell7.setX(7);
    cell7.setY(5);
    cells.add(cell7);

    Cell cell8 = new Cell();
    cell8.setX(7);
    cell8.setY(6);
    cells.add(cell8);

    Cell cell9 = new Cell();
    cell9.setX(7);
    cell9.setY(7);
    cells.add(cell9);
   
    
    Ship ship2 = new Ship();
    ship2.setShipConfig(shipConfig2);
    ship2.setCells(cells);
   
    ships.add(ship2);


    cells = new ArrayList<Cell>();
   
   
    Cell cell11 = new Cell();
    cell11.setX(2);
    cell11.setY(6);
    cells.add(cell11);

    Cell cell12 = new Cell();
    cell12.setX(3);
    cell12.setY(6);
    cells.add(cell12);

    Cell cell13 = new Cell();
    cell13.setX(4);
    cell13.setY(6);
    cells.add(cell13);

    Ship ship3 = new Ship();
    ship3.setShipConfig(shipConfig3);
    ship3.setCells(cells);
   
    ships.add(ship3);
   

   
    cells = new ArrayList<Cell>();
    Cell cell14 = new Cell();
    cell14.setX(1);
    cell14.setY(1);
    cells.add(cell14);
   
   
    Cell cell15 = new Cell();
    cell15.setX(1);
    cell15.setY(2);
    cells.add(cell15);

    Ship ship4 = new Ship();
    ship4.setShipConfig(shipConfig4);
    ship4.setCells(cells);
   
    ships.add(ship4);

    cells = new ArrayList<Cell>();
    Cell cell16 = new Cell();
    cell16.setX(3);
    cell16.setY(4);
    cells.add(cell16);
   
   
    Cell cell17 = new Cell();
    cell17.setX(4);
    cell17.setY(4);
    cells.add(cell17);

    Ship ship5 = new Ship();
    ship5.setShipConfig(shipConfig4);
    ship5.setCells(cells);
   
    ships.add(ship5);

   

    cells = new ArrayList<Cell>();
    Cell cell18 = new Cell();
    cell18.setX(3);
    cell18.setY(2);
    cells.add(cell18);
   

    Ship ship6 = new Ship();
    ship6.setShipConfig(shipConfig5);
    ship6.setCells(cells);
   
    ships.add(ship6);
   

    cells = new ArrayList<Cell>();
    Cell cell19 = new Cell();
    cell19.setX(1);
    cell19.setY(8);
    cells.add(cell19);
   
   

    Ship ship7 = new Ship();
    ship7.setShipConfig(shipConfig5);
    ship7.setCells(cells);
   
    ships.add(ship7);
   
   
   
View Full Code Here

    Cell cell5 = new Cell();
    cell5.setX(9);
    cell5.setY(5);
    cells.add(cell5);
    
    Ship ship1 = new Ship();
    ship1.setShipConfig(shipConfig1);
    ship1.setCells(cells);
   
    ships.add(ship1);
   
   
    cells = new ArrayList<Cell>();
    Cell cell6 = new Cell();
    cell6.setX(7);
    cell6.setY(4);
    cells.add(cell6);
   
   
    Cell cell7 = new Cell();
    cell7.setX(7);
    cell7.setY(5);
    cells.add(cell7);

    Cell cell8 = new Cell();
    cell8.setX(7);
    cell8.setY(6);
    cells.add(cell8);

    Cell cell9 = new Cell();
    cell9.setX(7);
    cell9.setY(7);
    cells.add(cell9);
   
    
    Ship ship2 = new Ship();
    ship2.setShipConfig(shipConfig2);
    ship2.setCells(cells);
   
    ships.add(ship2);


    cells = new ArrayList<Cell>();
   
   
    Cell cell11 = new Cell();
    cell11.setX(2);
    cell11.setY(6);
    cells.add(cell11);

    Cell cell12 = new Cell();
    cell12.setX(3);
    cell12.setY(6);
    cells.add(cell12);

    Cell cell13 = new Cell();
    cell13.setX(4);
    cell13.setY(6);
    cells.add(cell13);

    Ship ship3 = new Ship();
    ship3.setShipConfig(shipConfig3);
    ship3.setCells(cells);
   
    ships.add(ship3);
   

   
    cells = new ArrayList<Cell>();
    Cell cell14 = new Cell();
    cell14.setX(1);
    cell14.setY(1);
    cells.add(cell14);
   
   
    Cell cell15 = new Cell();
    cell15.setX(1);
    cell15.setY(2);
    cells.add(cell15);

    Ship ship4 = new Ship();
    ship4.setShipConfig(shipConfig4);
    ship4.setCells(cells);
   
    ships.add(ship4);

    cells = new ArrayList<Cell>();
    Cell cell16 = new Cell();
    cell16.setX(3);
    cell16.setY(4);
    cells.add(cell16);
   
   
    Cell cell17 = new Cell();
    cell17.setX(4);
    cell17.setY(4);
    cells.add(cell17);

    Ship ship5 = new Ship();
    ship5.setShipConfig(shipConfig4);
    ship5.setCells(cells);
   
    ships.add(ship5);

   

    cells = new ArrayList<Cell>();
    Cell cell18 = new Cell();
    cell18.setX(3);
    cell18.setY(2);
    cells.add(cell18);
   

    Ship ship6 = new Ship();
    ship6.setShipConfig(shipConfig5);
    ship6.setCells(cells);
   
    ships.add(ship6);
   

    cells = new ArrayList<Cell>();
    Cell cell19 = new Cell();
    cell19.setX(1);
    cell19.setY(8);
    cells.add(cell19);
   
   

    Ship ship7 = new Ship();
    ship7.setShipConfig(shipConfig5);
    ship7.setCells(cells);
   
    ships.add(ship7);
   
   
   
View Full Code Here

  @Test(expected=ShipExecption.class) public void isConfigOkNoCellsTest() throws ShipExecption {
    Config configService = new ConfigImpl();

    List<Cell> cells = new ArrayList<Cell>();
    
    Ship ship = new Ship();
    ship.setShipConfig(shipConfigs.get(0));
    ship.setCells(cells);
   
    Player player = new Player();
    player.setShips(new ArrayList<Ship>());
   
    configService.isValid(game, player,ship);
View Full Code Here

    cell1.setX(9);
    cell1.setY(1);
    cells.add(cell1);
   

    Ship ship = new Ship();
    ship.setId(1L);
    ship.setShipConfig(shipConfigs.get(0));
    ship.setCells(cells);
   
    Player player = new Player();
    player.setShips(new ArrayList<Ship>());
   
    configService.isValid(game, player,ship);
View Full Code Here

    Game game = new Game();
    game.setStatus(GameStatus.Configuring);
    game.setGameConfig(gameConfig);
    game.setPlayers(players);
   
    Ship ship = buildShip(shipConfigs.get(0), cellShip1);
    
   
    configService.isValid(game, player,ship);
  }
View Full Code Here

    cell.setX(11);
    cell.setY(1);
    cells.add(cell);

    List<Ship> ships = new ArrayList<Ship>();
    Ship ship = new Ship();
    ship.setShipConfig(shipConfigs.get(0));
    ship.setCells(cells);
    ships.add(ship);
   
    Player player = new Player();
    player.setShips(new ArrayList<Ship>());
   
View Full Code Here

    Cell cell1 = new Cell();
    cell1.setX(9);
    cell1.setY(1);
    cells.add(cell1);
   
    Ship playerShip = new Ship();
    playerShip.setShipConfig(shipConfigs.get(4));
    playerShip.setCells(cells);
   
    List<Ship> ships = new ArrayList<Ship>();
    ships.add(playerShip);
   
    Player player = new Player();
    player.setId(1L);
    player.setShips(ships);
   
   
    cells = new ArrayList<Cell>();
    Cell cell2 = new Cell();
    cell1.setX(10);
    cell1.setY(2);
    cells.add(cell2);
   
    Ship ship = new Ship();
   
    configService.isValid(game, player,ship);
  }
View Full Code Here

   
    Player player = new Player();
    player.setId(1L);
    player.setShips(playerShips);
   
    Ship ship = buildShip(shipConfigs.get(4),cellShip7);
   
    configService.isValid(game, player,ship);
  }
View Full Code Here

      cell.setY(positions[i][1]);
      cells.add(cell);
     
    }
    
    Ship ship = new Ship();
   
    ship.setShipConfig(shipConfig);
    ship.setCells(cells);

   
    return ship;
  }
View Full Code Here

TOP

Related Classes of es.mahulo.battleship.model.Ship

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.