T
- value typepublic final class DualBound<T extends Number> extends SingleBound<T>
Double
and AbstractDoubleScalar<?, ?>
constraints,
the generic type is restricted to Number
. However, that also allows other subclasses of Number
, e.g.
Integer
. Due to rounding and value limits from the type (e.g. Integer.MAX_VALEU
), bounds may not function
correctly after a call to Number.doubleValue()
. To restrict the usage, the constructor is private and static factory
methods for Double
and AbstractDoubleScalar<?, ?>
are supplied.
Copyright (c) 2013-2018 Delft University of Technology, PO Box 5, 2600 AA, Delft, the Netherlands. All rights reserved.
BSD-style license. See OpenTrafficSim License.
Modifier and Type | Field and Description |
---|---|
static DualBound<Number> |
UNITINTERVAL
Standard dual bound on the unit interval [0...1].
|
Modifier and Type | Method and Description |
---|---|
boolean |
accept(T value)
Checks whether the value complies with constraints.
|
static DualBound<Double> |
closed(double lowerBound,
double upperBound)
Creates a dual bound including the bounds;
lowerBound <= value <= upperBound . |
static <T extends AbstractDoubleScalar<?,?>> |
closed(T lowerBound,
T upperBound)
Creates a dual bound including the bounds;
lowerBound <= value <= upperBound . |
static DualBound<Double> |
leftClosedRightOpen(double lowerBound,
double upperBound)
Creates a dual bound including the lower bound and excluding the upper bound;
lowerBound <= value < upperBound . |
static <T extends AbstractDoubleScalar<?,?>> |
leftClosedRightOpen(T lowerBound,
T upperBound)
Creates a dual bound including the lower bound and excluding the upper bound;
lowerBound <= value < upperBound . |
static DualBound<Double> |
leftOpenRightClosed(double lowerBound,
double upperBound)
Creates a dual bound excluding the lower bound and including the upper bound;
lowerBound < value <= upperBound . |
static <T extends AbstractDoubleScalar<?,?>> |
leftOpenRightClosed(T lowerBound,
T upperBound)
Creates a dual bound excluding the lower bound and including the upper bound;
lowerBound < value <= upperBound . |
static DualBound<Double> |
open(double lowerBound,
double upperBound)
Creates a dual bound excluding the bounds;
lowerBound < value < upperBound . |
static <T extends AbstractDoubleScalar<?,?>> |
open(T lowerBound,
T upperBound)
Creates a dual bound excluding the bounds;
lowerBound < value < upperBound . |
String |
toString() |
failMessage, getBound, lowerExclusive, lowerExclusive, lowerInclusive, lowerInclusive, upperExclusive, upperExclusive, upperInclusive, upperInclusive
public static DualBound<Double> closed(double lowerBound, double upperBound)
lowerBound <= value <= upperBound
. Bounds may be equal.lowerBound
- double; lower bound valueupperBound
- double; upper bound valuepublic static <T extends AbstractDoubleScalar<?,?>> DualBound<T> closed(T lowerBound, T upperBound)
lowerBound <= value <= upperBound
.T
- value typelowerBound
- AbstractDoubleScalar; lower bound valueupperBound
- AbstractDoubleScalar; upper bound valuepublic static DualBound<Double> open(double lowerBound, double upperBound)
lowerBound < value < upperBound
.lowerBound
- double; lower bound valueupperBound
- double; upper bound valuepublic static <T extends AbstractDoubleScalar<?,?>> DualBound<T> open(T lowerBound, T upperBound)
lowerBound < value < upperBound
.T
- value typelowerBound
- AbstractDoubleScalar; lower bound valueupperBound
- AbstractDoubleScalar; upper bound valuepublic static DualBound<Double> leftOpenRightClosed(double lowerBound, double upperBound)
lowerBound < value <= upperBound
.lowerBound
- double; lower bound valueupperBound
- double; upper bound valuepublic static <T extends AbstractDoubleScalar<?,?>> DualBound<T> leftOpenRightClosed(T lowerBound, T upperBound)
lowerBound < value <= upperBound
.T
- value typelowerBound
- AbstractDoubleScalar; lower bound valueupperBound
- AbstractDoubleScalar; upper bound valuepublic static DualBound<Double> leftClosedRightOpen(double lowerBound, double upperBound)
lowerBound <= value < upperBound
.lowerBound
- double; lower bound valueupperBound
- double; upper bound valuepublic static <T extends AbstractDoubleScalar<?,?>> DualBound<T> leftClosedRightOpen(T lowerBound, T upperBound)
lowerBound <= value < upperBound
.T
- value typelowerBound
- AbstractDoubleScalar; lower bound valueupperBound
- AbstractDoubleScalar; upper bound valuepublic boolean accept(T value)
accept
in interface Constraint<T extends Number>
accept
in class SingleBound<T extends Number>
value
- Value to check.public String toString()
toString
in class SingleBound<T extends Number>
Copyright © 2014–2018 Delft University of Technology. All rights reserved.