public PcrRegion next(String plate, int quadrantNumber, int numberOfRegions) throws PlateFullException { if (numberOfRegions == 0) { throw new IllegalArgumentException("Dna blocks has no reps setup properly"); } if (!iterator.hasNext()) { throw new AllocationException("No more pcr wells available for allocation to the PcrRegion"); } int numberOfWellsToAllocate = wellLocations.size() / numberOfRegions; LinkedList<PlateWellLocation> pcrRegionWells = new LinkedList<PlateWellLocation>(); LinkedList<PlateWellLocation> dnaWells = new LinkedList<PlateWellLocation>(); for (int i = 0; i < numberOfWellsToAllocate; i++) { pcrRegionWells.add(iterator.next()); } for (int i = 0; i < numberOfWellsToAllocate; i++) { dnaWells.add(dnaLocations.next()); } return new PcrRegion(plate, currentRegionNumber++, quadrantNumber, pcrRegionWells, dnaWells); }
public PcrRegionAllocator(List<PlateWellLocation> wellLocations) { this.wellLocations = wellLocations; iterator = wellLocations.iterator(); dnaLocations = PlateLocations.instance(UserPreferences.newInstance().getInt("dnaSource.type")); }