public final class Interval extends Unit<Interval>
BleManagerConfig
and BleDeviceConfig
and
for various methods and callbacks of BleManager
and BleDevice
. An Interval
is a
self-documenting and "type-comfortable" way of representing time instead of using naked numeric primitives.Modifier and Type | Field and Description |
---|---|
static Interval |
DISABLED
Use this special value to disable options in
BleDeviceConfig and BleManagerConfig . |
static Interval |
FIVE_SECS
Convenience value representing five seconds.
|
static Interval |
INFINITE
Use this special value to signify positive infinite.
|
static Interval |
ONE_SEC
Convenience value representing one second.
|
static Interval |
TEN_SECS
Convenience value representing ten seconds.
|
static Interval |
ZERO
Convenience value for zero time.
|
Modifier and Type | Method and Description |
---|---|
static Interval |
delta(long earlierTime_millis,
long laterTime_millis)
Returns a new
Interval representing the delta between the two epoch times. |
protected double |
getRawValue()
Subclasses must implement this to return their raw
double value. |
static boolean |
isDisabled(java.lang.Double interval_nullable)
Same as
isDisabled(Interval) . |
static boolean |
isDisabled(Interval interval_nullable)
Returns true if the given
Interval is either null
or its value is less than or equal to zero. |
static boolean |
isEnabled(double interval)
Same as
isEnabled(Interval) . |
static boolean |
isEnabled(Interval interval_nullable)
Returns true if the given
Interval is not null
and its value is greater than zero. |
long |
millis()
Returns the value of this interval in milliseconds.
|
static Interval |
millis(long milliseconds)
Returns a new
Interval representing the given number of milliseconds. |
static Interval |
mins(int value)
Returns a new
Interval representing the given number of minutes. |
protected Unit<Interval> |
newInstance(double rawValue)
Subclasses must override this so that arithmetic "operators" can create new instances.
|
double |
secs()
Returns the value of this interval in seconds.
|
static Interval |
secs(double value)
Returns a new
Interval representing the given number of seconds. |
static double |
secs(Interval interval_nullable)
Returns the double values as seconds from a given nullable
Interval . |
static Interval |
since(long epochTime_milliseconds)
Returns a new
Interval representing the time since the given past epoch time,
using System.currentTimeMillis() . |
java.lang.String |
toString() |
public static final Interval DISABLED
BleDeviceConfig
and BleManagerConfig
.public static final Interval INFINITE
public static final Interval ZERO
public static final Interval ONE_SEC
public static final Interval FIVE_SECS
public static final Interval TEN_SECS
public double secs()
public long millis()
public static Interval secs(double value)
Interval
representing the given number of seconds.public static Interval mins(int value)
Interval
representing the given number of minutes.public static Interval millis(long milliseconds)
Interval
representing the given number of milliseconds.public static Interval since(long epochTime_milliseconds)
Interval
representing the time since the given past epoch time,
using System.currentTimeMillis()
.public static Interval delta(long earlierTime_millis, long laterTime_millis)
Interval
representing the delta between the two epoch times.public static double secs(Interval interval_nullable)
Interval
.public static boolean isEnabled(Interval interval_nullable)
Interval
is not null
and its value is greater than zero.public static boolean isEnabled(double interval)
isEnabled(Interval)
.public static boolean isDisabled(Interval interval_nullable)
Interval
is either null
or its value is less than or equal to zero.public static boolean isDisabled(java.lang.Double interval_nullable)
isDisabled(Interval)
.public java.lang.String toString()
toString
in class java.lang.Object
protected double getRawValue()
Unit
double
value.getRawValue
in class Unit<Interval>