public final class TimeMeasure
extends java.lang.Object
| Modifier and Type | Field and Description |
|---|---|
private long |
size
The size of the windows generated by this policy.
|
private java.util.concurrent.TimeUnit |
unit
The time unit for this policy's time interval.
|
| Modifier | Constructor and Description |
|---|---|
private |
TimeMeasure(long size,
java.util.concurrent.TimeUnit unit)
Instantiation only via factory method.
|
| Modifier and Type | Method and Description |
|---|---|
static TimeMeasure |
days(long days)
Creates a new
TimeMeasure that represents the given number of days. |
long |
getSize()
Gets the length of this policy's time interval.
|
java.util.concurrent.TimeUnit |
getUnit()
Gets the time unit for this policy's time interval.
|
static TimeMeasure |
hours(long hours)
Creates a new
TimeMeasure that represents the given number of hours. |
static TimeMeasure |
milliseconds(long milliseconds)
Creates a new
TimeMeasure that represents the given number of milliseconds. |
static TimeMeasure |
minutes(long minutes)
Creates a new
TimeMeasure that represents the given number of minutes. |
static TimeMeasure |
of(long size,
java.util.concurrent.TimeUnit unit) |
static TimeMeasure |
seconds(long seconds)
Creates a new
TimeMeasure that represents the given number of seconds. |
long |
toMilliseconds()
Converts the time interval to milliseconds.
|
private final java.util.concurrent.TimeUnit unit
private final long size
private TimeMeasure(long size,
java.util.concurrent.TimeUnit unit)
public java.util.concurrent.TimeUnit getUnit()
public long getSize()
public long toMilliseconds()
public static TimeMeasure of(long size, java.util.concurrent.TimeUnit unit)
public static TimeMeasure milliseconds(long milliseconds)
TimeMeasure that represents the given number of milliseconds.public static TimeMeasure seconds(long seconds)
TimeMeasure that represents the given number of seconds.public static TimeMeasure minutes(long minutes)
TimeMeasure that represents the given number of minutes.public static TimeMeasure hours(long hours)
TimeMeasure that represents the given number of hours.public static TimeMeasure days(long days)
TimeMeasure that represents the given number of days.