public final class DurationExtensions extends Object
Duration
class for use in Xtend.
To use this functions, it is recommended to import this class with an extension import:
import static extension de.fhg.fokus.xtenders.datetime.DurationExtensions.*
All functions and operators are inlined to use functions of Duration directly.
This class provides arithmetic and compare operators, as well as factory methods
that can be used in more natural postfix notation, e.g. 2.seconds
.Modifier and Type | Method and Description |
---|---|
static Duration |
days(long d)
Alias for
Duration.ofDays(long) . |
static Duration |
hours(long h)
Alias for
Duration.ofHours(long) . |
static Duration |
microseconds(long ms)
Alias for
Duration.of(ms, ChronoUnit.MICROS) . |
static Duration |
milliseconds(long ms)
Alias for
Duration.ofMillis(long) . |
static Duration |
minutes(long min)
Alias for
Duration.ofMinutes(long) . |
static Duration |
nanoseconds(long ns)
Alias for
Duration.ofNanos(long) . |
static Duration |
operator_divide(Duration a,
long b)
Operator shortcut for
a.dividedBy(b) |
static boolean |
operator_greaterEqualsThan(Duration a,
Duration b)
Operator shortcut for
a.compareTo(b) >= 0 . |
static boolean |
operator_greaterThan(Duration a,
Duration b)
Operator shortcut for
a.compareTo(b) > 0 . |
static boolean |
operator_lessEqualsThan(Duration a,
Duration b)
Operator shortcut for
a.compareTo(b) <= 0 . |
static boolean |
operator_lessThan(Duration a,
Duration b)
Operator shortcut for
a.compareTo(b) < 0 . |
static Duration |
operator_minus(Duration a)
Operator shortcut for
a.negated() |
static Duration |
operator_minus(Duration a,
Duration b)
Operator shortcut for
a.minus(b) |
static Duration |
operator_multiply(Duration a,
long b)
Operator shortcut for
a.multipliedBy(b) |
static Duration |
operator_plus(Duration a,
Duration b)
Operator shortcut for
a.plus(b) . |
static int |
operator_spaceship(Duration a,
Duration b)
Operator shortcut for
a.compareTo(b) . |
static Duration |
seconds(long s)
Alias for
Duration.ofSeconds(long) . |
static Duration |
weeks(long w)
Alias for
Duration.of(w, ChronoUnit.WEEKS) . |
public static Duration nanoseconds(long ns)
Duration.ofNanos(long)
.ns
- nanosecondsDuration.ofNanos(long)
call with ns
public static Duration milliseconds(long ms)
Duration.ofMillis(long)
.ms
- millisecondsDuration.ofMillis(long)
call with ms
public static Duration microseconds(long ms)
Duration.of(ms, ChronoUnit.MICROS)
.ms
- millisecondsDuration.of(ms, ChronoUnit.MICROS)
public static Duration seconds(long s)
Duration.ofSeconds(long)
.s
- secondsDuration.ofSeconds(long)
call with s
public static Duration minutes(long min)
Duration.ofMinutes(long)
.min
- minutesDuration.ofMinutes(long)
call with min
public static Duration hours(long h)
Duration.ofHours(long)
.h
- hoursDuration.ofHours(long)
call with h
public static Duration days(long d)
Duration.ofDays(long)
.d
- daysDuration.ofDays(long)
call with d
public static Duration weeks(long w)
Duration.of(w, ChronoUnit.WEEKS)
.w
- weeksDuration.of(w, ChronoUnit.WEEKS)
public static Duration operator_plus(Duration a, Duration b)
a.plus(b)
.a
- left hand side of operatorb
- right hand side of operatora.plus(b)
public static Duration operator_minus(Duration a, Duration b)
a.minus(b)
a
- left hand side of operatorb
- right hand side of operatora.minus(b)
public static Duration operator_divide(Duration a, long b)
a.dividedBy(b)
a
- left hand side of operatorb
- right hand side of operatora.dividedBy(b)
public static Duration operator_multiply(Duration a, long b)
a.multipliedBy(b)
a
- left hand side of operatorb
- right hand side of operatora.multipliedBy(b)
public static Duration operator_minus(Duration a)
a.negated()
a
- value to negatea.negated()
public static int operator_spaceship(Duration a, Duration b)
a.compareTo(b)
.a
- left hand side of operatorb
- right hand side of operatora.compareTo(b)
public static boolean operator_lessThan(Duration a, Duration b)
a.compareTo(b) < 0
.a
- left hand side of operatorb
- right hand side of operatora.compareTo(b) < 0
public static boolean operator_greaterThan(Duration a, Duration b)
a.compareTo(b) > 0
.a
- left hand side of operatorb
- right hand side of operatora.compareTo(b) > 0
public static boolean operator_lessEqualsThan(Duration a, Duration b)
a.compareTo(b) <= 0
.a
- left hand side of operatorb
- right hand side of operatora.compareTo(b) <= 0
public static boolean operator_greaterEqualsThan(Duration a, Duration b)
a.compareTo(b) >= 0
.a
- left hand side of operatorb
- right hand side of operatora.compareTo(b) >= 0
Copyright © 2019. All rights reserved.