Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/arcade/patch/agent/action/PatchActionConvert.java
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,8 @@ public void step(SimState simstate) {
oldCell.getVolume(),
oldCell.getHeight(),
oldCell.getCriticalVolume(),
oldCell.getCriticalHeight());
oldCell.getCriticalHeight(),
oldCell.getCycles());
PatchCell newCell =
(PatchCell) cellContainer.convert(sim.cellFactory, location, sim.random);
grid.addObject(newCell, location);
Expand Down
9 changes: 5 additions & 4 deletions src/arcade/patch/agent/cell/PatchCell.java
Original file line number Diff line number Diff line change
Expand Up @@ -123,12 +123,12 @@ public abstract class PatchCell implements Cell {
/** Cell parameters. */
final Parameters parameters;

/** List of cell cycle lengths (in minutes). */
public final Bag cycles = new Bag();

/** Cell population links. */
final GrabBag links;

/** List of cell cycle lengths (in minutes). */
private final Bag cycles = new Bag();

/** If cell is stopped in the simulation. */
private boolean isStopped;

Expand Down Expand Up @@ -410,7 +410,8 @@ public CellContainer convert() {
volume,
height,
criticalVolume,
criticalHeight);
criticalHeight,
cycles);
}

/**
Expand Down
3 changes: 2 additions & 1 deletion src/arcade/patch/agent/cell/PatchCellCARTCD4.java
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,8 @@ public PatchCellContainer make(int newID, CellState newState, MersenneTwisterFas
volume,
height,
criticalVolume,
criticalHeight);
criticalHeight,
cycles);
}

@Override
Expand Down
3 changes: 2 additions & 1 deletion src/arcade/patch/agent/cell/PatchCellCARTCD8.java
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,8 @@ public PatchCellContainer make(int newID, CellState newState, MersenneTwisterFas
volume,
height,
criticalVolume,
criticalHeight);
criticalHeight,
cycles);
}

@Override
Expand Down
3 changes: 2 additions & 1 deletion src/arcade/patch/agent/cell/PatchCellCancer.java
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,8 @@ public PatchCellContainer make(int newID, CellState newState, MersenneTwisterFas
volume,
height,
criticalVolume,
criticalHeight);
criticalHeight,
cycles);
}

/**
Expand Down
3 changes: 2 additions & 1 deletion src/arcade/patch/agent/cell/PatchCellCancerStem.java
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ public PatchCellContainer make(int newID, CellState newState, MersenneTwisterFas
volume,
height,
criticalVolume,
criticalHeight);
criticalHeight,
cycles);
}
}
9 changes: 8 additions & 1 deletion src/arcade/patch/agent/cell/PatchCellContainer.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package arcade.patch.agent.cell;

import sim.util.Bag;
import ec.util.MersenneTwisterFast;
import arcade.core.agent.cell.Cell;
import arcade.core.agent.cell.CellContainer;
Expand Down Expand Up @@ -47,6 +48,9 @@ public final class PatchCellContainer implements CellContainer {
/** Critical cell height [um]. */
public final double criticalHeight;

/** Cell cycles. */
public final Bag cycles;

/**
* Creates a {@code PatchCellContainer} instance.
*
Expand All @@ -60,6 +64,7 @@ public final class PatchCellContainer implements CellContainer {
* @param height the cell height
* @param criticalVolume the critical volume
* @param criticalHeight the critical height
* @param cycles the cell cycles
*/
public PatchCellContainer(
int id,
Expand All @@ -71,7 +76,8 @@ public PatchCellContainer(
double volume,
double height,
double criticalVolume,
double criticalHeight) {
double criticalHeight,
Bag cycles) {
this.id = id;
this.parent = parent;
this.pop = pop;
Expand All @@ -82,6 +88,7 @@ public PatchCellContainer(
this.height = height;
this.criticalVolume = criticalVolume;
this.criticalHeight = criticalHeight;
this.cycles = cycles;
}

@Override
Expand Down
15 changes: 13 additions & 2 deletions src/arcade/patch/agent/cell/PatchCellFactory.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import java.util.HashSet;
import java.util.Set;
import java.util.logging.Logger;
import sim.util.Bag;
import ec.util.MersenneTwisterFast;
import arcade.core.agent.cell.*;
import arcade.core.sim.Series;
Expand Down Expand Up @@ -158,9 +159,19 @@ public PatchCellContainer createCellForPopulation(int id, int pop) {
double volume = parameters.getDouble("CELL_VOLUME");
double height = parameters.getDouble("CELL_HEIGHT");
int age = parameters.getInt("CELL_AGE");

Bag cycles = new Bag();
return new PatchCellContainer(
id, 0, pop, age, 0, State.UNDEFINED, volume, height, volume, height + compression);
id,
0,
pop,
age,
0,
State.UNDEFINED,
volume,
height,
volume,
height + compression,
cycles);
}

/**
Expand Down
3 changes: 2 additions & 1 deletion src/arcade/patch/agent/cell/PatchCellRandom.java
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,8 @@ public PatchCellContainer make(int newID, CellState newState, MersenneTwisterFas
volume,
height,
criticalVolume,
criticalHeight);
criticalHeight,
cycles);
}

@Override
Expand Down
3 changes: 2 additions & 1 deletion src/arcade/patch/agent/cell/PatchCellTissue.java
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,8 @@ public PatchCellContainer make(int newID, CellState newState, MersenneTwisterFas
volume,
height,
criticalVolume,
criticalHeight);
criticalHeight,
cycles);
}

@Override
Expand Down
9 changes: 7 additions & 2 deletions src/arcade/patch/sim/output/PatchOutputDeserializer.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import com.google.gson.JsonElement;
import com.google.gson.JsonObject;
import com.google.gson.JsonParseException;
import sim.util.Bag;
import arcade.core.agent.cell.CellContainer;
import arcade.core.env.location.LocationContainer;
import arcade.core.sim.output.OutputDeserializer;
Expand Down Expand Up @@ -67,7 +68,10 @@ public PatchCellContainer deserialize(
int divisions = jsonObject.get("divisions").getAsInt();
double volume = jsonObject.get("volume").getAsDouble();
double height = jsonObject.get("height").getAsDouble();

Bag cycles = new Bag();
for (JsonElement cycle : jsonObject.get("cycles").getAsJsonArray()) {
cycles.add(cycle.getAsDouble());
}
State state = State.valueOf(jsonObject.get("state").getAsString());

JsonArray criticals = jsonObject.get("criticals").getAsJsonArray();
Expand All @@ -84,7 +88,8 @@ public PatchCellContainer deserialize(
volume,
height,
criticalVolume,
criticalHeight);
criticalHeight,
cycles);
}
}

Expand Down
8 changes: 7 additions & 1 deletion src/arcade/patch/sim/output/PatchOutputSerializer.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import com.google.gson.JsonObject;
import com.google.gson.JsonSerializationContext;
import com.google.gson.JsonSerializer;
import sim.util.Bag;
import arcade.core.agent.cell.CellContainer;
import arcade.core.env.location.Location;
import arcade.core.env.location.LocationContainer;
Expand Down Expand Up @@ -155,8 +156,13 @@
criticals.add((int) (100 * src.criticalHeight) / 100.0);
json.add("criticals", criticals);

// TODO: add cycles

Check warning on line 159 in src/arcade/patch/sim/output/PatchOutputSerializer.java

View workflow job for this annotation

GitHub Actions / checkstyle

[checkstyle] src/arcade/patch/sim/output/PatchOutputSerializer.java#L159 <com.puppycrawl.tools.checkstyle.checks.TodoCommentCheck>

Comment matches to-do format 'TODO:'.
Raw output
/github/workspace/./src/arcade/patch/sim/output/PatchOutputSerializer.java:159:15: warning: Comment matches to-do format 'TODO:'. (com.puppycrawl.tools.checkstyle.checks.TodoCommentCheck)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove


Bag cycles = src.cycles;
JsonArray jsonCycles = new JsonArray();
for (Object cycle : cycles) {
jsonCycles.add(cycle.toString());
}
json.add("cycles", jsonCycles);
return json;
}
}
Expand Down
6 changes: 4 additions & 2 deletions test/arcade/patch/agent/cell/PatchCellCARTCD4Test.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import org.junit.jupiter.api.Test;
import sim.engine.Schedule;
import sim.engine.Steppable;
import sim.util.Bag;
import ec.util.MersenneTwisterFast;
import arcade.core.sim.Simulation;
import arcade.core.util.MiniBox;
Expand Down Expand Up @@ -51,7 +52,7 @@ public final void setUp() {
double criticalVolume = randomDoubleBetween(100, 200);
double criticalHeight = randomDoubleBetween(4, 10);
State state = State.UNDEFINED;

Bag cycles = new Bag();
container =
new PatchCellContainer(
id,
Expand All @@ -63,7 +64,8 @@ public final void setUp() {
volume,
height,
criticalVolume,
criticalHeight);
criticalHeight,
cycles);

doReturn(1.0).when(parametersMock).getDouble(any(String.class));
doReturn(1).when(parametersMock).getInt(any(String.class));
Expand Down
6 changes: 4 additions & 2 deletions test/arcade/patch/agent/cell/PatchCellCARTCD8Test.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import org.junit.jupiter.api.Test;
import sim.engine.Schedule;
import sim.engine.Steppable;
import sim.util.Bag;
import ec.util.MersenneTwisterFast;
import arcade.core.sim.Simulation;
import arcade.core.util.MiniBox;
Expand Down Expand Up @@ -51,7 +52,7 @@ public final void setUp() throws NoSuchFieldException, IllegalAccessException {
double criticalVolume = randomDoubleBetween(100, 200);
double criticalHeight = randomDoubleBetween(4, 10);
State state = State.UNDEFINED;

Bag cycles = new Bag();
container =
new PatchCellContainer(
id,
Expand All @@ -63,7 +64,8 @@ public final void setUp() throws NoSuchFieldException, IllegalAccessException {
volume,
height,
criticalVolume,
criticalHeight);
criticalHeight,
cycles);

doReturn(0.0).when(parameters).getDouble(any(String.class));
doReturn(0).when(parameters).getInt(any(String.class));
Expand Down
8 changes: 6 additions & 2 deletions test/arcade/patch/agent/cell/PatchCellCARTTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@ public class PatchCellCARTTest {

private static Bag bag;

static Bag cycles = new Bag();

static class PatchCellMock extends PatchCellCART {
PatchCellMock(PatchCellContainer container, Location location, Parameters parameters) {
super(container, location, parameters, null);
Expand All @@ -61,7 +63,8 @@ public PatchCellContainer make(int newID, CellState newState, MersenneTwisterFas
volume,
height,
criticalVolume,
criticalHeight);
criticalHeight,
cycles);
}

@Override
Expand Down Expand Up @@ -98,7 +101,8 @@ public final void setUp() throws NoSuchFieldException, IllegalAccessException {
volume,
height,
criticalVolume,
criticalHeight);
criticalHeight,
cycles);

when(parameters.getDouble("ENERGY_THRESHOLD")).thenReturn(1.0);
when(parameters.getDouble("NECROTIC_FRACTION"))
Expand Down
12 changes: 9 additions & 3 deletions test/arcade/patch/agent/cell/PatchCellCancerStemTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import java.util.ArrayList;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Test;
import sim.util.Bag;
import ec.util.MersenneTwisterFast;
import arcade.core.util.GrabBag;
import arcade.core.util.MiniBox;
Expand Down Expand Up @@ -60,6 +61,8 @@ public class PatchCellCancerStemTest {

static State cellState = State.QUIESCENT;

static Bag cellCycles = new Bag();

@BeforeAll
public static void setupMocks() {
simMock = mock(PatchSimulation.class);
Expand Down Expand Up @@ -99,7 +102,8 @@ public void step_calledWhenAgeGreaterThanApoptosisAge_doesNotSetApoptoticState()
cellVolume,
cellHeight,
cellCriticalVolume,
cellCriticalHeight);
cellCriticalHeight,
cellCycles);
PatchCell cell = spy(new PatchCellCancerStem(container, locationMock, parametersMock));
cell.module = module;
cell.processes.put(Domain.METABOLISM, metabolismMock);
Expand Down Expand Up @@ -149,7 +153,8 @@ public void make_called_createsContainer() {
volume,
height,
criticalVolume,
criticalHeight);
criticalHeight,
cellCycles);

PatchCellCancerStem cell =
new PatchCellCancerStem(cellContainer, locationMock, parametersMock, links);
Expand Down Expand Up @@ -198,7 +203,8 @@ public void make_calledWithLinks_createsContainer() {
volume,
height,
criticalVolume,
criticalHeight);
criticalHeight,
cellCycles);

PatchCellCancerStem cell =
new PatchCellCancerStem(cellContainer, locationMock, parametersMock, links);
Expand Down
9 changes: 7 additions & 2 deletions test/arcade/patch/agent/cell/PatchCellCancerTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Test;
import sim.util.Bag;
import ec.util.MersenneTwisterFast;
import arcade.core.util.GrabBag;
import arcade.core.util.MiniBox;
Expand Down Expand Up @@ -56,6 +57,8 @@ public class PatchCellCancerTest {

static State cellState = State.QUIESCENT;

static Bag cellCycles = new Bag();

@BeforeAll
public static void setupMocks() {
simMock = mock(PatchSimulation.class);
Expand Down Expand Up @@ -99,7 +102,8 @@ public void make_called_createsContainer() {
volume,
height,
criticalVolume,
criticalHeight);
criticalHeight,
cellCycles);

PatchCellCancer cell =
new PatchCellCancer(cellContainer, locationMock, parametersMock, links);
Expand Down Expand Up @@ -148,7 +152,8 @@ public void make_calledWithLinks_createsContainer() {
volume,
height,
criticalVolume,
criticalHeight);
criticalHeight,
cellCycles);

PatchCellCancer cell =
new PatchCellCancer(cellContainer, locationMock, parametersMock, links);
Expand Down
Loading
Loading