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-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 | Class and Description |
|---|---|
(package private) static class |
SingleBound.Bound
Super class for classes that implement a specific numeric check.
|
(package private) static class |
SingleBound.LowerBoundExclusive<T extends Number>
Class implementing a lower exclusive bound;
value > bound. |
(package private) static class |
SingleBound.LowerBoundInclusive<T extends Number>
Class implementing a lower inclusive bound;
value >= bound. |
(package private) static class |
SingleBound.UpperBoundExclusive<T extends Number>
Class implementing an upper exclusive bound;
value < bound. |
(package private) static class |
SingleBound.UpperBoundInclusive<T extends Number>
Class implementing an upper inclusive bound;
value <= bound. |
| Constructor and Description |
|---|
SingleBound(SingleBound.Bound bound,
String failMessage)
Constructor.
|
| 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'.
|
SingleBound.Bound |
getBound() |
static SingleBound<Double> |
lowerExclusive(double bound)
Creates a lower exclusive bound;
value > bound. |
static <T extends org.djunits.value.vdouble.scalar.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 org.djunits.value.vdouble.scalar.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 org.djunits.value.vdouble.scalar.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 org.djunits.value.vdouble.scalar.AbstractDoubleScalar<?,?>> |
upperInclusive(T bound)
Creates an upper inclusive bound;
value <= bound. |
SingleBound(SingleBound.Bound bound, String failMessage)
bound - Bound; boundfailMessage - String; message about values that do not comply with the boundpublic static final SingleBound<Double> lowerInclusive(double bound)
value >= bound.bound - double; bound valuepublic static final <T extends org.djunits.value.vdouble.scalar.AbstractDoubleScalar<?,?>> SingleBound<T> lowerInclusive(T bound)
value >= bound.T - value typebound - AbstractDoubleScalar; bound valuepublic static final SingleBound<Double> lowerExclusive(double bound)
value > bound.bound - double; bound valuepublic static final <T extends org.djunits.value.vdouble.scalar.AbstractDoubleScalar<?,?>> SingleBound<T> lowerExclusive(T bound)
value > bound.T - value typebound - AbstractDoubleScalar; bound valuepublic static final SingleBound<Double> upperInclusive(double bound)
value <= bound.bound - double; bound valuepublic static final <T extends org.djunits.value.vdouble.scalar.AbstractDoubleScalar<?,?>> SingleBound<T> upperInclusive(T bound)
value <= bound.T - value typebound - AbstractDoubleScalar; bound valuepublic static final SingleBound<Double> upperExclusive(double bound)
value < bound.bound - double; bound valuepublic static final <T extends org.djunits.value.vdouble.scalar.AbstractDoubleScalar<?,?>> SingleBound<T> upperExclusive(T bound)
value < bound.T - value typebound - AbstractDoubleScalar; bound valuepublic boolean accept(T value)
accept in interface Constraint<T extends Number>value - Value to check.public String failMessage()
failMessage in interface Constraint<T extends Number>public SingleBound.Bound getBound()
Copyright © 2014–2018 Delft University of Technology. All rights reserved.