private Volume calcTotalInitialVolume(Collection<WellCopy> wellCopies) { Volume totalInitialVolume = new Volume(0); if (wellCopies.size() > 0) { for (WellCopy wellCopy : wellCopies) { Plate plateForWellCopy = wellCopy.getCopy().getPlates().get(_well.getPlateNumber()); if (plateForWellCopy != null && plateForWellCopy.getWellVolume() != null) { totalInitialVolume = totalInitialVolume.add(plateForWellCopy.getWellVolume()); } } } return totalInitialVolume; }
private AggregateWellInfo(List<WellCopy> wellCopies) { _wellCopyVolumes = wellCopies; Collections.sort( _wellCopyVolumes, new Comparator<WellCopy>() { public int compare(WellCopy wcv1, WellCopy wcv2) { return wcv1.getCopy().getName().compareTo(wcv2.getCopy().getName()); } }); _totalInitialVolume = calcTotalInitialVolume(_wellCopyVolumes); _consumedVolume = VolumeUnit.ZERO; if (_wellCopyVolumes.size() > 0) { _minWellCopyVolume = _maxWellCopyVolume = _wellCopyVolumes.iterator().next(); } _volumeAdjustments = new ArrayList<WellVolumeAdjustment>(); for (WellCopy wellCopyVolume : _wellCopyVolumes) { assert wellCopyVolume.getWell().equals(_well) : "all wellCopyVolumes must be for same well"; _consumedVolume = _consumedVolume.add(wellCopyVolume.getConsumedVolume()); if (wellCopyVolume.getRemainingVolume().compareTo(_minWellCopyVolume.getRemainingVolume()) < 0) { _minWellCopyVolume = wellCopyVolume; } if (wellCopyVolume.getRemainingVolume().compareTo(_maxWellCopyVolume.getRemainingVolume()) > 0) { _maxWellCopyVolume = wellCopyVolume; } _volumeAdjustments.addAll(wellCopyVolume.getWellVolumeAdjustments()); } _copyNames = makeCopyNames(_wellCopyVolumes); }