Skip to content

Commit 29d0d85

Browse files
author
Arun Prasaad
committed
Improve naming
1 parent e4e2bcc commit 29d0d85

File tree

1 file changed

+15
-15
lines changed

1 file changed

+15
-15
lines changed

src/main/java/logic/Cell.java

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -24,16 +24,16 @@ public void setTileType(TileType tileType) {
2424
this.tileType = tileType;
2525
}
2626

27-
public void setAdjacentCellContent(Direction direction, TileType content) {
27+
public void setAdjacentCellType(Direction direction, TileType type) {
2828
switch (direction) {
29-
case UP -> warehouse.getCell(line - 1, column).setTileType(content);
30-
case DOWN -> warehouse.getCell(line + 1, column).setTileType(content);
31-
case LEFT -> warehouse.getCell(line, column - 1).setTileType(content);
32-
case RIGHT -> warehouse.getCell(line, column + 1).setTileType(content);
29+
case UP -> warehouse.getCell(line - 1, column).setTileType(type);
30+
case DOWN -> warehouse.getCell(line + 1, column).setTileType(type);
31+
case LEFT -> warehouse.getCell(line, column - 1).setTileType(type);
32+
case RIGHT -> warehouse.getCell(line, column + 1).setTileType(type);
3333
}
3434
}
3535

36-
public TileType getAdjacentCellContent(Direction direction) {
36+
public TileType getAdjacentCellType(Direction direction) {
3737
return switch (direction) {
3838
case UP -> warehouse.getCell(line - 1, column).getTileType();
3939
case DOWN -> warehouse.getCell(line + 1, column).getTileType();
@@ -51,17 +51,17 @@ public boolean canAcceptWorker(Direction direction) {
5151
if (boxCellCannotAcceptWorker(direction)) {
5252
return false;
5353
}
54-
switch (this.getAdjacentCellContent(direction)) {
54+
switch (this.getAdjacentCellType(direction)) {
5555
case UNSTORED_BOX, STORED_BOX, WALL, OUTSIDE -> {
5656
return false;
5757
}
5858
case STORAGE_AREA -> {
5959
this.setTileType(TileType.WORKER_ON_FLOOR);
60-
this.setAdjacentCellContent(direction, TileType.STORED_BOX);
60+
this.setAdjacentCellType(direction, TileType.STORED_BOX);
6161
}
6262
case FLOOR -> {
6363
this.setTileType(TileType.WORKER_ON_FLOOR);
64-
this.setAdjacentCellContent(direction, TileType.UNSTORED_BOX);
64+
this.setAdjacentCellType(direction, TileType.UNSTORED_BOX);
6565
}
6666
default -> {
6767
}
@@ -71,17 +71,17 @@ public boolean canAcceptWorker(Direction direction) {
7171
if (boxCellCannotAcceptWorker(direction)) {
7272
return false;
7373
}
74-
switch (this.getAdjacentCellContent(direction)) {
74+
switch (this.getAdjacentCellType(direction)) {
7575
case UNSTORED_BOX, WALL, STORED_BOX -> {
7676
return false;
7777
}
7878
case STORAGE_AREA -> {
7979
this.setTileType(TileType.WORKER_IN_STORAGE_AREA);
80-
this.setAdjacentCellContent(direction, TileType.STORED_BOX);
80+
this.setAdjacentCellType(direction, TileType.STORED_BOX);
8181
}
8282
case FLOOR -> {
8383
this.setTileType(TileType.WORKER_IN_STORAGE_AREA);
84-
this.setAdjacentCellContent(direction, TileType.UNSTORED_BOX);
84+
this.setAdjacentCellType(direction, TileType.UNSTORED_BOX);
8585
}
8686
default -> {
8787
}
@@ -93,13 +93,13 @@ public boolean canAcceptWorker(Direction direction) {
9393
}
9494
}
9595
Direction previous_player = direction.reverse();
96-
return switch (this.getAdjacentCellContent(previous_player)) {
96+
return switch (this.getAdjacentCellType(previous_player)) {
9797
case WORKER_ON_FLOOR -> {
98-
this.setAdjacentCellContent(previous_player, TileType.FLOOR);
98+
this.setAdjacentCellType(previous_player, TileType.FLOOR);
9999
yield true;
100100
}
101101
case WORKER_IN_STORAGE_AREA -> {
102-
this.setAdjacentCellContent(previous_player, TileType.STORAGE_AREA);
102+
this.setAdjacentCellType(previous_player, TileType.STORAGE_AREA);
103103
yield true;
104104
}
105105
default -> false;

0 commit comments

Comments
 (0)