sige 1 year ago
parent
commit
d7b7c9610c
  1. 29
      src/src/main/java/com/my/graphiteDigesterBg/resource/ResHeatingTubeRackSlot.java

29
src/src/main/java/com/my/graphiteDigesterBg/resource/ResHeatingTubeRackSlot.java

@ -6,6 +6,15 @@ import java.util.List;
public class ResHeatingTubeRackSlot { public class ResHeatingTubeRackSlot {
// logger // logger
public static final Logger LOG = LoggerFactory.getLogger(ResHeatingTubeRackSlot.class); public static final Logger LOG = LoggerFactory.getLogger(ResHeatingTubeRackSlot.class);
// tube status empty
public static final String TUBE_STATUS_EMPTY = "empty";
// tube status used
public static final String TUBE_STATUS_USED = "used";
// tube rack location liquid plate
public static final String LOCATION_LIQUID_PLATE = "LIQUID_PLATE";
// tube rack location heat plate
public static final String LOCATION_HEAT_PLATE = "HEAT_PLATE";
// index of slot // index of slot
public final Integer index; public final Integer index;
// dest temperature // dest temperature
@ -41,6 +50,9 @@ public class ResHeatingTubeRackSlot {
this.index = index; this.index = index;
this.manager = manager; this.manager = manager;
this.tubeStatusList = new ArrayList<>(); this.tubeStatusList = new ArrayList<>();
for ( int i = 0; i < 16; i++ ) {
this.tubeStatusList.add(TUBE_STATUS_EMPTY);
}
} }
// get is slot locked // get is slot locked
@ -61,8 +73,9 @@ public class ResHeatingTubeRackSlot {
// setup as error slot // setup as error slot
public void setupAsErrorSlot() { public void setupAsErrorSlot() {
this.isErrorSlot = true; this.isErrorSlot = true;
this.tubeStatusList.clear();
for ( int i = 0; i < 16; i++ ) { for ( int i = 0; i < 16; i++ ) {
this.tubeStatusList.add("empty");
this.tubeStatusList.add(TUBE_STATUS_EMPTY);
} }
} }
@ -70,7 +83,7 @@ public class ResHeatingTubeRackSlot {
public List<Integer> allocEmptyTubeIndexes( Integer count ) { public List<Integer> allocEmptyTubeIndexes( Integer count ) {
List<Integer> indexes = new ArrayList<>(); List<Integer> indexes = new ArrayList<>();
for ( int i = 0; i < 16; i++ ) { for ( int i = 0; i < 16; i++ ) {
if ( "empty".equals(this.tubeStatusList.get(i)) && indexes.size() < count ) {
if ( TUBE_STATUS_EMPTY.equals(this.tubeStatusList.get(i)) && indexes.size() < count ) {
indexes.add(i); indexes.add(i);
} }
} }
@ -78,8 +91,18 @@ public class ResHeatingTubeRackSlot {
throw new RuntimeException("No enough empty tube"); throw new RuntimeException("No enough empty tube");
} }
for ( var index : indexes ) { for ( var index : indexes ) {
this.tubeStatusList.set(index, "used");
this.tubeStatusList.set(index, TUBE_STATUS_USED);
} }
return indexes; return indexes;
} }
// set tube status
public void setTubeStatus( Integer index, String status ) {
this.tubeStatusList.set(index, status);
}
// get tube status
public String getTubeStatus( Integer index ) {
return this.tubeStatusList.get(index);
}
} }
Loading…
Cancel
Save