Refactor to read/write files of graph and map data

This commit is contained in:
2022-02-19 21:46:01 -06:00
parent 568a6be3c7
commit 13fb7168bf
9 changed files with 281 additions and 204 deletions

View File

@@ -3,52 +3,91 @@ import org.jgrapht.graph.SimpleWeightedGraph;
import java.time.Duration;
import java.util.Map;
public class GraphWithMapData {
//Can't just write the graph, because I need the occupancy data too.
//Makes most sense to serialize object and write that to a file.
//Which means there's no reason to split map data and graph data up.
public class GraphWithMapData implements java.io.Serializable {
private String sourceFilename;
private final SimpleWeightedGraph graph;
private final MapData maps;
private Integer numWells;
private Integer lowThreshold;
private Integer highThreshold;
private final Map<Integer, Integer> distCellsMapAlphaKey;
private final Map<Integer, Integer> allAlphas;
private final Map<Integer, Integer> allBetas;
private final Map<Integer, Integer> plateVtoAMap;
private final Map<Integer, Integer> plateVtoBMap;
private final Map<Integer, Integer> plateAtoVMap;
private final Map<Integer, Integer> plateBtoVMap;
private final Map<Integer, Integer> alphaWellCounts;
private final Map<Integer, Integer> betaWellCounts;
private final Duration time;
public GraphWithMapData(SimpleWeightedGraph graph, MapData maps, Map<Integer, Integer> alphaWellCounts,
public GraphWithMapData(SimpleWeightedGraph graph, Integer numWells, Integer lowThreshold, Integer highThreshold,
Map<Integer, Integer> distCellsMapAlphaKey, Map<Integer, Integer> allAlphas,
Map<Integer, Integer> allBetas, Map<Integer, Integer> plateVtoAMap,
Map<Integer,Integer> plateVtoBMap, Map<Integer, Integer> plateAtoVMap,
Map<Integer, Integer> plateBtoVMap, Map<Integer, Integer> alphaWellCounts,
Map<Integer, Integer> betaWellCounts, Duration time) {
this.graph = graph;
this.maps = maps;
this.numWells = numWells;
this.lowThreshold = lowThreshold;
this.highThreshold = highThreshold;
this.distCellsMapAlphaKey = distCellsMapAlphaKey;
this.allAlphas = allAlphas;
this.allBetas = allBetas;
this.plateVtoAMap = plateVtoAMap;
this.plateVtoBMap = plateVtoBMap;
this.plateAtoVMap = plateAtoVMap;
this.plateBtoVMap = plateBtoVMap;
this.alphaWellCounts = alphaWellCounts;
this.betaWellCounts = betaWellCounts;
this.time = time.plus(maps.getTime());
this.time = time;
}
public SimpleWeightedGraph getGraph() {
return graph;
}
public Integer getNumWells() {
return numWells;
}
public Integer getLowThreshold() {
return lowThreshold;
}
public Integer getHighThreshold() {
return highThreshold;
}
public Map<Integer, Integer> getDistCellsMapAlphaKey() {
return maps.getDistCellsMapAlphaKey();
return distCellsMapAlphaKey;
}
public Map<Integer, Integer> getAllAlphas() {
return maps.getAllAlphas();
return allAlphas;
}
public Map<Integer, Integer> getAllBetas() {
return maps.getAllBetas();
return allBetas;
}
public Map<Integer, Integer> getPlateVtoAMap() {
return maps.getPlateVtoAMap();
return plateVtoAMap;
}
public Map<Integer, Integer> getPlateVtoBMap() {
return maps.getPlateVtoBMap();
return plateVtoBMap;
}
public Map<Integer, Integer> getPlateAtoVMap() {
return maps.getPlateAtoVMap();
return plateAtoVMap;
}
public Map<Integer, Integer> getPlateBtoVMap() {
return maps.getPlateBtoVMap();
return plateBtoVMap;
}
public Map<Integer, Integer> getAlphaWellCounts() {
@@ -62,4 +101,12 @@ public class GraphWithMapData {
public Duration getTime() {
return time;
}
public void setSourceFilename(String filename) {
this.sourceFilename = filename;
}
public String getSourceFilename() {
return sourceFilename;
}
}