Skip to content

Commit

Permalink
further appease SpotBugs
Browse files Browse the repository at this point in the history
  • Loading branch information
nicolaspayette committed Nov 11, 2024
1 parent 0078a99 commit 1afa13c
Show file tree
Hide file tree
Showing 9 changed files with 16 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@

import com.google.common.collect.ImmutableList;
import ec.util.MersenneTwisterFast;
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
import sim.util.Int2D;
import uk.ac.ox.poseidon.agents.behaviours.travel.TravelBehaviour;
import uk.ac.ox.poseidon.agents.vessels.Vessel;
Expand All @@ -34,6 +35,7 @@ public class ChooseRandomDestinationBehaviour extends DestinationBehaviour {
private final ImmutableList<Int2D> possibleDestinations;
private final MersenneTwisterFast rng;

@SuppressFBWarnings("EI_EXPOSE_REP2")
public ChooseRandomDestinationBehaviour(
final TravelBehaviour travelBehaviour,
final List<Int2D> possibleDestinations,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,13 @@ public class BiomassDiffuser implements Steppable {

@Serial private static final long serialVersionUID = 6904676724631409234L;

private final BiomassGrid biomassGrid;
private final transient BiomassGrid biomassGrid;

private final CarryingCapacityGrid carryingCapacityGrid;
private final transient CarryingCapacityGrid carryingCapacityGrid;

private final Random rng;

private final BiomassDiffusionRule biomassDiffusionRule;
private final transient BiomassDiffusionRule biomassDiffusionRule;

private final List<Int2D> habitableLocations;

Expand Down
2 changes: 1 addition & 1 deletion core/src/main/java/uk/ac/ox/poseidon/core/Scenario.java
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
@NoArgsConstructor
public class Scenario {

private Factory<? extends LocalDateTime> startingDateTime = new DateFactory();
protected Factory<? extends LocalDateTime> startingDateTime = new DateFactory();

public Scenario(final Factory<? extends LocalDateTime> startingDateTime) {
this.startingDateTime = startingDateTime;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ public class BasicScenario extends Scenario {
private Factory<? extends Steppable> scheduledProcesses =
new ScheduledRepeatingFactory<>(
new DateTimeAfterFactory(
getStartingDateTime(),
startingDateTime,
new PeriodFactory(0, 1, 0)
),
new PeriodFactory(0, 1, 0),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
package uk.ac.ox.poseidon.geography.grids;

import com.vividsolutions.jts.geom.Envelope;
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
import sim.field.grid.DoubleGrid2D;
import sim.util.Int2D;

Expand Down Expand Up @@ -69,6 +70,7 @@ public DoubleGrid(
this(gridExtent, new DoubleGrid2D(values));
}

@SuppressFBWarnings("EI_EXPOSE_REP2")
public DoubleGrid(
final GridExtent gridExtent,
final DoubleGrid2D grid
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
package uk.ac.ox.poseidon.geography.ports;

import com.vividsolutions.jts.geom.Coordinate;
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
import sim.field.grid.SparseGrid2D;
import sim.util.Int2D;
import uk.ac.ox.poseidon.core.MasonUtils;
Expand All @@ -36,6 +37,7 @@ public class DefaultPortGrid extends AbstractGrid<SparseGrid2D> implements PortG

private final SparseGrid2D sparseGrid2D;

@SuppressFBWarnings("EI_EXPOSE_REP2")
public DefaultPortGrid(
final BathymetricGrid bathymetricGrid,
final SparseGrid2D sparseGrid2D
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
@Setter
@AllArgsConstructor
@NoArgsConstructor
public class PortGridPortrayalFactory extends SimulationScopeFactory<SparseGridPortrayal2D> {
public final class PortGridPortrayalFactory extends SimulationScopeFactory<SparseGridPortrayal2D> {

private Factory<? extends PortGrid> portGrid;

Expand Down
2 changes: 2 additions & 0 deletions io/src/main/java/uk/ac/ox/poseidon/io/ScenarioLoader.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@

package uk.ac.ox.poseidon.io;

import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
import org.yaml.snakeyaml.Yaml;
import uk.ac.ox.poseidon.core.Scenario;

Expand Down Expand Up @@ -46,6 +47,7 @@ public ScenarioLoader() {
*
* @param yaml the {@code Yaml} instance to use for loading scenarios
*/
@SuppressFBWarnings("EI_EXPOSE_REP2")
public ScenarioLoader(final Yaml yaml) {
this.yaml = yaml;
}
Expand Down
2 changes: 2 additions & 0 deletions io/src/main/java/uk/ac/ox/poseidon/io/ScenarioWriter.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@

package uk.ac.ox.poseidon.io;

import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
import org.yaml.snakeyaml.DumperOptions;
import org.yaml.snakeyaml.Yaml;
import uk.ac.ox.poseidon.core.Scenario;
Expand All @@ -35,6 +36,7 @@ public ScenarioWriter() {
this(new Yaml(defaultDumperOptions()));
}

@SuppressFBWarnings("EI_EXPOSE_REP2")
public ScenarioWriter(final Yaml yaml) {
this.yaml = yaml;
}
Expand Down

0 comments on commit 1afa13c

Please sign in to comment.