T
- value typepublic class SingleBound<T extends Number> extends Object implements Constraint<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-2019 Delft University of Technology, PO Box 5, 2600 AA, Delft, the Netherlands. All rights reserved.
BSD-style license. See OpenTrafficSim License.
Modifier and Type | Method and Description |
---|---|
boolean |
accept(T value)
Checks whether the value complies with constraints.
|
String |
failMessage()
Returns a message for value failure, pointing to a parameter using '%s'.
|
org.opentrafficsim.base.parameters.constraint.SingleBound.Bound |
getBound() |
static SingleBound<Double> |
lowerExclusive(double bound)
Creates a lower exclusive bound;
value > bound . |
static <T extends AbstractDoubleScalar<?,?>> |
lowerExclusive(T bound)
Creates a lower exclusive bound;
value > bound . |
static SingleBound<Double> |
lowerInclusive(double bound)
Creates a lower inclusive bound;
value >= bound . |
static <T extends AbstractDoubleScalar<?,?>> |
lowerInclusive(T bound)
Creates a lower inclusive bound;
value >= bound . |
String |
toString() |
static SingleBound<Double> |
upperExclusive(double bound)
Creates an upper exclusive bound;
value < bound . |
static <T extends AbstractDoubleScalar<?,?>> |
upperExclusive(T bound)
Creates an upper exclusive bound;
value < bound . |
static SingleBound<Double> |
upperInclusive(double bound)
Creates an upper inclusive bound;
value <= bound . |
static <T extends AbstractDoubleScalar<?,?>> |
upperInclusive(T bound)
Creates an upper inclusive bound;
value <= bound . |
public static final SingleBound<Double> lowerInclusive(double bound)
value >= bound
.bound
- double; bound valuepublic static final <T extends AbstractDoubleScalar<?,?>> SingleBound<T> lowerInclusive(T bound)
value >= bound
.T
- value typebound
- T; bound valuepublic static final SingleBound<Double> lowerExclusive(double bound)
value > bound
.bound
- double; bound valuepublic static final <T extends AbstractDoubleScalar<?,?>> SingleBound<T> lowerExclusive(T bound)
value > bound
.T
- value typebound
- T; bound valuepublic static final SingleBound<Double> upperInclusive(double bound)
value <= bound
.bound
- double; bound valuepublic static final <T extends AbstractDoubleScalar<?,?>> SingleBound<T> upperInclusive(T bound)
value <= bound
.T
- value typebound
- T; bound valuepublic static final SingleBound<Double> upperExclusive(double bound)
value < bound
.bound
- double; bound valuepublic static final <T extends AbstractDoubleScalar<?,?>> SingleBound<T> upperExclusive(T bound)
value < bound
.T
- value typebound
- T; bound valuepublic boolean accept(T value)
accept
in interface Constraint<T extends Number>
value
- T; Value to check.public String failMessage()
failMessage
in interface Constraint<T extends Number>
public org.opentrafficsim.base.parameters.constraint.SingleBound.Bound getBound()
Copyright © 2014–2019 Delft University of Technology. All rights reserved.