private List<String> makeCopyNames(List<WellCopy> wellCopyVolumes) { Set<String> names = new TreeSet<String>(); for (WellCopy volume : wellCopyVolumes) { names.add(volume.getCopy().getName()); } return new ArrayList<String>(names); }
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); }
public WellVolume(Well well, Collection<WellCopy> wellCopies) { super(well.getEntityId()); _well = well; List<WellCopy> activeVolumes = new ArrayList<WellCopy>(); List<WellCopy> retiredVolumes = new ArrayList<WellCopy>(); for (WellCopy wc : wellCopies) { Plate plate = wc.getCopy().getPlates().get(_well.getPlateNumber()); if (plate == null || plate.getStatus() != PlateStatus.RETIRED) { activeVolumes.add(wc); } else if (plate.getStatus() == PlateStatus.RETIRED) { retiredVolumes.add(wc); } } _activeWellInfo = new AggregateWellInfo(activeVolumes); _retiredWellInfo = new AggregateWellInfo(retiredVolumes); }