public abstract class NumberExpressionBase extends java.lang.Object implements NumberExpression
NumberExpressionBase
contains convenience methods to generate bindings in a fluent style,
that are common to all NumberExpression subclasses.
NumberExpressionBase serves as a place for common code of specific NumberExpression subclasses for the specific number type.
IntegerExpression
,
LongExpression
,
FloatExpression
,
DoubleExpression
Constructor and Description |
---|
NumberExpressionBase() |
Modifier and Type | Method and Description |
---|---|
NumberBinding |
add(ObservableNumberValue other)
Creates a new
NumberBinding that calculates
the sum of this NumberExpression and another
javafx.beans.value.ObservableNumberValue . |
StringBinding |
asString()
|
StringBinding |
asString(java.util.Locale locale,
java.lang.String format)
|
StringBinding |
asString(java.lang.String format)
|
NumberBinding |
divide(ObservableNumberValue other)
Creates a new
NumberBinding that calculates
the division of this NumberExpression and another
javafx.beans.value.ObservableNumberValue . |
BooleanBinding |
greaterThan(ObservableNumberValue other)
Creates a new
BooleanBinding that holds true
if this NumberExpression is greater than another
javafx.beans.value.ObservableNumberValue . |
BooleanBinding |
greaterThanOrEqualTo(ObservableNumberValue other)
Creates a new
BooleanBinding that holds true
if this NumberExpression is greater than or equal to another
javafx.beans.value.ObservableNumberValue . |
BooleanBinding |
isEqualTo(ObservableNumberValue other)
Creates a new
BooleanBinding that holds true
if this and another javafx.beans.value.ObservableNumberValue are
equal. |
BooleanBinding |
isEqualTo(ObservableNumberValue other,
double epsilon)
Creates a new
BooleanBinding that holds true
if this and another javafx.beans.value.ObservableNumberValue are
equal (with a tolerance). |
BooleanBinding |
isNotEqualTo(ObservableNumberValue other)
Creates a new
BooleanBinding that holds true
if this and another javafx.beans.value.ObservableNumberValue are
not equal. |
BooleanBinding |
isNotEqualTo(ObservableNumberValue other,
double epsilon)
Creates a new
BooleanBinding that holds true
if this and another javafx.beans.value.ObservableNumberValue are
not equal (with a tolerance). |
BooleanBinding |
lessThan(ObservableNumberValue other)
Creates a new
BooleanBinding that holds true
if this NumberExpression is lesser than another
javafx.beans.value.ObservableNumberValue . |
BooleanBinding |
lessThanOrEqualTo(ObservableNumberValue other)
Creates a new
BooleanBinding that holds true
if this NumberExpression is less than or equal to another
javafx.beans.value.ObservableNumberValue . |
NumberBinding |
multiply(ObservableNumberValue other)
Creates a new
NumberBinding that calculates
the product of this NumberExpression and another
javafx.beans.value.ObservableNumberValue . |
static <S extends java.lang.Number> |
numberExpression(ObservableNumberValue value)
Returns an
NumberExpressionBase that wraps a
javafx.beans.value.ObservableNumberValue . |
NumberBinding |
subtract(ObservableNumberValue other)
Creates a new
NumberBinding that calculates
the difference of this NumberExpression and another
javafx.beans.value.ObservableNumberValue . |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
negate
public static <S extends java.lang.Number> NumberExpressionBase numberExpression(ObservableNumberValue value)
NumberExpressionBase
that wraps a
javafx.beans.value.ObservableNumberValue
. If the
ObservableNumberValue
is already an instance of
NumberExpressionBase
, it will be returned. Otherwise a new
NumberBinding
is created that is bound to
the ObservableNumberValue
.S
- The type of Number to be wrappedvalue
- The source ObservableNumberValue
NumberExpressionBase
that wraps the
ObservableNumberValue
if necessaryjava.lang.NullPointerException
- if value
is null
public NumberBinding add(ObservableNumberValue other)
NumberExpression
NumberBinding
that calculates
the sum of this NumberExpression
and another
javafx.beans.value.ObservableNumberValue
.add
in interface NumberExpression
other
- the second ObservableNumberValue
NumberBinding
public NumberBinding subtract(ObservableNumberValue other)
NumberExpression
NumberBinding
that calculates
the difference of this NumberExpression
and another
javafx.beans.value.ObservableNumberValue
.subtract
in interface NumberExpression
other
- the second ObservableNumberValue
NumberBinding
public NumberBinding multiply(ObservableNumberValue other)
NumberExpression
NumberBinding
that calculates
the product of this NumberExpression
and another
javafx.beans.value.ObservableNumberValue
.multiply
in interface NumberExpression
other
- the second ObservableNumberValue
NumberBinding
public NumberBinding divide(ObservableNumberValue other)
NumberExpression
NumberBinding
that calculates
the division of this NumberExpression
and another
javafx.beans.value.ObservableNumberValue
.divide
in interface NumberExpression
other
- the second ObservableNumberValue
NumberBinding
public BooleanBinding isEqualTo(ObservableNumberValue other)
NumberExpression
BooleanBinding
that holds true
if this and another javafx.beans.value.ObservableNumberValue
are
equal.
When comparing floating-point numbers it is recommended to use the
isEqualTo()
method that
allows a small tolerance.
isEqualTo
in interface NumberExpression
other
- the second ObservableNumberValue
BooleanBinding
public BooleanBinding isEqualTo(ObservableNumberValue other, double epsilon)
NumberExpression
BooleanBinding
that holds true
if this and another javafx.beans.value.ObservableNumberValue
are
equal (with a tolerance).
Two operands a
and b
are considered equal if
Math.abs(a-b) <= epsilon
.
Allowing a small tolerance is recommended when comparing floating-point numbers because of rounding-errors.
isEqualTo
in interface NumberExpression
other
- the second ObservableNumberValue
epsilon
- the toleranceBooleanBinding
public BooleanBinding isNotEqualTo(ObservableNumberValue other)
NumberExpression
BooleanBinding
that holds true
if this and another javafx.beans.value.ObservableNumberValue
are
not equal.
When comparing floating-point numbers it is recommended to use the
isNotEqualTo()
method that allows a small tolerance.
isNotEqualTo
in interface NumberExpression
other
- the second ObservableNumberValue
BooleanBinding
public BooleanBinding isNotEqualTo(ObservableNumberValue other, double epsilon)
NumberExpression
BooleanBinding
that holds true
if this and another javafx.beans.value.ObservableNumberValue
are
not equal (with a tolerance).
Two operands a
and b
are considered not equal if
Math.abs(a-b) > epsilon
.
Allowing a small tolerance is recommended when comparing floating-point numbers because of rounding-errors.
isNotEqualTo
in interface NumberExpression
other
- the second ObservableNumberValue
epsilon
- the permitted toleranceBooleanBinding
public BooleanBinding greaterThan(ObservableNumberValue other)
NumberExpression
BooleanBinding
that holds true
if this NumberExpression
is greater than another
javafx.beans.value.ObservableNumberValue
.greaterThan
in interface NumberExpression
other
- the second ObservableNumberValue
BooleanBinding
public BooleanBinding lessThan(ObservableNumberValue other)
NumberExpression
BooleanBinding
that holds true
if this NumberExpression
is lesser than another
javafx.beans.value.ObservableNumberValue
.lessThan
in interface NumberExpression
other
- the second ObservableNumberValue
BooleanBinding
public BooleanBinding greaterThanOrEqualTo(ObservableNumberValue other)
NumberExpression
BooleanBinding
that holds true
if this NumberExpression
is greater than or equal to another
javafx.beans.value.ObservableNumberValue
.greaterThanOrEqualTo
in interface NumberExpression
other
- the second ObservableNumberValue
BooleanBinding
public BooleanBinding lessThanOrEqualTo(ObservableNumberValue other)
NumberExpression
BooleanBinding
that holds true
if this NumberExpression
is less than or equal to another
javafx.beans.value.ObservableNumberValue
.lessThanOrEqualTo
in interface NumberExpression
other
- the second ObservableNumberValue
BooleanBinding
public StringBinding asString()
NumberExpression
StringBinding
that holds the value
of the NumberExpression
turned into a String
. If the
value of this NumberExpression
changes, the value of the
StringBinding
will be updated automatically.
The conversion is done without any formatting applied.
asString
in interface NumberExpression
StringBinding
public StringBinding asString(java.lang.String format)
NumberExpression
StringBinding
that holds the value
of the NumberExpression
turned into a String
. If the
value of this NumberExpression
changes, the value of the
StringBinding
will be updated automatically.
The result is formatted according to the formatting String
. See
java.util.Formatter
for formatting rules.
asString
in interface NumberExpression
format
- the formatting String
StringBinding
public StringBinding asString(java.util.Locale locale, java.lang.String format)
NumberExpression
StringBinding
that holds the value
of the NumberExpression
turned into a String
. If the
value of this NumberExpression
changes, the value of the
StringBinding
will be updated automatically.
The result is formatted according to the formatting String
and
the passed in Locale
. See java.util.Formatter
for
formatting rules. See java.util.Locale
for details on
Locale
.
asString
in interface NumberExpression
locale
- the Locale to be usedformat
- the formatting String
StringBinding