Skip to content

Commit

Permalink
fix typos
Browse files Browse the repository at this point in the history
  • Loading branch information
davi-bart committed Feb 16, 2024
1 parent 4f83f10 commit 1a0cfdc
Show file tree
Hide file tree
Showing 9 changed files with 25 additions and 26 deletions.
6 changes: 3 additions & 3 deletions src/main/java/it/unibo/controller/main/MainController.java
Original file line number Diff line number Diff line change
Expand Up @@ -58,13 +58,13 @@ public interface MainController {
void buildRoad(RoadPosition position);

/**
* The current player buys a developement card.
* The current player buys a development card.
*/
void buyCard();

/**
* @return whether the current player can build a settlement
* @param position where to build the settlemet
* @param position where to build the settlement
*/
boolean canBuildSettlement(PropertyPosition position);

Expand All @@ -81,7 +81,7 @@ public interface MainController {
boolean canBuildRoad(RoadPosition position);

/**
* @return whether the current player can buy a developement card.
* @return whether the current player can buy a development card.
*/
boolean canBuyCard();

Expand Down
2 changes: 1 addition & 1 deletion src/main/java/it/unibo/model/property/Property.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public interface Property {
PropertyType getPropertyType();

/**
* Upgrade a settlemet to city.
* Upgrade a settlement to city.
*/
void upgrade();
}
12 changes: 6 additions & 6 deletions src/main/java/it/unibo/model/property/PropertyManagerImpl.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,24 +15,24 @@
* Property manager implementation.
*/
public final class PropertyManagerImpl implements PropertyManager {
private final Set<Property> properies = new LinkedHashSet<>();
private final Set<Property> properties = new LinkedHashSet<>();

@Override
public void addSettlement(final PropertyPosition position, final Player player) {
if (properies.stream().anyMatch(r -> r.getPosition().equals(position))) {
if (properties.stream().anyMatch(r -> r.getPosition().equals(position))) {
throw new IllegalArgumentException("Settlement was already present");
}
properies.add(new PropertyImpl(position, player));
properties.add(new PropertyImpl(position, player));
}

@Override
public Set<Property> getPlayerProperties(final Player player) {
return properies.stream().filter(r -> r.getOwner().equals(player)).collect(Collectors.toSet());
return properties.stream().filter(r -> r.getOwner().equals(player)).collect(Collectors.toSet());
}

@Override
public void upgradeToCity(final PropertyPosition position) {
final Optional<Property> property = properies.stream().filter(p -> p.getPosition().equals(position))
final Optional<Property> property = properties.stream().filter(p -> p.getPosition().equals(position))
.findFirst();
if (property.isPresent()) {
property.get().upgrade();
Expand All @@ -41,7 +41,7 @@ public void upgradeToCity(final PropertyPosition position) {

@Override
public PropertyType getPropertyType(final PropertyPosition position) {
return properies.stream().filter(p -> p.getPosition().equals(position))
return properties.stream().filter(p -> p.getPosition().equals(position))
.findFirst().map(p -> p.getPropertyType()).orElse(PropertyType.EMPTY);
}

Expand Down
14 changes: 7 additions & 7 deletions src/main/java/it/unibo/model/resource/ResourceManagerImpl.java
Original file line number Diff line number Diff line change
Expand Up @@ -84,26 +84,26 @@ public Map<ResourceType, Integer> getResources(final ResourceOwner owner) {

@Override
public boolean canTrade(final ResourceOwner proposer, final ResourceOwner accepter,
final Map<ResourceType, Integer> proposedResouces,
final Map<ResourceType, Integer> proposedResources,
final Map<ResourceType, Integer> wantedResources) {
/**
*
*/
initializeResourceMap(proposedResouces);
initializeResourceMap(proposedResources);
initializeResourceMap(wantedResources);
if (proposedResouces.values().stream().allMatch(amount -> amount == 0)
if (proposedResources.values().stream().allMatch(amount -> amount == 0)
&& wantedResources.values().stream().allMatch(amount -> amount == 0)) {
return false;
}
if (!(hasResources(proposer, proposedResouces) && hasResources(accepter, wantedResources))) {
if (!(hasResources(proposer, proposedResources) && hasResources(accepter, wantedResources))) {
return false;
}
if (accepter.equals(bank)) {
return proposedResouces.values().stream().anyMatch(amount -> amount == 4)
&& proposedResouces.values().stream().mapToInt(i -> i).sum() == 4
return proposedResources.values().stream().anyMatch(amount -> amount == 4)
&& proposedResources.values().stream().mapToInt(i -> i).sum() == 4
&& wantedResources.values().stream().mapToInt(i -> i).sum() == 1;
}
return !(proposedResouces.values().stream().allMatch(amount -> amount == 0)
return !(proposedResources.values().stream().allMatch(amount -> amount == 0)
|| wantedResources.values().stream().allMatch(amount -> amount == 0));
}

Expand Down
2 changes: 1 addition & 1 deletion src/main/java/it/unibo/view/BoardView.java
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public BoardView(final MainController controller, final Map<String, Color> playe
this.controller = controller;
this.playerColors = playerColors;

// add the exagons and properties/road to the board
// add the hexagons and properties/road to the board
final Group group = new Group();
drawTiles();
group.getChildren().addAll(this.tiles.values());
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/it/unibo/view/CurrentPlayerView.java
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ private Button getRollButton() {
}

private Button getBuyCardButton() {
final Button buyCardButton = new Button("Buy developement card");
final Button buyCardButton = new Button("Buy development card");
buyCardButton.setOnAction(e -> {
if (controller.canBuyCard()) {
controller.buyCard();
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/it/unibo/view/Menu.java
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ public Scene getScene() throws IOException {
stage.close();
new AppViewImpl(stage, players).draw();
} else {
popUp.setHeaderText("You need atleast one player to start the game");
popUp.setHeaderText("You need at least one player to start the game");
popUp.showAndWait();
}

Expand Down
3 changes: 1 addition & 2 deletions src/main/java/it/unibo/view/ResourcesViewFactory.java
Original file line number Diff line number Diff line change
Expand Up @@ -57,12 +57,11 @@ public static VBox getResourceLabelAmount(final ResourceType resource, final int
}

/**
*
* @param resource resource type.
* @param amount amount of resource.
* @param listener action to perform on change.
* @return the image view of the needed resource with a combobox representing
* the amout.
* the amount.
*/
public static VBox resourceAndComboBox(final ResourceType resource, final int amount,
final ChangeListener<Integer> listener) {
Expand Down
8 changes: 4 additions & 4 deletions src/main/java/it/unibo/view/Utility.java
Original file line number Diff line number Diff line change
Expand Up @@ -61,14 +61,14 @@ public static Pair<Pair<Double, Double>, Pair<Double, Double>> getRoadCoordinate
}

/**
* returns the coordinates of the propertiy of an hexagon in the specified
* Calculates the coordinates of the property of an hexagon in the specified
* direction.
*
* @param radius radius
* @param radius radius of the hexagon
* @param x x coordinate of the center
* @param y y coordinate of the center
* @param direction direction of the property
* @return a map of properties, by their direction
* @return the coordinates of the property, in pixels
*/
public static Pair<Double, Double> getPropertyCoordinates(final double radius, final double x,
final double y, final PropertyDirection direction) {
Expand All @@ -78,7 +78,7 @@ public static Pair<Double, Double> getPropertyCoordinates(final double radius, f
}

/**
* returns the position of a tile in the board.
* Calculates the position of a tile in the board.
*
* @param row row
* @param col column
Expand Down

0 comments on commit 1a0cfdc

Please sign in to comment.