Package es.mahulo.battleship.model

Examples of es.mahulo.battleship.model.Cell


   
    List<Ship> ships = new ArrayList<Ship>();
   
    List<Cell> cells = new ArrayList<Cell>();
    Cell cell1 = new Cell();
    cell1.setX(9);
    cell1.setY(1);
    cells.add(cell1);
   
    Cell cell2 = new Cell();
    cell2.setX(9);
    cell2.setY(2);
    cells.add(cell2);

    Cell cell3 = new Cell();
    cell3.setX(9);
    cell3.setY(3);
    cells.add(cell3);

    Cell cell4 = new Cell();
    cell4.setX(9);
    cell4.setY(4);
    cells.add(cell4);

    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();
View Full Code Here


   
    List<Ship> ships = new ArrayList<Ship>();
   
    List<Cell> cells = new ArrayList<Cell>();
    Cell cell1 = new Cell();
    cell1.setX(9);
    cell1.setY(1);
    cells.add(cell1);
   
    Cell cell2 = new Cell();
    cell2.setX(9);
    cell2.setY(2);
    cells.add(cell2);

    Cell cell3 = new Cell();
    cell3.setX(9);
    cell3.setY(3);
    cells.add(cell3);

    Cell cell4 = new Cell();
    cell4.setX(9);
    cell4.setY(4);
    cells.add(cell4);

    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();
View Full Code Here

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

    List<Cell> cells = new ArrayList<Cell>();
    Cell cell1 = new Cell();
    cell1.setX(9);
    cell1.setY(1);
    cells.add(cell1);
   

    Ship ship = new Ship();
    ship.setId(1L);
View Full Code Here

 
  @Test(expected=ShipExecption.class) public void isConfigOkOutSideBoardTest() throws ShipExecption {
    Config configService = new ConfigImpl();
   
    List<Cell> cells = new ArrayList<Cell>();
    Cell cell = new Cell();
    cell.setX(11);
    cell.setY(1);
    cells.add(cell);

    List<Ship> ships = new ArrayList<Ship>();
    Ship ship = new Ship();
    ship.setShipConfig(shipConfigs.get(0));
View Full Code Here

 
  @Test(expected=ShipExecption.class) public void isConfigOkCellIsUsedTest() throws ShipExecption {
    Config configService = new ConfigImpl();
   
    List<Cell> cells = new ArrayList<Cell>();
    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();
View Full Code Here

 
 
  private Ship buildShip(ShipConfig shipConfig,int [][] positions) {
    List<Cell> cells = new ArrayList<Cell>();
    for (int i=0; i< positions.length ;i++) {
      Cell cell = new Cell();
     
      cell.setX(positions[i][0]);
      cell.setY(positions[i][1]);
      cells.add(cell);
     
    }
    
    Ship ship = new Ship();
View Full Code Here

 
  private Ship buildShip(ShipConfig shipConfig,int [][] positions) {
    List<Cell> cells = new ArrayList<Cell>();
    for (int i=0; i< positions.length ;i++) {
      Cell cell = new Cell();
     
      cell.setX(positions[i][0]);
      cell.setY(positions[i][1]);
      cells.add(cell);
     
    }
    
    Ship ship = new Ship();
View Full Code Here

TOP

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

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.