Refactor plate to fill its own wells in its constructor

This commit is contained in:
2022-02-27 14:25:53 -06:00
parent b53f5f1cc0
commit 8ebfc1469f
4 changed files with 10 additions and 9 deletions

View File

@@ -290,7 +290,7 @@ public class InteractiveInterface {
else {
System.out.println("Reading Sample Plate file: " + plateFile);
PlateFileReader plateReader = new PlateFileReader(plateFile);
plate = new Plate(plateReader.getFilename(), plateReader.getWells());
plate = plateReader.getSamplePlate();
if(BiGpairSEQ.cachePlate()) {
BiGpairSEQ.setPlateInMemory(plate, plateFile);
}

View File

@@ -10,6 +10,7 @@ import java.util.*;
public class Plate {
private CellSample cells;
private String sourceFile;
private String filename;
private List<List<Integer[]>> wells;
private final Random rand = BiGpairSEQ.getRand();
private int size;
@@ -45,8 +46,9 @@ public class Plate {
wells = new ArrayList<>();
}
public Plate(String sourceFileName, List<List<Integer[]>> wells) {
this.sourceFile = sourceFileName;
//constructor for returning a Plate from a PlateFileReader
public Plate(String filename, List<List<Integer[]>> wells) {
this.filename = filename;
this.wells = wells;
this.size = wells.size();
@@ -176,4 +178,6 @@ public class Plate {
public String getSourceFileName() {
return sourceFile;
}
public String getFilename() { return filename; }
}

View File

@@ -56,11 +56,8 @@ public class PlateFileReader {
}
public List<List<Integer[]>> getWells() {
return wells;
public Plate getSamplePlate() {
return new Plate(filename, wells);
}
public String getFilename() {
return filename;
}
}

View File

@@ -113,7 +113,7 @@ public class Simulator implements GraphModificationFunctions {
distCellsMapAlphaKey, plateVtoAMap, plateVtoBMap, plateAtoVMap,
plateBtoVMap, alphaWellCounts, betaWellCounts, time);
//Set source file name in graph to name of sample plate
output.setSourceFilename(samplePlate.getSourceFileName());
output.setSourceFilename(samplePlate.getFilename());
//return GraphWithMapData object
return output;
}