Class IterativeAveragingDoubleBuffer
java.lang.Object
iterativeaveraging.util.exercise.IterativeAveragingDoubleBuffer
- Author:
- Dennis Cosgrove
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiondouble[]dstForPhase(int phaseIndex) Gets the "destination" data for a given phase.double[]srcForPhase(int phaseIndex) Gets the "source" data for a given phase.toString()
-
Constructor Details
-
IterativeAveragingDoubleBuffer
public IterativeAveragingDoubleBuffer(double[] originalData)
-
-
Method Details
-
srcForPhase
public double[] srcForPhase(int phaseIndex) Gets the "source" data for a given phase. (Gets originalData on phase 0.) This is where data should be read from. This is the counterpart todstForPhase(int)- Parameters:
phaseIndex- The current phase- Returns:
- member variable "originalData" if the phase is 0, member variable "a"
if the phase is odd, member variable "b" if the phase is non-zero and
even.
phase 0: originalData phase 1: a phase 2: b phase 3: a phase 4: b phase 5: a phase 6: b ...
-
dstForPhase
public double[] dstForPhase(int phaseIndex) Gets the "destination" data for a given phase. This is where data should be written to. This is the counterpart tosrcForPhase(int).- Parameters:
phaseIndex- The current phase.- Returns:
- member variable "b" if the phase is odd, member variable "a" if the
phase is non-zero and even.
phase 0: a phase 1: b phase 2: a phase 3: b phase 4: a phase 5: b phase 6: a ...
-
toString
-