From e5afdf90569c65c33b864fb0cf227162ec78bf97 Mon Sep 17 00:00:00 2001 From: navyacodes Date: Mon, 20 Apr 2026 01:44:42 -0700 Subject: [PATCH 1/6] added very barebones, probably incorrect event logging --- src/arcade/core/util/EventLog.java | 24 ++++++++++ .../patch/agent/event/LysisEventLog.java | 45 +++++++++++++++++++ .../agent/event/ProliferationEventLog.java | 35 +++++++++++++++ .../agent/module/PatchModuleCytotoxicity.java | 24 +++++----- .../module/PatchModuleProliferation.java | 18 +++++--- 5 files changed, 129 insertions(+), 17 deletions(-) create mode 100644 src/arcade/core/util/EventLog.java create mode 100644 src/arcade/patch/agent/event/LysisEventLog.java create mode 100644 src/arcade/patch/agent/event/ProliferationEventLog.java diff --git a/src/arcade/core/util/EventLog.java b/src/arcade/core/util/EventLog.java new file mode 100644 index 000000000..779f68213 --- /dev/null +++ b/src/arcade/core/util/EventLog.java @@ -0,0 +1,24 @@ +package arcade.core.util; + +import java.util.Map; + +public abstract class EventLog { + private final int timestamp; + + private final String eventType; + + public EventLog(int timestamp, String eventType) { + this.timestamp = timestamp; + this.eventType = eventType; + } + + public int getTimestamp() { + return timestamp; + } + + public String getEventType() { + return eventType; + } + + public abstract Map eventDetails(); +} diff --git a/src/arcade/patch/agent/event/LysisEventLog.java b/src/arcade/patch/agent/event/LysisEventLog.java new file mode 100644 index 000000000..7b8417ccb --- /dev/null +++ b/src/arcade/patch/agent/event/LysisEventLog.java @@ -0,0 +1,45 @@ +package arcade.patch.agent.event; + +import arcade.core.util.EventLog; +import arcade.patch.env.location.Coordinate; + +import java.util.HashMap; +import java.util.Map; + +public class LysisEventLog extends EventLog { + + public static final String EVENT_TYPE = "lysis"; + + private final int cellId; + + private final int targetCellId; + + private final int targetCellType; + + private final Coordinate targetCellLocation; + + public LysisEventLog (int timestamp, + int cellId, + int targetCellId, + int targetCellType, + Coordinate targetCellLocation) { + + super(timestamp, EVENT_TYPE); + this.cellId = cellId; + this.targetCellId = targetCellId; + this.targetCellType = targetCellType; + this.targetCellLocation = targetCellLocation; + } + + @Override + public Map eventDetails() { + Map map = new HashMap<>(); + map.put("event-type", EVENT_TYPE); + map.put("timestamp", super.getTimestamp()); + map.put("cell-id", cellId); + map.put("target-cell-id", targetCellId); + map.put("target-cell-type", targetCellType); + map.put("target-cell-location", targetCellLocation); + return map; + } +} diff --git a/src/arcade/patch/agent/event/ProliferationEventLog.java b/src/arcade/patch/agent/event/ProliferationEventLog.java new file mode 100644 index 000000000..9dbedabd0 --- /dev/null +++ b/src/arcade/patch/agent/event/ProliferationEventLog.java @@ -0,0 +1,35 @@ +package arcade.patch.agent.event; + +import arcade.core.util.EventLog; + +import java.util.HashMap; +import java.util.Map; + +public class ProliferationEventLog extends EventLog { + + public static final String EVENT_TYPE = "proliferation"; + + private final int cellId; + + private final int cycleLength; + + public ProliferationEventLog (int timestamp, + int cellId, + int cycleLength) { + + super(timestamp, EVENT_TYPE); + this.cellId = cellId; + this.cycleLength = cycleLength; + } + + + @Override + public Map eventDetails() { + Map map = new HashMap<>(); + map.put("event-type", EVENT_TYPE); + map.put("timestamp", super.getTimestamp()); + map.put("cell-id", cellId); + map.put("cycle-length", cycleLength); + return map; + } +} diff --git a/src/arcade/patch/agent/module/PatchModuleCytotoxicity.java b/src/arcade/patch/agent/module/PatchModuleCytotoxicity.java index 6c4563206..b2ce60435 100644 --- a/src/arcade/patch/agent/module/PatchModuleCytotoxicity.java +++ b/src/arcade/patch/agent/module/PatchModuleCytotoxicity.java @@ -2,6 +2,8 @@ import java.util.HashMap; import java.util.Map; + +import arcade.patch.agent.event.LysisEventLog; import ec.util.MersenneTwisterFast; import arcade.core.sim.Simulation; import arcade.core.util.Parameters; @@ -77,16 +79,18 @@ public void step(MersenneTwisterFast random, Simulation sim) { // Log cytotoxicity event PatchSimulation patchSim = (PatchSimulation) sim; - Map eventData = new HashMap<>(); - eventData.put("type", "lysis"); - eventData.put("timestamp", (int) ((PatchSimulation) sim).getSchedule().getTime()); - eventData.put("cell-id", cell.getID()); - eventData.put("target-cell-id", target.getID()); - eventData.put("target-cell-type", target.getPop()); - eventData.put( - "target-cell-location", - ((PatchLocation) target.getLocation()).getCoordinate()); - patchSim.logEvent(eventData); +// Map eventData = new HashMap<>(); +// eventData.put("type", "lysis"); +// eventData.put("timestamp", (int) ((PatchSimulation) sim).getSchedule().getTime()); +// eventData.put("cell-id", cell.getID()); +// eventData.put("target-cell-id", target.getID()); +// eventData.put("target-cell-type", target.getPop()); +// eventData.put( +// "target-cell-location", +// ((PatchLocation) target.getLocation()).getCoordinate()); + LysisEventLog eventLog = new LysisEventLog((int) ((PatchSimulation) sim).getSchedule().getTime(), + cell.getID(), target.getID(), target.getPop(), ((PatchLocation) target.getLocation()).getCoordinate()); + patchSim.logEvent(eventLog.eventDetails()); } } diff --git a/src/arcade/patch/agent/module/PatchModuleProliferation.java b/src/arcade/patch/agent/module/PatchModuleProliferation.java index 0e6917cbb..ed392c940 100644 --- a/src/arcade/patch/agent/module/PatchModuleProliferation.java +++ b/src/arcade/patch/agent/module/PatchModuleProliferation.java @@ -2,6 +2,8 @@ import java.util.HashMap; import java.util.Map; + +import arcade.patch.agent.event.ProliferationEventLog; import sim.util.Bag; import ec.util.MersenneTwisterFast; import arcade.core.agent.cell.CellContainer; @@ -133,13 +135,15 @@ public void step(MersenneTwisterFast random, Simulation sim) { // Log proliferation event PatchSimulation patchSim = (PatchSimulation) sim; - Map eventData = new HashMap<>(); - eventData.put("type", "proliferation"); - eventData.put( - "timestamp", (int) ((PatchSimulation) sim).getSchedule().getTime()); - eventData.put("cell-id", cell.getID()); - eventData.put("cycle-length", duration); - patchSim.logEvent(eventData); + ProliferationEventLog eventLog = new ProliferationEventLog( + (int) ((PatchSimulation) sim).getSchedule().getTime(), cell.getID(), duration); +// Map eventData = new HashMap<>(); +// eventData.put("type", "proliferation"); +// eventData.put( +// "timestamp", (int) ((PatchSimulation) sim).getSchedule().getTime()); +// eventData.put("cell-id", cell.getID()); +// eventData.put("cycle-length", duration); + patchSim.logEvent(eventLog.eventDetails()); // TODO: Update environment generator sites. } else { From 72f6f98a9bfacce3f127471be23e8140de25247a Mon Sep 17 00:00:00 2001 From: navyacodes Date: Mon, 27 Apr 2026 00:58:21 -0700 Subject: [PATCH 2/6] added tests for EventLog, LysisEventLog, and ProliferationEventLog; made fields public --- src/arcade/core/util/EventLog.java | 12 ++----- .../agent/module/PatchModuleCytotoxicity.java | 35 ++++++++++--------- .../module/PatchModuleProliferation.java | 25 ++++++------- .../{agent/event => util}/LysisEventLog.java | 28 +++++++-------- .../event => util}/ProliferationEventLog.java | 16 ++++----- test/arcade/core/util/EventLogTest.java | 27 ++++++++++++++ test/arcade/patch/util/LysisEventLogTest.java | 35 +++++++++++++++++++ .../patch/util/ProliferationEventLogTest.java | 28 +++++++++++++++ 8 files changed, 141 insertions(+), 65 deletions(-) rename src/arcade/patch/{agent/event => util}/LysisEventLog.java (64%) rename src/arcade/patch/{agent/event => util}/ProliferationEventLog.java (67%) create mode 100644 test/arcade/core/util/EventLogTest.java create mode 100644 test/arcade/patch/util/LysisEventLogTest.java create mode 100644 test/arcade/patch/util/ProliferationEventLogTest.java diff --git a/src/arcade/core/util/EventLog.java b/src/arcade/core/util/EventLog.java index 779f68213..0c1341fc7 100644 --- a/src/arcade/core/util/EventLog.java +++ b/src/arcade/core/util/EventLog.java @@ -3,22 +3,14 @@ import java.util.Map; public abstract class EventLog { - private final int timestamp; + public final int timestamp; - private final String eventType; + public final String eventType; public EventLog(int timestamp, String eventType) { this.timestamp = timestamp; this.eventType = eventType; } - public int getTimestamp() { - return timestamp; - } - - public String getEventType() { - return eventType; - } - public abstract Map eventDetails(); } diff --git a/src/arcade/patch/agent/module/PatchModuleCytotoxicity.java b/src/arcade/patch/agent/module/PatchModuleCytotoxicity.java index b2ce60435..d7d4eb813 100644 --- a/src/arcade/patch/agent/module/PatchModuleCytotoxicity.java +++ b/src/arcade/patch/agent/module/PatchModuleCytotoxicity.java @@ -1,9 +1,5 @@ package arcade.patch.agent.module; -import java.util.HashMap; -import java.util.Map; - -import arcade.patch.agent.event.LysisEventLog; import ec.util.MersenneTwisterFast; import arcade.core.sim.Simulation; import arcade.core.util.Parameters; @@ -13,10 +9,9 @@ import arcade.patch.agent.process.PatchProcessInflammation; import arcade.patch.env.location.PatchLocation; import arcade.patch.sim.PatchSimulation; +import arcade.patch.util.LysisEventLog; import arcade.patch.util.PatchEnums.Domain; import arcade.patch.util.PatchEnums.State; -import static arcade.patch.util.PatchEnums.Domain; -import static arcade.patch.util.PatchEnums.State; /** * Implementation of {@link Module} for killing tissue agents. @@ -79,17 +74,23 @@ public void step(MersenneTwisterFast random, Simulation sim) { // Log cytotoxicity event PatchSimulation patchSim = (PatchSimulation) sim; -// Map eventData = new HashMap<>(); -// eventData.put("type", "lysis"); -// eventData.put("timestamp", (int) ((PatchSimulation) sim).getSchedule().getTime()); -// eventData.put("cell-id", cell.getID()); -// eventData.put("target-cell-id", target.getID()); -// eventData.put("target-cell-type", target.getPop()); -// eventData.put( -// "target-cell-location", -// ((PatchLocation) target.getLocation()).getCoordinate()); - LysisEventLog eventLog = new LysisEventLog((int) ((PatchSimulation) sim).getSchedule().getTime(), - cell.getID(), target.getID(), target.getPop(), ((PatchLocation) target.getLocation()).getCoordinate()); + // Map eventData = new HashMap<>(); + // eventData.put("type", "lysis"); + // eventData.put("timestamp", (int) ((PatchSimulation) + // sim).getSchedule().getTime()); + // eventData.put("cell-id", cell.getID()); + // eventData.put("target-cell-id", target.getID()); + // eventData.put("target-cell-type", target.getPop()); + // eventData.put( + // "target-cell-location", + // ((PatchLocation) target.getLocation()).getCoordinate()); + LysisEventLog eventLog = + new LysisEventLog( + (int) sim.getSchedule().getTime(), + cell.getID(), + target.getID(), + target.getPop(), + ((PatchLocation) target.getLocation()).getCoordinate()); patchSim.logEvent(eventLog.eventDetails()); } } diff --git a/src/arcade/patch/agent/module/PatchModuleProliferation.java b/src/arcade/patch/agent/module/PatchModuleProliferation.java index ed392c940..bb84e043d 100644 --- a/src/arcade/patch/agent/module/PatchModuleProliferation.java +++ b/src/arcade/patch/agent/module/PatchModuleProliferation.java @@ -1,9 +1,5 @@ package arcade.patch.agent.module; -import java.util.HashMap; -import java.util.Map; - -import arcade.patch.agent.event.ProliferationEventLog; import sim.util.Bag; import ec.util.MersenneTwisterFast; import arcade.core.agent.cell.CellContainer; @@ -19,8 +15,7 @@ import arcade.patch.sim.PatchSimulation; import arcade.patch.util.PatchEnums.Domain; import arcade.patch.util.PatchEnums.State; -import static arcade.patch.util.PatchEnums.Domain; -import static arcade.patch.util.PatchEnums.State; +import arcade.patch.util.ProliferationEventLog; /** * Extension of {@link PatchModule} for proliferation. @@ -135,14 +130,16 @@ public void step(MersenneTwisterFast random, Simulation sim) { // Log proliferation event PatchSimulation patchSim = (PatchSimulation) sim; - ProliferationEventLog eventLog = new ProliferationEventLog( - (int) ((PatchSimulation) sim).getSchedule().getTime(), cell.getID(), duration); -// Map eventData = new HashMap<>(); -// eventData.put("type", "proliferation"); -// eventData.put( -// "timestamp", (int) ((PatchSimulation) sim).getSchedule().getTime()); -// eventData.put("cell-id", cell.getID()); -// eventData.put("cycle-length", duration); + ProliferationEventLog eventLog = + new ProliferationEventLog( + (int) sim.getSchedule().getTime(), cell.getID(), duration); + // Map eventData = new HashMap<>(); + // eventData.put("type", "proliferation"); + // eventData.put( + // "timestamp", (int) ((PatchSimulation) + // sim).getSchedule().getTime()); + // eventData.put("cell-id", cell.getID()); + // eventData.put("cycle-length", duration); patchSim.logEvent(eventLog.eventDetails()); // TODO: Update environment generator sites. diff --git a/src/arcade/patch/agent/event/LysisEventLog.java b/src/arcade/patch/util/LysisEventLog.java similarity index 64% rename from src/arcade/patch/agent/event/LysisEventLog.java rename to src/arcade/patch/util/LysisEventLog.java index 7b8417ccb..1d5eb5c69 100644 --- a/src/arcade/patch/agent/event/LysisEventLog.java +++ b/src/arcade/patch/util/LysisEventLog.java @@ -1,28 +1,28 @@ -package arcade.patch.agent.event; - -import arcade.core.util.EventLog; -import arcade.patch.env.location.Coordinate; +package arcade.patch.util; import java.util.HashMap; import java.util.Map; +import arcade.core.util.EventLog; +import arcade.patch.env.location.Coordinate; public class LysisEventLog extends EventLog { public static final String EVENT_TYPE = "lysis"; - private final int cellId; + public final int cellId; - private final int targetCellId; + public final int targetCellId; - private final int targetCellType; + public final int targetCellType; - private final Coordinate targetCellLocation; + public final Coordinate targetCellLocation; - public LysisEventLog (int timestamp, - int cellId, - int targetCellId, - int targetCellType, - Coordinate targetCellLocation) { + public LysisEventLog( + int timestamp, + int cellId, + int targetCellId, + int targetCellType, + Coordinate targetCellLocation) { super(timestamp, EVENT_TYPE); this.cellId = cellId; @@ -35,7 +35,7 @@ public LysisEventLog (int timestamp, public Map eventDetails() { Map map = new HashMap<>(); map.put("event-type", EVENT_TYPE); - map.put("timestamp", super.getTimestamp()); + map.put("timestamp", super.timestamp); map.put("cell-id", cellId); map.put("target-cell-id", targetCellId); map.put("target-cell-type", targetCellType); diff --git a/src/arcade/patch/agent/event/ProliferationEventLog.java b/src/arcade/patch/util/ProliferationEventLog.java similarity index 67% rename from src/arcade/patch/agent/event/ProliferationEventLog.java rename to src/arcade/patch/util/ProliferationEventLog.java index 9dbedabd0..dd9d59b8a 100644 --- a/src/arcade/patch/agent/event/ProliferationEventLog.java +++ b/src/arcade/patch/util/ProliferationEventLog.java @@ -1,33 +1,29 @@ -package arcade.patch.agent.event; - -import arcade.core.util.EventLog; +package arcade.patch.util; import java.util.HashMap; import java.util.Map; +import arcade.core.util.EventLog; public class ProliferationEventLog extends EventLog { public static final String EVENT_TYPE = "proliferation"; - private final int cellId; + public final int cellId; - private final int cycleLength; + public final int cycleLength; - public ProliferationEventLog (int timestamp, - int cellId, - int cycleLength) { + public ProliferationEventLog(int timestamp, int cellId, int cycleLength) { super(timestamp, EVENT_TYPE); this.cellId = cellId; this.cycleLength = cycleLength; } - @Override public Map eventDetails() { Map map = new HashMap<>(); map.put("event-type", EVENT_TYPE); - map.put("timestamp", super.getTimestamp()); + map.put("timestamp", super.timestamp); map.put("cell-id", cellId); map.put("cycle-length", cycleLength); return map; diff --git a/test/arcade/core/util/EventLogTest.java b/test/arcade/core/util/EventLogTest.java new file mode 100644 index 000000000..8d6ccb182 --- /dev/null +++ b/test/arcade/core/util/EventLogTest.java @@ -0,0 +1,27 @@ +package arcade.core.util; + +import java.util.Map; +import org.junit.jupiter.api.Test; +import static org.junit.jupiter.api.Assertions.*; +import static org.mockito.Mockito.*; + +public class EventLogTest { + + static class EventLogMock extends EventLog { + EventLogMock(int timestamp, String eventType) { + super(timestamp, eventType); + } + + @Override + public Map eventDetails() { + return mock(Map.class); + } + } + + @Test + public void constructor_setsAllFields() { + EventLog log = new EventLogMock(10, "TEST_EVENT"); + assertEquals(10, log.timestamp); + assertEquals("TEST_EVENT", log.eventType); + } +} diff --git a/test/arcade/patch/util/LysisEventLogTest.java b/test/arcade/patch/util/LysisEventLogTest.java new file mode 100644 index 000000000..9b1b8560c --- /dev/null +++ b/test/arcade/patch/util/LysisEventLogTest.java @@ -0,0 +1,35 @@ +package arcade.patch.util; + +import java.util.Map; +import org.junit.jupiter.api.Test; +import arcade.patch.env.location.Coordinate; +import arcade.patch.env.location.CoordinateXYZ; +import static org.junit.jupiter.api.Assertions.*; + +public class LysisEventLogTest { + + private static final Coordinate COORDINATE = (Coordinate) new CoordinateXYZ(0, 1, 2); + private static final LysisEventLog LOG = new LysisEventLog(10, 1, 2, 3, COORDINATE); + + @Test + public void constructor_setsAllFields() { + assertEquals(10, LOG.timestamp); + assertEquals("lysis", LOG.eventType); + assertEquals(1, LOG.cellId); + assertEquals(2, LOG.targetCellId); + assertEquals(3, LOG.targetCellType); + assertEquals(COORDINATE, LOG.targetCellLocation); + } + + @Test + public void eventDetails_containsAllFields() { + Map details = LOG.eventDetails(); + assertEquals(6, details.size()); + assertEquals("lysis", details.get("event-type")); + assertEquals(10, details.get("timestamp")); + assertEquals(1, details.get("cell-id")); + assertEquals(2, details.get("target-cell-id")); + assertEquals(3, details.get("target-cell-type")); + assertEquals(COORDINATE, details.get("target-cell-location")); + } +} diff --git a/test/arcade/patch/util/ProliferationEventLogTest.java b/test/arcade/patch/util/ProliferationEventLogTest.java new file mode 100644 index 000000000..222243a3d --- /dev/null +++ b/test/arcade/patch/util/ProliferationEventLogTest.java @@ -0,0 +1,28 @@ +package arcade.patch.util; + +import java.util.Map; +import org.junit.jupiter.api.Test; +import static org.junit.jupiter.api.Assertions.*; + +public class ProliferationEventLogTest { + + private static final ProliferationEventLog LOG = new ProliferationEventLog(10, 1, 100); + + @Test + public void constructor_setsAllFields() { + assertEquals(10, LOG.timestamp); + assertEquals("proliferation", LOG.eventType); + assertEquals(1, LOG.cellId); + assertEquals(100, LOG.cycleLength); + } + + @Test + public void eventDetails_containsAllFields() { + Map details = LOG.eventDetails(); + assertEquals(4, details.size()); + assertEquals("proliferation", details.get("event-type")); + assertEquals(10, details.get("timestamp")); + assertEquals(1, details.get("cell-id")); + assertEquals(100, details.get("cycle-length")); + } +} From 71dce0bb7168354134623080738276f88cc03107 Mon Sep 17 00:00:00 2001 From: navyacodes Date: Mon, 4 May 2026 00:02:17 -0700 Subject: [PATCH 3/6] first pass at comments, fixed test names, deleted old code --- src/arcade/core/util/EventLog.java | 9 ++++++++ .../agent/module/PatchModuleCytotoxicity.java | 10 --------- .../module/PatchModuleProliferation.java | 7 ------ src/arcade/patch/util/LysisEventLog.java | 22 +++++++++++++++++++ .../patch/util/ProliferationEventLog.java | 18 +++++++++++++++ test/arcade/core/util/EventLogTest.java | 2 +- test/arcade/patch/util/LysisEventLogTest.java | 2 +- .../patch/util/ProliferationEventLogTest.java | 2 +- 8 files changed, 52 insertions(+), 20 deletions(-) diff --git a/src/arcade/core/util/EventLog.java b/src/arcade/core/util/EventLog.java index 0c1341fc7..ea6db3eee 100644 --- a/src/arcade/core/util/EventLog.java +++ b/src/arcade/core/util/EventLog.java @@ -3,10 +3,19 @@ import java.util.Map; public abstract class EventLog { + + /** The timestep at which this log was created */ public final int timestamp; + /** A String identifier representing the type of event that was logged */ public final String eventType; + /** + * Constructs an {@code EventLog} with the given timestamp and event type. + * + * @param timestamp the simulation timestep at which the event occurred + * @param eventType a String identifier representing the type of event + */ public EventLog(int timestamp, String eventType) { this.timestamp = timestamp; this.eventType = eventType; diff --git a/src/arcade/patch/agent/module/PatchModuleCytotoxicity.java b/src/arcade/patch/agent/module/PatchModuleCytotoxicity.java index d7d4eb813..756d2ba4a 100644 --- a/src/arcade/patch/agent/module/PatchModuleCytotoxicity.java +++ b/src/arcade/patch/agent/module/PatchModuleCytotoxicity.java @@ -74,16 +74,6 @@ public void step(MersenneTwisterFast random, Simulation sim) { // Log cytotoxicity event PatchSimulation patchSim = (PatchSimulation) sim; - // Map eventData = new HashMap<>(); - // eventData.put("type", "lysis"); - // eventData.put("timestamp", (int) ((PatchSimulation) - // sim).getSchedule().getTime()); - // eventData.put("cell-id", cell.getID()); - // eventData.put("target-cell-id", target.getID()); - // eventData.put("target-cell-type", target.getPop()); - // eventData.put( - // "target-cell-location", - // ((PatchLocation) target.getLocation()).getCoordinate()); LysisEventLog eventLog = new LysisEventLog( (int) sim.getSchedule().getTime(), diff --git a/src/arcade/patch/agent/module/PatchModuleProliferation.java b/src/arcade/patch/agent/module/PatchModuleProliferation.java index bb84e043d..98dead85d 100644 --- a/src/arcade/patch/agent/module/PatchModuleProliferation.java +++ b/src/arcade/patch/agent/module/PatchModuleProliferation.java @@ -133,13 +133,6 @@ public void step(MersenneTwisterFast random, Simulation sim) { ProliferationEventLog eventLog = new ProliferationEventLog( (int) sim.getSchedule().getTime(), cell.getID(), duration); - // Map eventData = new HashMap<>(); - // eventData.put("type", "proliferation"); - // eventData.put( - // "timestamp", (int) ((PatchSimulation) - // sim).getSchedule().getTime()); - // eventData.put("cell-id", cell.getID()); - // eventData.put("cycle-length", duration); patchSim.logEvent(eventLog.eventDetails()); // TODO: Update environment generator sites. diff --git a/src/arcade/patch/util/LysisEventLog.java b/src/arcade/patch/util/LysisEventLog.java index 1d5eb5c69..2b4204df7 100644 --- a/src/arcade/patch/util/LysisEventLog.java +++ b/src/arcade/patch/util/LysisEventLog.java @@ -7,16 +7,30 @@ public class LysisEventLog extends EventLog { + /** The event type identifier for lysis events. */ public static final String EVENT_TYPE = "lysis"; + /** The ID of the cell that performed the lysis. */ public final int cellId; + /** The ID of the cell that underwent lysis. */ public final int targetCellId; + /** The type of the cell that underwent lysis. */ public final int targetCellType; + /** The location of the cell underwent lysis, at the time of lysis */ public final Coordinate targetCellLocation; + /** + * Constructs a {@code LysisEventLog} with the given event details. + * + * @param timestamp the simulation timestep at which lysis occurred + * @param cellId the ID of the cell that performed the lysis + * @param targetCellId the ID of the cell that underwent lysis + * @param targetCellType the type of the cell that underwent lysis + * @param targetCellLocation the location of the cell underwent lysis, at the time of lysis + */ public LysisEventLog( int timestamp, int cellId, @@ -31,6 +45,14 @@ public LysisEventLog( this.targetCellLocation = targetCellLocation; } + /** + * Returns a map of key-value pairs describing the details of this lysis event. + * + *

The map includes the event type, timestamp, the ID of the cell that + * performed lysis, and the ID, type, and location of the target cell that underwent lysis. + * + * @return a Map containing the lysis event's details + */ @Override public Map eventDetails() { Map map = new HashMap<>(); diff --git a/src/arcade/patch/util/ProliferationEventLog.java b/src/arcade/patch/util/ProliferationEventLog.java index dd9d59b8a..9c393a70f 100644 --- a/src/arcade/patch/util/ProliferationEventLog.java +++ b/src/arcade/patch/util/ProliferationEventLog.java @@ -6,12 +6,22 @@ public class ProliferationEventLog extends EventLog { + /** The event type identifier for proliferation events. */ public static final String EVENT_TYPE = "proliferation"; + /** The ID of the cell that proliferated. */ public final int cellId; + /** The duration of the cell cycle from the start of proliferation to division. */ public final int cycleLength; + /** + * Constructs a {@code ProliferationEventLog} with the given event details. + * + * @param timestamp the simulation timestep at which proliferation occurred + * @param cellId the ID of the cell that proliferated. + * @param cycleLength the duration of the cell cycle from the start of proliferation to division. + */ public ProliferationEventLog(int timestamp, int cellId, int cycleLength) { super(timestamp, EVENT_TYPE); @@ -19,6 +29,14 @@ public ProliferationEventLog(int timestamp, int cellId, int cycleLength) { this.cycleLength = cycleLength; } + /** + * Returns a map of key-value pairs describing the details of this proliferation event. + * + *

The map includes the event type, timestamp, the ID of the cell that proliferated, + * and the duration of the cell cycle from the start of proliferation to division. + * + * @return a Map containing the proliferation event's details + */ @Override public Map eventDetails() { Map map = new HashMap<>(); diff --git a/test/arcade/core/util/EventLogTest.java b/test/arcade/core/util/EventLogTest.java index 8d6ccb182..e7319c984 100644 --- a/test/arcade/core/util/EventLogTest.java +++ b/test/arcade/core/util/EventLogTest.java @@ -19,7 +19,7 @@ public Map eventDetails() { } @Test - public void constructor_setsAllFields() { + public void constructor_called_setsAllFields() { EventLog log = new EventLogMock(10, "TEST_EVENT"); assertEquals(10, log.timestamp); assertEquals("TEST_EVENT", log.eventType); diff --git a/test/arcade/patch/util/LysisEventLogTest.java b/test/arcade/patch/util/LysisEventLogTest.java index 9b1b8560c..0fcdaaa82 100644 --- a/test/arcade/patch/util/LysisEventLogTest.java +++ b/test/arcade/patch/util/LysisEventLogTest.java @@ -12,7 +12,7 @@ public class LysisEventLogTest { private static final LysisEventLog LOG = new LysisEventLog(10, 1, 2, 3, COORDINATE); @Test - public void constructor_setsAllFields() { + public void constructor_called_setsAllFields() { assertEquals(10, LOG.timestamp); assertEquals("lysis", LOG.eventType); assertEquals(1, LOG.cellId); diff --git a/test/arcade/patch/util/ProliferationEventLogTest.java b/test/arcade/patch/util/ProliferationEventLogTest.java index 222243a3d..eb780359d 100644 --- a/test/arcade/patch/util/ProliferationEventLogTest.java +++ b/test/arcade/patch/util/ProliferationEventLogTest.java @@ -9,7 +9,7 @@ public class ProliferationEventLogTest { private static final ProliferationEventLog LOG = new ProliferationEventLog(10, 1, 100); @Test - public void constructor_setsAllFields() { + public void constructor_called_setsAllFields() { assertEquals(10, LOG.timestamp); assertEquals("proliferation", LOG.eventType); assertEquals(1, LOG.cellId); From e4344d25e39dd6c5af07da2306022ae67f8a089b Mon Sep 17 00:00:00 2001 From: navyacodes Date: Mon, 4 May 2026 01:05:54 -0700 Subject: [PATCH 4/6] pass #2 at adding comments and fixing general code quality --- src/arcade/core/util/EventLog.java | 16 ++++++++++++++-- src/arcade/patch/util/LysisEventLog.java | 10 +++++++++- src/arcade/patch/util/ProliferationEventLog.java | 8 ++++++++ test/arcade/patch/util/LysisEventLogTest.java | 1 + 4 files changed, 32 insertions(+), 3 deletions(-) diff --git a/src/arcade/core/util/EventLog.java b/src/arcade/core/util/EventLog.java index ea6db3eee..83c5c5de8 100644 --- a/src/arcade/core/util/EventLog.java +++ b/src/arcade/core/util/EventLog.java @@ -2,12 +2,19 @@ import java.util.Map; +/** + * Abstract class representing a logged simulation event. + * + *

{@code EventLog} objects capture specific events that occur during a simulation, + * recording when the event happened and what type of event it was. Subclasses define + * the specific details of each event type. + */ public abstract class EventLog { - /** The timestep at which this log was created */ + /** The timestep at which this log was created. */ public final int timestamp; - /** A String identifier representing the type of event that was logged */ + /** A String identifier representing the type of event that was logged. */ public final String eventType; /** @@ -21,5 +28,10 @@ public EventLog(int timestamp, String eventType) { this.eventType = eventType; } + /** + * Returns a map of key-value pairs describing the details of this event. + * + * @return a Map containing the event's details + */ public abstract Map eventDetails(); } diff --git a/src/arcade/patch/util/LysisEventLog.java b/src/arcade/patch/util/LysisEventLog.java index 2b4204df7..26df965d9 100644 --- a/src/arcade/patch/util/LysisEventLog.java +++ b/src/arcade/patch/util/LysisEventLog.java @@ -5,6 +5,14 @@ import arcade.core.util.EventLog; import arcade.patch.env.location.Coordinate; +/** + * Concrete implementation of {@link EventLog} for lysis events. + * + *

{@code LysisEventLog} objects are created when a CD8 CAR T-cell successfully kills + * a target tissue cell, capturing the ID, type, and location of the target + * cell at the time of lysis, as well as the ID of the CAR T-cell and the time at + * which lysis occurred. + */ public class LysisEventLog extends EventLog { /** The event type identifier for lysis events. */ @@ -19,7 +27,7 @@ public class LysisEventLog extends EventLog { /** The type of the cell that underwent lysis. */ public final int targetCellType; - /** The location of the cell underwent lysis, at the time of lysis */ + /** The location of the cell underwent lysis, at the time of lysis. */ public final Coordinate targetCellLocation; /** diff --git a/src/arcade/patch/util/ProliferationEventLog.java b/src/arcade/patch/util/ProliferationEventLog.java index 9c393a70f..8a3b4f682 100644 --- a/src/arcade/patch/util/ProliferationEventLog.java +++ b/src/arcade/patch/util/ProliferationEventLog.java @@ -4,6 +4,14 @@ import java.util.Map; import arcade.core.util.EventLog; +/** + * Concrete implementation of {@link EventLog} for lysis events. + * + *

{@code ProliferationEventLog} objects are created when a cell successfully + * completes its cell cycle and divides, capturing the ID of the dividing + * cell and the duration of its cell cycle, as well as the time at which + * proliferation occurred. + */ public class ProliferationEventLog extends EventLog { /** The event type identifier for proliferation events. */ diff --git a/test/arcade/patch/util/LysisEventLogTest.java b/test/arcade/patch/util/LysisEventLogTest.java index 0fcdaaa82..af4ff5f6f 100644 --- a/test/arcade/patch/util/LysisEventLogTest.java +++ b/test/arcade/patch/util/LysisEventLogTest.java @@ -9,6 +9,7 @@ public class LysisEventLogTest { private static final Coordinate COORDINATE = (Coordinate) new CoordinateXYZ(0, 1, 2); + private static final LysisEventLog LOG = new LysisEventLog(10, 1, 2, 3, COORDINATE); @Test From 108e50c6c3d50590b0cc4ca2a947bc59720a8108 Mon Sep 17 00:00:00 2001 From: navyacodes Date: Mon, 4 May 2026 01:09:21 -0700 Subject: [PATCH 5/6] ran SpotlessApply --- src/arcade/core/util/EventLog.java | 6 +++--- src/arcade/patch/util/LysisEventLog.java | 11 +++++------ src/arcade/patch/util/ProliferationEventLog.java | 14 +++++++------- 3 files changed, 15 insertions(+), 16 deletions(-) diff --git a/src/arcade/core/util/EventLog.java b/src/arcade/core/util/EventLog.java index 83c5c5de8..483992965 100644 --- a/src/arcade/core/util/EventLog.java +++ b/src/arcade/core/util/EventLog.java @@ -5,9 +5,9 @@ /** * Abstract class representing a logged simulation event. * - *

{@code EventLog} objects capture specific events that occur during a simulation, - * recording when the event happened and what type of event it was. Subclasses define - * the specific details of each event type. + *

{@code EventLog} objects capture specific events that occur during a simulation, recording + * when the event happened and what type of event it was. Subclasses define the specific details of + * each event type. */ public abstract class EventLog { diff --git a/src/arcade/patch/util/LysisEventLog.java b/src/arcade/patch/util/LysisEventLog.java index 26df965d9..c64254ba8 100644 --- a/src/arcade/patch/util/LysisEventLog.java +++ b/src/arcade/patch/util/LysisEventLog.java @@ -8,10 +8,9 @@ /** * Concrete implementation of {@link EventLog} for lysis events. * - *

{@code LysisEventLog} objects are created when a CD8 CAR T-cell successfully kills - * a target tissue cell, capturing the ID, type, and location of the target - * cell at the time of lysis, as well as the ID of the CAR T-cell and the time at - * which lysis occurred. + *

{@code LysisEventLog} objects are created when a CD8 CAR T-cell successfully kills a target + * tissue cell, capturing the ID, type, and location of the target cell at the time of lysis, as + * well as the ID of the CAR T-cell and the time at which lysis occurred. */ public class LysisEventLog extends EventLog { @@ -56,8 +55,8 @@ public LysisEventLog( /** * Returns a map of key-value pairs describing the details of this lysis event. * - *

The map includes the event type, timestamp, the ID of the cell that - * performed lysis, and the ID, type, and location of the target cell that underwent lysis. + *

The map includes the event type, timestamp, the ID of the cell that performed lysis, and + * the ID, type, and location of the target cell that underwent lysis. * * @return a Map containing the lysis event's details */ diff --git a/src/arcade/patch/util/ProliferationEventLog.java b/src/arcade/patch/util/ProliferationEventLog.java index 8a3b4f682..3196f45ea 100644 --- a/src/arcade/patch/util/ProliferationEventLog.java +++ b/src/arcade/patch/util/ProliferationEventLog.java @@ -7,10 +7,9 @@ /** * Concrete implementation of {@link EventLog} for lysis events. * - *

{@code ProliferationEventLog} objects are created when a cell successfully - * completes its cell cycle and divides, capturing the ID of the dividing - * cell and the duration of its cell cycle, as well as the time at which - * proliferation occurred. + *

{@code ProliferationEventLog} objects are created when a cell successfully completes its cell + * cycle and divides, capturing the ID of the dividing cell and the duration of its cell cycle, as + * well as the time at which proliferation occurred. */ public class ProliferationEventLog extends EventLog { @@ -28,7 +27,8 @@ public class ProliferationEventLog extends EventLog { * * @param timestamp the simulation timestep at which proliferation occurred * @param cellId the ID of the cell that proliferated. - * @param cycleLength the duration of the cell cycle from the start of proliferation to division. + * @param cycleLength the duration of the cell cycle from the start of proliferation to + * division. */ public ProliferationEventLog(int timestamp, int cellId, int cycleLength) { @@ -40,8 +40,8 @@ public ProliferationEventLog(int timestamp, int cellId, int cycleLength) { /** * Returns a map of key-value pairs describing the details of this proliferation event. * - *

The map includes the event type, timestamp, the ID of the cell that proliferated, - * and the duration of the cell cycle from the start of proliferation to division. + *

The map includes the event type, timestamp, the ID of the cell that proliferated, and the + * duration of the cell cycle from the start of proliferation to division. * * @return a Map containing the proliferation event's details */ From 73ef234ce5fe6f77be226c2bc8a808591c990970 Mon Sep 17 00:00:00 2001 From: navyacodes Date: Mon, 18 May 2026 09:51:02 -0700 Subject: [PATCH 6/6] fixed typo --- src/arcade/patch/util/ProliferationEventLog.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/arcade/patch/util/ProliferationEventLog.java b/src/arcade/patch/util/ProliferationEventLog.java index 3196f45ea..72b7cbb35 100644 --- a/src/arcade/patch/util/ProliferationEventLog.java +++ b/src/arcade/patch/util/ProliferationEventLog.java @@ -5,7 +5,7 @@ import arcade.core.util.EventLog; /** - * Concrete implementation of {@link EventLog} for lysis events. + * Concrete implementation of {@link EventLog} for proliferation events. * *

{@code ProliferationEventLog} objects are created when a cell successfully completes its cell * cycle and divides, capturing the ID of the dividing cell and the duration of its cell cycle, as