public abstract class DoubleExpression extends NumberExpressionBase
DoubleExpression
is an
javafx.beans.value.ObservableDoubleValue
plus additional convenience
methods to generate bindings in a fluent style.
A concrete sub-class of DoubleExpression
has to implement the method
javafx.beans.value.ObservableDoubleValue#get()
, which provides the
actual value of this expression.
Constructor and Description |
---|
DoubleExpression() |
Modifier and Type | Method and Description |
---|---|
DoubleBinding |
add(ObservableNumberValue other)
Creates a new
NumberBinding that calculates
the sum of this NumberExpression and another
javafx.beans.value.ObservableNumberValue . |
ObjectExpression<java.lang.Double> |
asObject()
Creates an
ObjectExpression that holds the value
of this DoubleExpression . |
DoubleBinding |
divide(ObservableNumberValue other)
Creates a new
NumberBinding that calculates
the division of this NumberExpression and another
javafx.beans.value.ObservableNumberValue . |
static <T extends java.lang.Number> |
doubleExpression(<any> value)
Returns a
DoubleExpression that wraps an
javafx.beans.value.ObservableValue . |
static DoubleExpression |
doubleExpression(ObservableDoubleValue value)
Returns a
DoubleExpression that wraps a
javafx.beans.value.ObservableDoubleValue . |
double |
doubleValue() |
float |
floatValue() |
java.lang.Double |
getValue() |
int |
intValue() |
long |
longValue() |
DoubleBinding |
multiply(ObservableNumberValue other)
Creates a new
NumberBinding that calculates
the product of this NumberExpression and another
javafx.beans.value.ObservableNumberValue . |
DoubleBinding |
negate()
Creates a new
NumberBinding that calculates
the negation of NumberExpression . |
DoubleBinding |
subtract(ObservableNumberValue other)
Creates a new
NumberBinding that calculates
the difference of this NumberExpression and another
javafx.beans.value.ObservableNumberValue . |
asString, asString, asString, greaterThan, greaterThanOrEqualTo, isEqualTo, isEqualTo, isNotEqualTo, isNotEqualTo, lessThan, lessThanOrEqualTo, numberExpression
public int intValue()
public long longValue()
public float floatValue()
public double doubleValue()
public java.lang.Double getValue()
public static DoubleExpression doubleExpression(ObservableDoubleValue value)
DoubleExpression
that wraps a
javafx.beans.value.ObservableDoubleValue
. If the
ObservableDoubleValue
is already a DoubleExpression
, it
will be returned. Otherwise a new
DoubleBinding
is created that is bound to
the ObservableDoubleValue
.value
- The source ObservableDoubleValue
DoubleExpression
that wraps the
ObservableDoubleValue
if necessaryjava.lang.NullPointerException
- if value
is null
public static <T extends java.lang.Number> DoubleExpression doubleExpression(<any> value)
DoubleExpression
that wraps an
javafx.beans.value.ObservableValue
. If the
ObservableValue
is already a DoubleExpression
, it
will be returned. Otherwise a new
DoubleBinding
is created that is bound to
the ObservableValue
.
Note: this method can be used to convert an ObjectExpression
or
javafx.beans.property.ObjectProperty
of specific number type to DoubleExpression, which
is essentially an ObservableValue<Number>
. See sample below.
Note: null values will be interpreted as 0.0DoubleProperty doubleProperty = new SimpleDoubleProperty(1.0); ObjectProperty<Double> objectProperty = new SimpleObjectProperty<>(2.0); BooleanBinding binding = doubleProperty.greaterThan(DoubleExpression.doubleExpression(objectProperty));
T
- The type of Number to be wrappedvalue
- The source ObservableValue
DoubleExpression
that wraps the
ObservableValue
if necessaryjava.lang.NullPointerException
- if value
is null
public DoubleBinding negate()
NumberExpression
NumberBinding
that calculates
the negation of NumberExpression
.NumberBinding
public DoubleBinding add(ObservableNumberValue other)
NumberExpression
NumberBinding
that calculates
the sum of this NumberExpression
and another
javafx.beans.value.ObservableNumberValue
.add
in interface NumberExpression
add
in class NumberExpressionBase
other
- the second ObservableNumberValue
NumberBinding
public DoubleBinding subtract(ObservableNumberValue other)
NumberExpression
NumberBinding
that calculates
the difference of this NumberExpression
and another
javafx.beans.value.ObservableNumberValue
.subtract
in interface NumberExpression
subtract
in class NumberExpressionBase
other
- the second ObservableNumberValue
NumberBinding
public DoubleBinding multiply(ObservableNumberValue other)
NumberExpression
NumberBinding
that calculates
the product of this NumberExpression
and another
javafx.beans.value.ObservableNumberValue
.multiply
in interface NumberExpression
multiply
in class NumberExpressionBase
other
- the second ObservableNumberValue
NumberBinding
public DoubleBinding divide(ObservableNumberValue other)
NumberExpression
NumberBinding
that calculates
the division of this NumberExpression
and another
javafx.beans.value.ObservableNumberValue
.divide
in interface NumberExpression
divide
in class NumberExpressionBase
other
- the second ObservableNumberValue
NumberBinding
public ObjectExpression<java.lang.Double> asObject()
ObjectExpression
that holds the value
of this DoubleExpression
. If the
value of this DoubleExpression
changes, the value of the
ObjectExpression
will be updated automatically.ObjectExpression