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 { else {
System.out.println("Reading Sample Plate file: " + plateFile); System.out.println("Reading Sample Plate file: " + plateFile);
PlateFileReader plateReader = new PlateFileReader(plateFile); PlateFileReader plateReader = new PlateFileReader(plateFile);
plate = new Plate(plateReader.getFilename(), plateReader.getWells()); plate = plateReader.getSamplePlate();
if(BiGpairSEQ.cachePlate()) { if(BiGpairSEQ.cachePlate()) {
BiGpairSEQ.setPlateInMemory(plate, plateFile); BiGpairSEQ.setPlateInMemory(plate, plateFile);
} }

View File

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

View File

@@ -56,11 +56,8 @@ public class PlateFileReader {
} }
public List<List<Integer[]>> getWells() { public Plate getSamplePlate() {
return wells; 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, distCellsMapAlphaKey, plateVtoAMap, plateVtoBMap, plateAtoVMap,
plateBtoVMap, alphaWellCounts, betaWellCounts, time); plateBtoVMap, alphaWellCounts, betaWellCounts, time);
//Set source file name in graph to name of sample plate //Set source file name in graph to name of sample plate
output.setSourceFilename(samplePlate.getSourceFileName()); output.setSourceFilename(samplePlate.getFilename());
//return GraphWithMapData object //return GraphWithMapData object
return output; return output;
} }