Skip to content

Commit

Permalink
Convert core enums to use interfaces (#3)
Browse files Browse the repository at this point in the history
* Move core enums to dedicated interfaces

* Update core interfaces to use new enum interfaces

* Add enums to patch and potts packages

* Update imports in patch package

* Update imports in potts packages

* Update imports in test classes

* Reduce range of series parse conversion test

* Remove outdated file filter in checks config

* Update enum javadoc
  • Loading branch information
jessicasyu authored Oct 16, 2023
1 parent 4f1a30a commit 661f527
Show file tree
Hide file tree
Showing 102 changed files with 398 additions and 514 deletions.
4 changes: 0 additions & 4 deletions .github/config/checks.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,6 @@
<property name="severity" value="error" />
<property name="fileExtensions" value="java, xml" />

<module name="BeforeExecutionExclusionFileFilter">
<property name="fileNamePattern" value="src/arcade/tissue/*"/>
</module>

<!-- Add suppression filter for test classes -->
<module name="SuppressionFilter">
<property name="file" value=".github/config/suppressions.xml"/>
Expand Down
51 changes: 5 additions & 46 deletions src/arcade/core/agent/cell/Cell.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,9 @@
import ec.util.MersenneTwisterFast;
import arcade.core.agent.module.Module;
import arcade.core.agent.process.Process;
import arcade.core.agent.process.ProcessDomain;
import arcade.core.env.location.Location;
import arcade.core.util.MiniBox;
import static arcade.core.util.Enums.Domain;
import static arcade.core.util.Enums.Region;
import static arcade.core.util.Enums.State;

/**
* A {@code Cell} object represents a cell agent.
Expand Down Expand Up @@ -55,7 +53,7 @@ public interface Cell extends Steppable {
*
* @return the cell state
*/
State getState();
CellState getState();

/**
* Gets the cell age.
Expand All @@ -71,13 +69,6 @@ public interface Cell extends Steppable {
*/
int getDivisions();

/**
* Checks if the cell has regions.
*
* @return {@code true} if the cell has regions, {@code false} otherwise
*/
boolean hasRegions();

/**
* Gets the cell location object.
*
Expand All @@ -98,7 +89,7 @@ public interface Cell extends Steppable {
* @param domain the process domain
* @return the cell process
*/
Process getProcess(Domain domain);
Process getProcess(ProcessDomain domain);

/**
* Gets the cell population parameters.
Expand All @@ -114,65 +105,33 @@ public interface Cell extends Steppable {
*/
double getVolume();

/**
* Gets the cell volume for a region.
*
* @param region the region
* @return the cell region volume
*/
double getVolume(Region region);

/**
* Gets the cell height.
*
* @return the cell height
*/
double getHeight();

/**
* Gets the cell height for a region.
*
* @param region the region
* @return the cell region height
*/
double getHeight(Region region);

/**
* Gets the critical volume.
*
* @return the critical volume
*/
double getCriticalVolume();

/**
* Gets the critical volume for a region.
*
* @param region the region
* @return the critical region volume
*/
double getCriticalVolume(Region region);

/**
* Gets the critical height.
*
* @return the critical height
*/
double getCriticalHeight();

/**
* Gets the critical height for a region.
*
* @param region the region
* @return the critical region height
*/
double getCriticalHeight(Region region);

/**
* Sets the cell state.
*
* @param state the cell state
*/
void setState(State state);
void setState(CellState state);

/**
* Stop the cell from stepping.
Expand All @@ -188,7 +147,7 @@ public interface Cell extends Steppable {
* @param random the random number generator
* @return the new {@code Cell} object
*/
Cell make(int id, State state, Location location, MersenneTwisterFast random);
Cell make(int id, CellState state, Location location, MersenneTwisterFast random);

/**
* Schedules the cell in the simulation.
Expand Down
9 changes: 9 additions & 0 deletions src/arcade/core/agent/cell/CellState.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
package arcade.core.agent.cell;

/**
* A {@code CellState} enum represents a cell agent state.
*/

public interface CellState {

}
9 changes: 9 additions & 0 deletions src/arcade/core/agent/process/ProcessDomain.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
package arcade.core.agent.process;

/**
* A {@code ProcessDomain} enum represents an agent process domain.
*/

public interface ProcessDomain {

}
4 changes: 2 additions & 2 deletions src/arcade/core/env/lattice/Lattice.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
import sim.engine.Steppable;
import arcade.core.env.location.Location;
import arcade.core.env.operation.Operation;
import arcade.core.env.operation.OperationCategory;
import arcade.core.util.MiniBox;
import static arcade.core.util.Enums.Category;

/**
* A {@code Lattice} represents an environment layer.
Expand Down Expand Up @@ -52,7 +52,7 @@ public interface Lattice extends Steppable {
* @param category the operation category
* @return the lattice operation
*/
Operation getOperation(Category category);
Operation getOperation(OperationCategory category);

/**
* Gets the lattice layer parameters.
Expand Down
34 changes: 0 additions & 34 deletions src/arcade/core/env/location/Location.java
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
package arcade.core.env.location;

import java.util.EnumSet;
import static arcade.core.util.Enums.Region;

/**
* A {@code Location} object defines the cell location within the environment.
* <p>
Expand All @@ -20,55 +17,24 @@ public interface Location {
*/
LocationContainer convert(int id);

/**
* Gets a set of regions.
*
* @return the set of regions
*/
EnumSet<Region> getRegions();

/**
* Gets the volume of the location.
*
* @return the location volume
*/
double getVolume();

/**
* Gets the volume of the location for a given region.
*
* @param region the region
* @return the location region volume
*/
double getVolume(Region region);

/**
* Gets the surface area of the location.
*
* @return the location surface area
*/
double getSurface();

/**
* Gets the surface area of the location for a given region.
*
* @param region the region
* @return the location region surface area
*/
double getSurface(Region region);

/**
* Gets the height of the location.
*
* @return the location height
*/
double getHeight();

/**
* Gets the height of the location for a given region.
*
* @param region the region
* @return the location height
*/
double getHeight(Region region);
}
9 changes: 9 additions & 0 deletions src/arcade/core/env/operation/OperationCategory.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
package arcade.core.env.operation;

/**
* An {@code OperationCategory} enum represents an environment operation category.
*/

public interface OperationCategory {

}
130 changes: 0 additions & 130 deletions src/arcade/core/util/Enums.java

This file was deleted.

2 changes: 1 addition & 1 deletion src/arcade/patch/agent/action/PatchActionRemove.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@
import arcade.patch.env.location.Coordinate;
import arcade.patch.sim.PatchSeries;
import arcade.patch.sim.PatchSimulation;
import static arcade.core.util.Enums.State;
import static arcade.patch.util.PatchEnums.Ordering;
import static arcade.patch.util.PatchEnums.State;

/**
* Implementation of {@link Action} for removing cell agents.
Expand Down
Loading

0 comments on commit 661f527

Please sign in to comment.