- java.lang.Object
-
- io.github.bucket4j.EstimationProbe
-
- All Implemented Interfaces:
ComparableByContent<EstimationProbe>
public class EstimationProbe extends Object implements ComparableByContent<EstimationProbe>
Describes the estimation result.
-
-
Field Summary
Fields Modifier and Type Field Description static SerializationHandle<EstimationProbe>SERIALIZATION_HANDLE
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description booleancanBeConsumed()Flag describes result of consumption operation.static EstimationProbecanBeConsumed(long remainingTokens)static EstimationProbecanNotBeConsumed(long remainingTokens, long nanosToWaitForRefill)booleanequalsByContent(EstimationProbe other)longgetNanosToWaitForRefill()Returns zero ifcanBeConsumed()returns true, else time in nanos which need to wait until requested amount of tokens will be refilledlonggetRemainingTokens()Return the tokens remaining in the bucketStringtoString()
-
-
-
Field Detail
-
SERIALIZATION_HANDLE
public static final SerializationHandle<EstimationProbe> SERIALIZATION_HANDLE
-
-
Method Detail
-
canBeConsumed
public static EstimationProbe canBeConsumed(long remainingTokens)
-
canNotBeConsumed
public static EstimationProbe canNotBeConsumed(long remainingTokens, long nanosToWaitForRefill)
-
canBeConsumed
public boolean canBeConsumed()
Flag describes result of consumption operation.- Returns:
- true if requested tokens can be consumed
-
getRemainingTokens
public long getRemainingTokens()
Return the tokens remaining in the bucket- Returns:
- the tokens remaining in the bucket
-
getNanosToWaitForRefill
public long getNanosToWaitForRefill()
Returns zero ifcanBeConsumed()returns true, else time in nanos which need to wait until requested amount of tokens will be refilled- Returns:
- Zero if
canBeConsumed()returns true, else time in nanos which need to wait until requested amount of tokens will be refilled
-
equalsByContent
public boolean equalsByContent(EstimationProbe other)
- Specified by:
equalsByContentin interfaceComparableByContent<EstimationProbe>
-
-