public interface NumberExpression extends ObservableNumberValue
NumberExpression is a
ObservableNumberValue plus additional convenience
methods to generate bindings in a fluent style.
This API allows to mix types when defining arithmetic operations. The type of the result is defined by the same rules as in the Java Language.
To be able to deal with an unspecified return type, two interfaces
NumberExpression and its counterpart
NumberBinding were introduced. That means if the
return type is specified as NumberBinding, the method will either
return a DoubleBinding,
FloatBinding,
LongBinding or
IntegerBinding, depending on the types of the
operands.
The API tries to do its best in determining the correct return type, e.g.
combining a ObservableNumberValue with a primitive
double will always result in a DoubleBinding. In
cases where the return type is not known by the API, it is the responsibility
of the developer to call the correct getter (ObservableNumberValue.intValue() etc.). If
the internal representation does not match the type of the getter, a standard
cast is done.
| Modifier and Type | Method and Description |
|---|---|
NumberBinding |
add(double other)
Creates a new
NumberBinding that calculates
the sum of this NumberExpression and a constant value. |
NumberBinding |
add(float other)
Creates a new
NumberBinding that calculates
the sum of this NumberExpression and a constant value. |
NumberBinding |
add(int other)
Creates a new
NumberBinding that calculates
the sum of this NumberExpression and a constant value. |
NumberBinding |
add(long other)
Creates a new
NumberBinding that calculates
the sum of this NumberExpression and a constant value. |
NumberBinding |
add(ObservableNumberValue other)
Creates a new
NumberBinding that calculates
the sum of this NumberExpression and another
ObservableNumberValue. |
StringBinding |
asString()
|
StringBinding |
asString(Locale locale,
String format)
|
StringBinding |
asString(String format)
|
NumberBinding |
divide(double other)
Creates a new
NumberBinding that calculates
the division of this NumberExpression and a constant value. |
NumberBinding |
divide(float other)
Creates a new
NumberBinding that calculates
the division of this NumberExpression and a constant value. |
NumberBinding |
divide(int other)
Creates a new
NumberBinding that calculates
the division of this NumberExpression and a constant value. |
NumberBinding |
divide(long other)
Creates a new
NumberBinding that calculates
the division of this NumberExpression and a constant value. |
NumberBinding |
divide(ObservableNumberValue other)
Creates a new
NumberBinding that calculates
the division of this NumberExpression and another
ObservableNumberValue. |
BooleanBinding |
greaterThan(double other)
Creates a new
BooleanBinding that holds true
if this NumberExpression is greater than a constant value. |
BooleanBinding |
greaterThan(float other)
Creates a new
BooleanBinding that holds true
if this NumberExpression is greater than a constant value. |
BooleanBinding |
greaterThan(int other)
Creates a new
BooleanBinding that holds true
if this NumberExpression is greater than a constant value. |
BooleanBinding |
greaterThan(long other)
Creates a new
BooleanBinding that holds true
if this NumberExpression is greater than a constant value. |
BooleanBinding |
greaterThan(ObservableNumberValue other)
Creates a new
BooleanBinding that holds true
if this NumberExpression is greater than another
ObservableNumberValue. |
BooleanBinding |
greaterThanOrEqualTo(double other)
Creates a new
BooleanBinding that holds true
if this NumberExpression is greater than or equal to a constant
value. |
BooleanBinding |
greaterThanOrEqualTo(float other)
Creates a new
BooleanBinding that holds true
if this NumberExpression is greater than or equal to a constant
value. |
BooleanBinding |
greaterThanOrEqualTo(int other)
Creates a new
BooleanBinding that holds true
if this NumberExpression is greater than or equal to a constant
value. |
BooleanBinding |
greaterThanOrEqualTo(long other)
Creates a new
BooleanBinding that holds true
if this NumberExpression is greater than or equal to a constant
value. |
BooleanBinding |
greaterThanOrEqualTo(ObservableNumberValue other)
Creates a new
BooleanBinding that holds true
if this NumberExpression is greater than or equal to another
ObservableNumberValue. |
BooleanBinding |
isEqualTo(double other,
double epsilon)
Creates a new
BooleanBinding that holds true
if this NumberExpression is equal to a constant value (with a
tolerance). |
BooleanBinding |
isEqualTo(float other,
double epsilon)
Creates a new
BooleanBinding that holds true
if this NumberExpression is equal to a constant value (with a
tolerance). |
BooleanBinding |
isEqualTo(int other)
|
BooleanBinding |
isEqualTo(int other,
double epsilon)
Creates a new
BooleanBinding that holds true
if this NumberExpression is equal to a constant value (with a
tolerance). |
BooleanBinding |
isEqualTo(long other)
|
BooleanBinding |
isEqualTo(long other,
double epsilon)
Creates a new
BooleanBinding that holds true
if this NumberExpression is equal to a constant value (with a
tolerance). |
BooleanBinding |
isEqualTo(ObservableNumberValue other)
|
BooleanBinding |
isEqualTo(ObservableNumberValue other,
double epsilon)
Creates a new
BooleanBinding that holds true
if this and another ObservableNumberValue are
equal (with a tolerance). |
BooleanBinding |
isNotEqualTo(double other,
double epsilon)
Creates a new
BooleanBinding that holds true
if this NumberExpression is not equal to a constant value (with a
tolerance). |
BooleanBinding |
isNotEqualTo(float other,
double epsilon)
Creates a new
BooleanBinding that holds true
if this NumberExpression is not equal to a constant value (with a
tolerance). |
BooleanBinding |
isNotEqualTo(int other)
Creates a new
BooleanBinding that holds true
if this NumberExpression is not equal to a constant value. |
BooleanBinding |
isNotEqualTo(int other,
double epsilon)
Creates a new
BooleanBinding that holds true
if this NumberExpression is not equal to a constant value (with a
tolerance). |
BooleanBinding |
isNotEqualTo(long other)
Creates a new
BooleanBinding that holds true
if this NumberExpression is not equal to a constant value. |
BooleanBinding |
isNotEqualTo(long other,
double epsilon)
Creates a new
BooleanBinding that holds true
if this NumberExpression is not equal to a constant value (with a
tolerance). |
BooleanBinding |
isNotEqualTo(ObservableNumberValue other)
Creates a new
BooleanBinding that holds true
if this and another ObservableNumberValue are
not equal. |
BooleanBinding |
isNotEqualTo(ObservableNumberValue other,
double epsilon)
Creates a new
BooleanBinding that holds true
if this and another ObservableNumberValue are
not equal (with a tolerance). |
BooleanBinding |
lessThan(double other)
Creates a new
BooleanBinding that holds true
if this NumberExpression is lesser than a constant value. |
BooleanBinding |
lessThan(float other)
Creates a new
BooleanBinding that holds true
if this NumberExpression is lesser than a constant value. |
BooleanBinding |
lessThan(int other)
Creates a new
BooleanBinding that holds true
if this NumberExpression is lesser than a constant value. |
BooleanBinding |
lessThan(long other)
Creates a new
BooleanBinding that holds true
if this NumberExpression is lesser than a constant value. |
BooleanBinding |
lessThan(ObservableNumberValue other)
Creates a new
BooleanBinding that holds true
if this NumberExpression is lesser than another
ObservableNumberValue. |
BooleanBinding |
lessThanOrEqualTo(double other)
Creates a new
BooleanBinding that holds true
if this NumberExpression is less than or equal to a constant
value. |
BooleanBinding |
lessThanOrEqualTo(float other)
Creates a new
BooleanBinding that holds true
if this NumberExpression is less than or equal to a constant
value. |
BooleanBinding |
lessThanOrEqualTo(int other)
Creates a new
BooleanBinding that holds true
if this NumberExpression is less than or equal to a constant
value. |
BooleanBinding |
lessThanOrEqualTo(long other)
Creates a new
BooleanBinding that holds true
if this NumberExpression is less than or equal to a constant
value. |
BooleanBinding |
lessThanOrEqualTo(ObservableNumberValue other)
Creates a new
BooleanBinding that holds true
if this NumberExpression is less than or equal to another
ObservableNumberValue. |
NumberBinding |
multiply(double other)
Creates a new
NumberBinding that calculates
the product of this NumberExpression and a constant value. |
NumberBinding |
multiply(float other)
Creates a new
NumberBinding that calculates
the product of this NumberExpression and a constant value. |
NumberBinding |
multiply(int other)
Creates a new
NumberBinding that calculates
the product of this NumberExpression and a constant value. |
NumberBinding |
multiply(long other)
Creates a new
NumberBinding that calculates
the product of this NumberExpression and a constant value. |
NumberBinding |
multiply(ObservableNumberValue other)
Creates a new
NumberBinding that calculates
the product of this NumberExpression and another
ObservableNumberValue. |
NumberBinding |
negate()
Creates a new
NumberBinding that calculates
the negation of NumberExpression. |
NumberBinding |
subtract(double other)
Creates a new
NumberBinding that calculates
the difference of this NumberExpression and a constant value. |
NumberBinding |
subtract(float other)
Creates a new
NumberBinding that calculates
the difference of this NumberExpression and a constant value. |
NumberBinding |
subtract(int other)
Creates a new
NumberBinding that calculates
the difference of this NumberExpression and a constant value. |
NumberBinding |
subtract(long other)
Creates a new
NumberBinding that calculates
the difference of this NumberExpression and a constant value. |
NumberBinding |
subtract(ObservableNumberValue other)
Creates a new
NumberBinding that calculates
the difference of this NumberExpression and another
ObservableNumberValue. |
doubleValue, floatValue, intValue, longValueaddListener, getValue, removeListeneraddListener, removeListenerNumberBinding negate()
NumberBinding that calculates
the negation of NumberExpression.NumberBindingNumberBinding add(ObservableNumberValue other)
NumberBinding that calculates
the sum of this NumberExpression and another
ObservableNumberValue.other - the second ObservableNumberValueNumberBindingNullPointerException - if the other ObservableNumberValue is nullNumberBinding add(double other)
NumberBinding that calculates
the sum of this NumberExpression and a constant value.other - the constant valueNumberBindingNumberBinding add(float other)
NumberBinding that calculates
the sum of this NumberExpression and a constant value.other - the constant valueNumberBindingNumberBinding add(long other)
NumberBinding that calculates
the sum of this NumberExpression and a constant value.other - the constant valueNumberBindingNumberBinding add(int other)
NumberBinding that calculates
the sum of this NumberExpression and a constant value.other - the constant valueNumberBindingNumberBinding subtract(ObservableNumberValue other)
NumberBinding that calculates
the difference of this NumberExpression and another
ObservableNumberValue.other - the second ObservableNumberValueNumberBindingNullPointerException - if the other ObservableNumberValue is nullNumberBinding subtract(double other)
NumberBinding that calculates
the difference of this NumberExpression and a constant value.other - the constant valueNumberBindingNumberBinding subtract(float other)
NumberBinding that calculates
the difference of this NumberExpression and a constant value.other - the constant valueNumberBindingNumberBinding subtract(long other)
NumberBinding that calculates
the difference of this NumberExpression and a constant value.other - the constant valueNumberBindingNumberBinding subtract(int other)
NumberBinding that calculates
the difference of this NumberExpression and a constant value.other - the constant valueNumberBindingNumberBinding multiply(ObservableNumberValue other)
NumberBinding that calculates
the product of this NumberExpression and another
ObservableNumberValue.other - the second ObservableNumberValueNumberBindingNullPointerException - if the other ObservableNumberValue is nullNumberBinding multiply(double other)
NumberBinding that calculates
the product of this NumberExpression and a constant value.other - the constant valueNumberBindingNumberBinding multiply(float other)
NumberBinding that calculates
the product of this NumberExpression and a constant value.other - the constant valueNumberBindingNumberBinding multiply(long other)
NumberBinding that calculates
the product of this NumberExpression and a constant value.other - the constant valueNumberBindingNumberBinding multiply(int other)
NumberBinding that calculates
the product of this NumberExpression and a constant value.other - the constant valueNumberBindingNumberBinding divide(ObservableNumberValue other)
NumberBinding that calculates
the division of this NumberExpression and another
ObservableNumberValue.other - the second ObservableNumberValueNumberBindingNullPointerException - if the other ObservableNumberValue is nullNumberBinding divide(double other)
NumberBinding that calculates
the division of this NumberExpression and a constant value.other - the constant valueNumberBindingNumberBinding divide(float other)
NumberBinding that calculates
the division of this NumberExpression and a constant value.other - the constant valueNumberBindingNumberBinding divide(long other)
NumberBinding that calculates
the division of this NumberExpression and a constant value.other - the constant valueNumberBindingNumberBinding divide(int other)
NumberBinding that calculates
the division of this NumberExpression and a constant value.other - the constant valueNumberBindingBooleanBinding isEqualTo(ObservableNumberValue other)
BooleanBinding that holds true
if this and another ObservableNumberValue are
equal.
When comparing floating-point numbers it is recommended to use the
isEqualTo() method that
allows a small tolerance.
other - the second ObservableNumberValueBooleanBindingNullPointerException - if the other ObservableNumberValue is nullBooleanBinding isEqualTo(ObservableNumberValue other, double epsilon)
BooleanBinding that holds true
if this and another 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.
other - the second ObservableNumberValueepsilon - the toleranceBooleanBindingNullPointerException - if the other ObservableNumberValue is nullBooleanBinding isEqualTo(double other, double epsilon)
BooleanBinding that holds true
if this NumberExpression is equal to a constant value (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.
other - the constant valueepsilon - the permitted toleranceBooleanBindingBooleanBinding isEqualTo(float other, double epsilon)
BooleanBinding that holds true
if this NumberExpression is equal to a constant value (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.
other - the constant valueepsilon - the permitted toleranceBooleanBindingBooleanBinding isEqualTo(long other)
BooleanBinding that holds true
if this NumberExpression is equal to a constant value.
When comparing floating-point numbers it is recommended to use the
isEqualTo() method that allows a small
tolerance.
other - the constant valueBooleanBindingBooleanBinding isEqualTo(long other, double epsilon)
BooleanBinding that holds true
if this NumberExpression is equal to a constant value (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.
other - the constant valueepsilon - the permitted toleranceBooleanBindingBooleanBinding isEqualTo(int other)
BooleanBinding that holds true
if this NumberExpression is equal to a constant value.
When comparing floating-point numbers it is recommended to use the
isEqualTo() method that allows a small
tolerance.
other - the constant valueBooleanBindingBooleanBinding isEqualTo(int other, double epsilon)
BooleanBinding that holds true
if this NumberExpression is equal to a constant value (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.
other - the constant valueepsilon - the permitted toleranceBooleanBindingBooleanBinding isNotEqualTo(ObservableNumberValue other)
BooleanBinding that holds true
if this and another ObservableNumberValue are
not equal.
When comparing floating-point numbers it is recommended to use the
isNotEqualTo()
method that allows a small tolerance.
other - the second ObservableNumberValueBooleanBindingNullPointerException - if the other ObservableNumberValue is nullBooleanBinding isNotEqualTo(ObservableNumberValue other, double epsilon)
BooleanBinding that holds true
if this and another 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.
other - the second ObservableNumberValueepsilon - the permitted toleranceBooleanBindingNullPointerException - if the other ObservableNumberValue is nullBooleanBinding isNotEqualTo(double other, double epsilon)
BooleanBinding that holds true
if this NumberExpression is not equal to a constant value (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.
other - the constant valueepsilon - the permitted toleranceBooleanBindingBooleanBinding isNotEqualTo(float other, double epsilon)
BooleanBinding that holds true
if this NumberExpression is not equal to a constant value (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.
other - the constant valueepsilon - the permitted toleranceBooleanBindingBooleanBinding isNotEqualTo(long other)
BooleanBinding that holds true
if this NumberExpression is not equal to a constant value.
When comparing floating-point numbers it is recommended to use the
isNotEqualTo() method that allows a
small tolerance.
other - the constant valueBooleanBindingBooleanBinding isNotEqualTo(long other, double epsilon)
BooleanBinding that holds true
if this NumberExpression is not equal to a constant value (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.
other - the constant valueepsilon - the permitted toleranceBooleanBindingBooleanBinding isNotEqualTo(int other)
BooleanBinding that holds true
if this NumberExpression is not equal to a constant value.
When comparing floating-point numbers it is recommended to use the
isNotEqualTo() method that allows a
small tolerance.
other - the constant valueBooleanBindingBooleanBinding isNotEqualTo(int other, double epsilon)
BooleanBinding that holds true
if this NumberExpression is not equal to a constant value (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.
other - the constant valueepsilon - the permitted toleranceBooleanBindingBooleanBinding greaterThan(ObservableNumberValue other)
BooleanBinding that holds true
if this NumberExpression is greater than another
ObservableNumberValue.other - the second ObservableNumberValueBooleanBindingNullPointerException - if the other ObservableNumberValue is nullBooleanBinding greaterThan(double other)
BooleanBinding that holds true
if this NumberExpression is greater than a constant value.other - the constant valueBooleanBindingBooleanBinding greaterThan(float other)
BooleanBinding that holds true
if this NumberExpression is greater than a constant value.other - the constant valueBooleanBindingBooleanBinding greaterThan(long other)
BooleanBinding that holds true
if this NumberExpression is greater than a constant value.other - the constant valueBooleanBindingBooleanBinding greaterThan(int other)
BooleanBinding that holds true
if this NumberExpression is greater than a constant value.other - the constant valueBooleanBindingBooleanBinding lessThan(ObservableNumberValue other)
BooleanBinding that holds true
if this NumberExpression is lesser than another
ObservableNumberValue.other - the second ObservableNumberValueBooleanBindingNullPointerException - if the other ObservableNumberValue is nullBooleanBinding lessThan(double other)
BooleanBinding that holds true
if this NumberExpression is lesser than a constant value.other - the constant valueBooleanBindingBooleanBinding lessThan(float other)
BooleanBinding that holds true
if this NumberExpression is lesser than a constant value.other - the constant valueBooleanBindingBooleanBinding lessThan(long other)
BooleanBinding that holds true
if this NumberExpression is lesser than a constant value.other - the constant valueBooleanBindingBooleanBinding lessThan(int other)
BooleanBinding that holds true
if this NumberExpression is lesser than a constant value.other - the constant valueBooleanBindingBooleanBinding greaterThanOrEqualTo(ObservableNumberValue other)
BooleanBinding that holds true
if this NumberExpression is greater than or equal to another
ObservableNumberValue.other - the second ObservableNumberValueBooleanBindingNullPointerException - if the other ObservableNumberValue is nullBooleanBinding greaterThanOrEqualTo(double other)
BooleanBinding that holds true
if this NumberExpression is greater than or equal to a constant
value.other - the constant valueBooleanBindingBooleanBinding greaterThanOrEqualTo(float other)
BooleanBinding that holds true
if this NumberExpression is greater than or equal to a constant
value.other - the constant valueBooleanBindingBooleanBinding greaterThanOrEqualTo(long other)
BooleanBinding that holds true
if this NumberExpression is greater than or equal to a constant
value.other - the constant valueBooleanBindingBooleanBinding greaterThanOrEqualTo(int other)
BooleanBinding that holds true
if this NumberExpression is greater than or equal to a constant
value.other - the constant valueBooleanBindingBooleanBinding lessThanOrEqualTo(ObservableNumberValue other)
BooleanBinding that holds true
if this NumberExpression is less than or equal to another
ObservableNumberValue.other - the second ObservableNumberValueBooleanBindingNullPointerException - if the other ObservableNumberValue is nullBooleanBinding lessThanOrEqualTo(double other)
BooleanBinding that holds true
if this NumberExpression is less than or equal to a constant
value.other - the constant valueBooleanBindingBooleanBinding lessThanOrEqualTo(float other)
BooleanBinding that holds true
if this NumberExpression is less than or equal to a constant
value.other - the constant valueBooleanBindingBooleanBinding lessThanOrEqualTo(long other)
BooleanBinding that holds true
if this NumberExpression is less than or equal to a constant
value.other - the constant valueBooleanBindingBooleanBinding lessThanOrEqualTo(int other)
BooleanBinding that holds true
if this NumberExpression is less than or equal to a constant
value.other - the constant valueBooleanBindingStringBinding asString()
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.
StringBindingStringBinding asString(String format)
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.
format - the formatting StringStringBindingStringBinding asString(Locale locale, String format)
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.
format - the formatting StringStringBindingCopyright (c) 2008, 2015, Oracle and/or its affiliates. All rights reserved.