From ec23411233be84b473f86cf0b7aabe199ed0955e Mon Sep 17 00:00:00 2001 From: Brandon Date: Wed, 4 Oct 2023 13:14:32 -0700 Subject: [PATCH] simplify loops --- .../model/acquisitions/AcquisitionEngine.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/main/java/org/micromanager/lightsheetmanager/model/acquisitions/AcquisitionEngine.java b/src/main/java/org/micromanager/lightsheetmanager/model/acquisitions/AcquisitionEngine.java index 88694ed..93f9914 100644 --- a/src/main/java/org/micromanager/lightsheetmanager/model/acquisitions/AcquisitionEngine.java +++ b/src/main/java/org/micromanager/lightsheetmanager/model/acquisitions/AcquisitionEngine.java @@ -1348,8 +1348,8 @@ public void close() { } } - for (int positionIndex = 0; positionIndex < (acqSettings_.isUsingMultiplePositions() ? - pl.getNumberOfPositions() : 1); positionIndex++) { + final int numPositions = acqSettings_.isUsingMultiplePositions() ? pl.getNumberOfPositions() : 1; + for (int positionIndex = 0; positionIndex < numPositions; positionIndex++) { AcquisitionEvent baseEvent = new AcquisitionEvent(currentAcquisition_); if (acqSettings_.isUsingMultiplePositions()) { baseEvent.setAxisPosition(LSMAcquisitionEvents.POSITION_AXIS, positionIndex); @@ -1371,8 +1371,8 @@ public void close() { } } else { // Loop 2: Multiple time points - for (int timeIndex = 0; timeIndex < (acqSettings_.isUsingTimePoints() ? - acqSettings_.numTimePoints() : 1); timeIndex++) { + final int numTimePoints = acqSettings_.isUsingTimePoints() ? acqSettings_.numTimePoints() : 1; + for (int timeIndex = 0; timeIndex < numTimePoints; timeIndex++) { baseEvent.setTimeIndex(timeIndex); // Loop 3: Channels; Loop 4: Z slices (non-interleaved) // Loop 3: Channels; Loop 4: Z slices (interleaved)