Skip to content

Commit

Permalink
Merge branch 'step-4' into step-3
Browse files Browse the repository at this point in the history
  • Loading branch information
Mw3y authored Mar 7, 2024
2 parents 512e406 + 4d1ce23 commit 2f78ca5
Showing 1 changed file with 37 additions and 0 deletions.
37 changes: 37 additions & 0 deletions src/ch/epfl/chacun/ZonePartitions.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
package ch.epfl.chacun;

public record ZonePartitions(ZonePartition<Zone.Forest> forests, ZonePartition<Zone.Meadow> meadows,
ZonePartition<Zone.River> rivers, ZonePartition<Zone.Lake> lakes,
ZonePartition<Zone.Water> riverSystems) {
public final static ZonePartitions EMPTY = new ZonePartitions(new ZonePartition<>(), new ZonePartition<>(), new ZonePartition<>(), new ZonePartition<>(), new ZonePartition<>());


public static final class Builder {

private ZonePartition.Builder<Zone.Forest> forests;
private ZonePartition.Builder<Zone.Meadow> meadows;
private ZonePartition.Builder<Zone.River> rivers;
private ZonePartition.Builder<Zone.Lake> lakes;

public Builder(ZonePartitions initial) {
this.forests = new ZonePartition.Builder<>(initial.forests);
this.meadows = new ZonePartition.Builder<>(initial.meadows);
this.rivers = new ZonePartition.Builder<>(initial.rivers);
this.lakes = new ZonePartition.Builder<>(initial.lakes);
}

public void addTile(Tile tile) {
int[] openConnections = new int[10];

Check warning on line 24 in src/ch/epfl/chacun/ZonePartitions.java

View workflow job for this annotation

GitHub Actions / qodana

Mismatched read and write of array

Contents of array `openConnections` are written to, but never read
for (TileSide side : tile.sides()) {
for (Zone zone : side.zones()) {
++openConnections[zone.id()];
}
}

// if (tile.zones().stream().some)

}

}

}

0 comments on commit 2f78ca5

Please sign in to comment.