5 changed files with 116 additions and 3 deletions
-
9src/main/java/com/iflytop/a800/controller/DemoController.java
-
3src/main/java/com/iflytop/a800/device/Device.java
-
72src/main/java/com/iflytop/a800/device/Pipette.java
-
6src/main/java/com/iflytop/a800/resource/LargeBufferTube.java
-
29src/main/java/com/iflytop/a800/resource/LargeBufferTubeManager.java
@ -0,0 +1,6 @@ |
|||||
|
package com.iflytop.a800.resource; |
||||
|
|
||||
|
public class LargeBufferTube { |
||||
|
public Integer index; |
||||
|
public Integer quantity; |
||||
|
} |
@ -0,0 +1,29 @@ |
|||||
|
package com.iflytop.a800.resource; |
||||
|
import java.util.ArrayList; |
||||
|
import java.util.List; |
||||
|
public class LargeBufferTubeManager { |
||||
|
// tubes |
||||
|
public List<LargeBufferTube> tubes; |
||||
|
|
||||
|
// Constructor |
||||
|
public LargeBufferTubeManager() { |
||||
|
this.tubes = new ArrayList<>(); |
||||
|
for (int i = 0; i < 6; i++) { |
||||
|
var tube = new LargeBufferTube(); |
||||
|
tube.index = i; |
||||
|
tube.quantity = 3; |
||||
|
tubes.add(tube); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
// get tube |
||||
|
public LargeBufferTube getTube() { |
||||
|
for (LargeBufferTube tube : tubes) { |
||||
|
if (tube.quantity > 0) { |
||||
|
tube.quantity --; |
||||
|
return tube; |
||||
|
} |
||||
|
} |
||||
|
throw new RuntimeException("No tube available"); |
||||
|
} |
||||
|
} |
Write
Preview
Loading…
Cancel
Save
Reference in new issue