Skip to content

Commit a9875c1

Browse files
committed
don't use functions with side effects and update getWorkUnits
1 parent 0e2df3a commit a9875c1

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

services/scan-server/src/main/java/org/csstudio/scan/server/command/LoopCommandImpl.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ public LoopCommandImpl(final LoopCommand command) throws Exception
8484
@Override
8585
public long getWorkUnits()
8686
{
87-
final long iterations = 1 + Math.round(Math.abs((command.getEnd() - command.getStart()) / command.getStepSize()));
87+
final long iterations = getNumSteps();
8888
long body_units = 0;
8989
for (ScanCommandImpl<?> command : implementation)
9090
body_units += command.getWorkUnits();
@@ -129,7 +129,7 @@ private double getLoopStep()
129129
}
130130

131131
public int getNumSteps() {
132-
return (int)Math.ceil(Math.abs(((getLoopEnd() - getLoopStart()) / getLoopStep()))) + 1;
132+
return (int)Math.ceil(Math.abs(((command.getEnd() - command.getStart()) / command.getStepSize()))) + 1;
133133
}
134134

135135
/** {@inheritDoc} */

0 commit comments

Comments
 (0)