updated javaodoc SiedlerBoard
This commit is contained in:
		
							parent
							
								
									0386d43529
								
							
						
					
					
						commit
						20d73bd5e0
					
				| 
						 | 
				
			
			@ -25,7 +25,7 @@ public class SiedlerBoard extends HexBoard<Config.Land, Settlement, Road, String
 | 
			
		|||
     */
 | 
			
		||||
    private final HashMap<Point, Field> fields = new HashMap<>();
 | 
			
		||||
    private Config.Faction longestRoadFaction = null;
 | 
			
		||||
    private int longestRoadLenth = 0;
 | 
			
		||||
    private int longestRoadLength = 0;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Method to create the predefined game field from Config.
 | 
			
		||||
| 
						 | 
				
			
			@ -47,6 +47,15 @@ public class SiedlerBoard extends HexBoard<Config.Land, Settlement, Road, String
 | 
			
		|||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Get Paramter longestRoad
 | 
			
		||||
     *
 | 
			
		||||
     * @return longestRoadLength
 | 
			
		||||
     */
 | 
			
		||||
    public int getLongestRoadLength() {
 | 
			
		||||
        return longestRoadLength;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Method to get the DiceNumber of a specific field.
 | 
			
		||||
     *
 | 
			
		||||
| 
						 | 
				
			
			@ -132,10 +141,9 @@ public class SiedlerBoard extends HexBoard<Config.Land, Settlement, Road, String
 | 
			
		|||
        }
 | 
			
		||||
        return List.of(lands);
 | 
			
		||||
    }
 | 
			
		||||
//TODO Java Doc more details
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * This method checks for the player with the longest road according to the siedler game rules.
 | 
			
		||||
     * This method checks for the player with the longest road according to the Siedler game rules.
 | 
			
		||||
     *
 | 
			
		||||
     * @param factionList a List with all factions which can place structures on the board
 | 
			
		||||
     * @return the faction who owns the longest road with minimum length of 5, null there is no road longer then 4
 | 
			
		||||
| 
						 | 
				
			
			@ -161,19 +169,14 @@ public class SiedlerBoard extends HexBoard<Config.Land, Settlement, Road, String
 | 
			
		|||
        }
 | 
			
		||||
 | 
			
		||||
        for (Config.Faction factionA : players.keySet()) {
 | 
			
		||||
            if (players.get(factionA) > longestRoadLenth && players.get(factionA) > 4) {
 | 
			
		||||
            if (players.get(factionA) > longestRoadLength && players.get(factionA) > 4) {
 | 
			
		||||
                longestRoadFaction = factionA;
 | 
			
		||||
                longestRoadLenth = players.get(factionA);
 | 
			
		||||
                longestRoadLength = players.get(factionA);
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
        return longestRoadFaction;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    //todo javadoc
 | 
			
		||||
    public int getLongestRoadLenth() {
 | 
			
		||||
        return longestRoadLenth;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * This method is recursive and adds all roads which belongs to a specific players and stringing together to a HashSet.
 | 
			
		||||
     * The length of the HashSet represents the length of the longest Road the player has.
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -41,7 +41,7 @@ public class SiedlerBoardTest {
 | 
			
		|||
            System.out.println(board.getTextView());
 | 
			
		||||
 | 
			
		||||
            assertEquals(Config.Faction.BLUE, board.getLongestRoadFaction(factionList));
 | 
			
		||||
            assertEquals(6, board.getLongestRoadLenth());
 | 
			
		||||
            assertEquals(6, board.getLongestRoadLength());
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        @Test
 | 
			
		||||
| 
						 | 
				
			
			@ -50,7 +50,7 @@ public class SiedlerBoardTest {
 | 
			
		|||
            System.out.println(board.getTextView());
 | 
			
		||||
 | 
			
		||||
            assertEquals(Config.Faction.BLUE, board.getLongestRoadFaction(factionList));
 | 
			
		||||
            assertEquals(5, board.getLongestRoadLenth());
 | 
			
		||||
            assertEquals(5, board.getLongestRoadLength());
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue