From 42752a0949e986bf32154c581303dc9fd9a7d7ec Mon Sep 17 00:00:00 2001 From: allison-li-1016 Date: Tue, 21 Jan 2025 20:27:50 +0000 Subject: [PATCH] revising bindTarget method such that only tissue cells are considered when searching for neighbors --- src/arcade/patch/agent/cell/PatchCellCART.java | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/src/arcade/patch/agent/cell/PatchCellCART.java b/src/arcade/patch/agent/cell/PatchCellCART.java index 0c5ddb5e..21bb96a8 100644 --- a/src/arcade/patch/agent/cell/PatchCellCART.java +++ b/src/arcade/patch/agent/cell/PatchCellCART.java @@ -200,9 +200,10 @@ public PatchCellTissue bindTarget( // get all agents from neighboring locations for (Location neighborLocation : loc.getNeighbors()) { Bag bag = new Bag(grid.getObjectsAtLocation(neighborLocation)); - for (Object b : bag) { - // add all agents from neighboring locations - if (!allAgents.contains(b)) allAgents.add(b); + for (Object agent : bag) { + Cell cell = (Cell) agent; + // add all tissue agents from neighboring locations + if (cell instanceof PatchCellTissue) allAgents.add(cell); } } @@ -230,9 +231,7 @@ public PatchCellTissue bindTarget( // Within maximum search vicinity, search for neighboring cells to bind to for (int i = 0; i < maxSearch; i++) { Cell cell = (Cell) allAgents.get(i); - if (!(cell instanceof PatchCellCART) - && cell.getState() != State.APOPTOTIC - && cell.getState() != State.NECROTIC) { + if (cell.getState() != State.APOPTOTIC && cell.getState() != State.NECROTIC) { PatchCellTissue tissueCell = (PatchCellTissue) cell; double cARAntigens = tissueCell.carAntigens; double selfTargets = tissueCell.selfTargets;