Package org.apfloat.samples
Class Pi.BinarySplittingProgressIndicator
java.lang.Object
org.apfloat.samples.Pi.BinarySplittingProgressIndicator
- All Implemented Interfaces:
Serializable
- Enclosing class:
Pi
Indicates progress of the pi calculation using
the binary splitting algorithm.
This implementation is thread safe for multiple threads to use concurrently.
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate AtomicLong
private static final long
private static final long
private long
-
Constructor Summary
ConstructorsConstructorDescriptionBinarySplittingProgressIndicator
(long terms) Construct a progress indicator with the specified number of terms of the series. -
Method Summary
Modifier and TypeMethodDescriptionvoid
progress
(long n1, long n2) Advances the progress.private long
recursiveLength
(long length)
-
Field Details
-
serialVersionUID
private static final long serialVersionUID- See Also:
-
PROGRESS_RECURSION_THRESHOLD
private static final long PROGRESS_RECURSION_THRESHOLD- See Also:
-
totalElements
private long totalElements -
currentElements
-
-
Constructor Details
-
BinarySplittingProgressIndicator
public BinarySplittingProgressIndicator(long terms) Construct a progress indicator with the specified number of terms of the series.- Parameters:
terms
- Total number of terms to be calculated.
-
-
Method Details
-
progress
public void progress(long n1, long n2) Advances the progress.- Parameters:
n1
- First term that has been calculated.n2
- Last term that has been calculated, minus one.
-
recursiveLength
private long recursiveLength(long length)
-