Class NumberExpressionBase
- All Implemented Interfaces:
-
NumberExpression,Observable,ObservableNumberValue,ObservableValue<Number>
- Direct Known Subclasses:
-
DoubleExpression,FloatExpression,IntegerExpression,LongExpression
public abstract class NumberExpressionBase extends 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.
- Since:
- JavaFX 2.0
- See Also:
Constructor Summary
| Constructor | Description |
|---|---|
NumberExpressionBase() |
Creates a default NumberExpressionBase. |
Method Summary
| Modifier and Type | Method | Description |
|---|---|---|
NumberBinding |
add |
Creates a new NumberBinding that calculates the sum of this NumberExpression and another ObservableNumberValue. |
StringBinding |
asString() |
|
StringBinding |
asString |
|
StringBinding |
asString |
|
NumberBinding |
divide |
Creates a new NumberBinding that calculates the division of this NumberExpression and another ObservableNumberValue. |
BooleanBinding |
greaterThan |
Creates a new BooleanBinding that holds true if this NumberExpression is greater than a constant value. |
BooleanBinding |
greaterThan |
Creates a new BooleanBinding that holds true if this NumberExpression is greater than a constant value. |
BooleanBinding |
greaterThan |
Creates a new BooleanBinding that holds true if this NumberExpression is greater than a constant value. |
BooleanBinding |
greaterThan |
Creates a new BooleanBinding that holds true if this NumberExpression is greater than a constant value. |
BooleanBinding |
greaterThan |
Creates a new BooleanBinding that holds true if this NumberExpression is greater than another ObservableNumberValue. |
BooleanBinding |
greaterThanOrEqualTo |
Creates a new BooleanBinding that holds true if this NumberExpression is greater than or equal to a constant value. |
BooleanBinding |
greaterThanOrEqualTo |
Creates a new BooleanBinding that holds true if this NumberExpression is greater than or equal to a constant value. |
BooleanBinding |
greaterThanOrEqualTo |
Creates a new BooleanBinding that holds true if this NumberExpression is greater than or equal to a constant value. |
BooleanBinding |
greaterThanOrEqualTo |
Creates a new BooleanBinding that holds true if this NumberExpression is greater than or equal to a constant value. |
BooleanBinding |
greaterThanOrEqualTo |
Creates a new BooleanBinding that holds true if this NumberExpression is greater than or equal to another ObservableNumberValue. |
BooleanBinding |
isEqualTo |
Creates a new BooleanBinding that holds true if this NumberExpression is equal to a constant value (with a tolerance). |
BooleanBinding |
isEqualTo |
Creates a new BooleanBinding that holds true if this NumberExpression is equal to a constant value (with a tolerance). |
BooleanBinding |
isEqualTo |
|
BooleanBinding |
isEqualTo |
Creates a new BooleanBinding that holds true if this NumberExpression is equal to a constant value (with a tolerance). |
BooleanBinding |
isEqualTo |
|
BooleanBinding |
isEqualTo |
Creates a new BooleanBinding that holds true if this NumberExpression is equal to a constant value (with a tolerance). |
BooleanBinding |
isEqualTo |
|
BooleanBinding |
isEqualTo |
Creates a new BooleanBinding that holds true if this and another ObservableNumberValue are equal (with a tolerance). |
BooleanBinding |
isNotEqualTo |
Creates a new BooleanBinding that holds true if this NumberExpression is not equal to a constant value (with a tolerance). |
BooleanBinding |
isNotEqualTo |
Creates a new BooleanBinding that holds true if this NumberExpression is not equal to a constant value (with a tolerance). |
BooleanBinding |
isNotEqualTo |
Creates a new BooleanBinding that holds true if this NumberExpression is not equal to a constant value. |
BooleanBinding |
isNotEqualTo |
Creates a new BooleanBinding that holds true if this NumberExpression is not equal to a constant value (with a tolerance). |
BooleanBinding |
isNotEqualTo |
Creates a new BooleanBinding that holds true if this NumberExpression is not equal to a constant value. |
BooleanBinding |
isNotEqualTo |
Creates a new BooleanBinding that holds true if this NumberExpression is not equal to a constant value (with a tolerance). |
BooleanBinding |
isNotEqualTo |
Creates a new BooleanBinding that holds true if this and another ObservableNumberValue are not equal. |
BooleanBinding |
isNotEqualTo |
Creates a new BooleanBinding that holds true if this and another ObservableNumberValue are not equal (with a tolerance). |
BooleanBinding |
lessThan |
Creates a new BooleanBinding that holds true if this NumberExpression is lesser than a constant value. |
BooleanBinding |
lessThan |
Creates a new BooleanBinding that holds true if this NumberExpression is lesser than a constant value. |
BooleanBinding |
lessThan |
Creates a new BooleanBinding that holds true if this NumberExpression is lesser than a constant value. |
BooleanBinding |
lessThan |
Creates a new BooleanBinding that holds true if this NumberExpression is lesser than a constant value. |
BooleanBinding |
lessThan |
Creates a new BooleanBinding that holds true if this NumberExpression is lesser than another ObservableNumberValue. |
BooleanBinding |
lessThanOrEqualTo |
Creates a new BooleanBinding that holds true if this NumberExpression is less than or equal to a constant value. |
BooleanBinding |
lessThanOrEqualTo |
Creates a new BooleanBinding that holds true if this NumberExpression is less than or equal to a constant value. |
BooleanBinding |
lessThanOrEqualTo |
Creates a new BooleanBinding that holds true if this NumberExpression is less than or equal to a constant value. |
BooleanBinding |
lessThanOrEqualTo |
Creates a new BooleanBinding that holds true if this NumberExpression is less than or equal to a constant value. |
BooleanBinding |
lessThanOrEqualTo |
Creates a new BooleanBinding that holds true if this NumberExpression is less than or equal to another ObservableNumberValue. |
NumberBinding |
multiply |
Creates a new NumberBinding that calculates the product of this NumberExpression and another ObservableNumberValue. |
static <S extends Number> |
numberExpression |
Returns an NumberExpressionBase that wraps a ObservableNumberValue. |
NumberBinding |
subtract |
Creates a new NumberBinding that calculates the difference of this NumberExpression and another ObservableNumberValue. |
Methods declared in class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods declared in interface javafx.beans.binding.NumberExpression
add, add, add, add, divide, divide, divide, divide, multiply, multiply, multiply, multiply, negate, subtract, subtract, subtract, subtract
Methods declared in interface javafx.beans.Observable
addListener, removeListener, subscribe
Methods declared in interface javafx.beans.value.ObservableNumberValue
doubleValue, floatValue, intValue, longValue
Methods declared in interface javafx.beans.value.ObservableValue
addListener, flatMap, getValue, map, orElse, removeListener, subscribe, subscribe, when
Constructor Details
NumberExpressionBase
public NumberExpressionBase()
NumberExpressionBase.Method Details
numberExpression
public static <S extends Number> NumberExpressionBase numberExpression(ObservableNumberValue value)
NumberExpressionBase that wraps a 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.- Type Parameters:
-
S- The type of Number to be wrapped - Parameters:
-
value- The sourceObservableNumberValue - Returns:
- An
NumberExpressionBasethat wraps theObservableNumberValueif necessary - Throws:
-
NullPointerException- ifvalueisnull
add
public NumberBinding add(ObservableNumberValue other)
NumberExpressionNumberBinding that calculates the sum of this NumberExpression and another ObservableNumberValue.- Specified by:
-
addin interfaceNumberExpression - Parameters:
-
other- the secondObservableNumberValue - Returns:
- the new
NumberBinding
subtract
public NumberBinding subtract(ObservableNumberValue other)
NumberExpressionNumberBinding that calculates the difference of this NumberExpression and another ObservableNumberValue.- Specified by:
-
subtractin interfaceNumberExpression - Parameters:
-
other- the secondObservableNumberValue - Returns:
- the new
NumberBinding
multiply
public NumberBinding multiply(ObservableNumberValue other)
NumberExpressionNumberBinding that calculates the product of this NumberExpression and another ObservableNumberValue.- Specified by:
-
multiplyin interfaceNumberExpression - Parameters:
-
other- the secondObservableNumberValue - Returns:
- the new
NumberBinding
divide
public NumberBinding divide(ObservableNumberValue other)
NumberExpressionNumberBinding that calculates the division of this NumberExpression and another ObservableNumberValue.- Specified by:
-
dividein interfaceNumberExpression - Parameters:
-
other- the secondObservableNumberValue - Returns:
- the new
NumberBinding
isEqualTo
public BooleanBinding isEqualTo(ObservableNumberValue other)
NumberExpressionBooleanBinding 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.
- Specified by:
-
isEqualToin interfaceNumberExpression - Parameters:
-
other- the secondObservableNumberValue - Returns:
- the new
BooleanBinding
isEqualTo
public BooleanBinding isEqualTo(ObservableNumberValue other, double epsilon)
NumberExpressionBooleanBinding 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.
- Specified by:
-
isEqualToin interfaceNumberExpression - Parameters:
-
other- the secondObservableNumberValue -
epsilon- the tolerance - Returns:
- the new
BooleanBinding
isEqualTo
public BooleanBinding isEqualTo(double other, double epsilon)
NumberExpressionBooleanBinding 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.
- Specified by:
-
isEqualToin interfaceNumberExpression - Parameters:
-
other- the constant value -
epsilon- the permitted tolerance - Returns:
- the new
BooleanBinding
isEqualTo
public BooleanBinding isEqualTo(float other, double epsilon)
NumberExpressionBooleanBinding 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.
- Specified by:
-
isEqualToin interfaceNumberExpression - Parameters:
-
other- the constant value -
epsilon- the permitted tolerance - Returns:
- the new
BooleanBinding
isEqualTo
public BooleanBinding isEqualTo(long other)
NumberExpressionBooleanBinding 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.
- Specified by:
-
isEqualToin interfaceNumberExpression - Parameters:
-
other- the constant value - Returns:
- the new
BooleanBinding
isEqualTo
public BooleanBinding isEqualTo(long other, double epsilon)
NumberExpressionBooleanBinding 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.
- Specified by:
-
isEqualToin interfaceNumberExpression - Parameters:
-
other- the constant value -
epsilon- the permitted tolerance - Returns:
- the new
BooleanBinding
isEqualTo
public BooleanBinding isEqualTo(int other)
NumberExpressionBooleanBinding 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.
- Specified by:
-
isEqualToin interfaceNumberExpression - Parameters:
-
other- the constant value - Returns:
- the new
BooleanBinding
isEqualTo
public BooleanBinding isEqualTo(int other, double epsilon)
NumberExpressionBooleanBinding 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.
- Specified by:
-
isEqualToin interfaceNumberExpression - Parameters:
-
other- the constant value -
epsilon- the permitted tolerance - Returns:
- the new
BooleanBinding
isNotEqualTo
public BooleanBinding isNotEqualTo(ObservableNumberValue other)
NumberExpressionBooleanBinding 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.
- Specified by:
-
isNotEqualToin interfaceNumberExpression - Parameters:
-
other- the secondObservableNumberValue - Returns:
- the new
BooleanBinding
isNotEqualTo
public BooleanBinding isNotEqualTo(ObservableNumberValue other, double epsilon)
NumberExpressionBooleanBinding 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.
- Specified by:
-
isNotEqualToin interfaceNumberExpression - Parameters:
-
other- the secondObservableNumberValue -
epsilon- the permitted tolerance - Returns:
- the new
BooleanBinding
isNotEqualTo
public BooleanBinding isNotEqualTo(double other, double epsilon)
NumberExpressionBooleanBinding 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.
- Specified by:
-
isNotEqualToin interfaceNumberExpression - Parameters:
-
other- the constant value -
epsilon- the permitted tolerance - Returns:
- the new
BooleanBinding
isNotEqualTo
public BooleanBinding isNotEqualTo(float other, double epsilon)
NumberExpressionBooleanBinding 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.
- Specified by:
-
isNotEqualToin interfaceNumberExpression - Parameters:
-
other- the constant value -
epsilon- the permitted tolerance - Returns:
- the new
BooleanBinding
isNotEqualTo
public BooleanBinding isNotEqualTo(long other)
NumberExpressionBooleanBinding 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.
- Specified by:
-
isNotEqualToin interfaceNumberExpression - Parameters:
-
other- the constant value - Returns:
- the new
BooleanBinding
isNotEqualTo
public BooleanBinding isNotEqualTo(long other, double epsilon)
NumberExpressionBooleanBinding 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.
- Specified by:
-
isNotEqualToin interfaceNumberExpression - Parameters:
-
other- the constant value -
epsilon- the permitted tolerance - Returns:
- the new
BooleanBinding
isNotEqualTo
public BooleanBinding isNotEqualTo(int other)
NumberExpressionBooleanBinding 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.
- Specified by:
-
isNotEqualToin interfaceNumberExpression - Parameters:
-
other- the constant value - Returns:
- the new
BooleanBinding
isNotEqualTo
public BooleanBinding isNotEqualTo(int other, double epsilon)
NumberExpressionBooleanBinding 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.
- Specified by:
-
isNotEqualToin interfaceNumberExpression - Parameters:
-
other- the constant value -
epsilon- the permitted tolerance - Returns:
- the new
BooleanBinding
greaterThan
public BooleanBinding greaterThan(ObservableNumberValue other)
NumberExpressionBooleanBinding that holds true if this NumberExpression is greater than another ObservableNumberValue.- Specified by:
-
greaterThanin interfaceNumberExpression - Parameters:
-
other- the secondObservableNumberValue - Returns:
- the new
BooleanBinding
greaterThan
public BooleanBinding greaterThan(double other)
NumberExpressionBooleanBinding that holds true if this NumberExpression is greater than a constant value.- Specified by:
-
greaterThanin interfaceNumberExpression - Parameters:
-
other- the constant value - Returns:
- the new
BooleanBinding
greaterThan
public BooleanBinding greaterThan(float other)
NumberExpressionBooleanBinding that holds true if this NumberExpression is greater than a constant value.- Specified by:
-
greaterThanin interfaceNumberExpression - Parameters:
-
other- the constant value - Returns:
- the new
BooleanBinding
greaterThan
public BooleanBinding greaterThan(long other)
NumberExpressionBooleanBinding that holds true if this NumberExpression is greater than a constant value.- Specified by:
-
greaterThanin interfaceNumberExpression - Parameters:
-
other- the constant value - Returns:
- the new
BooleanBinding
greaterThan
public BooleanBinding greaterThan(int other)
NumberExpressionBooleanBinding that holds true if this NumberExpression is greater than a constant value.- Specified by:
-
greaterThanin interfaceNumberExpression - Parameters:
-
other- the constant value - Returns:
- the new
BooleanBinding
lessThan
public BooleanBinding lessThan(ObservableNumberValue other)
NumberExpressionBooleanBinding that holds true if this NumberExpression is lesser than another ObservableNumberValue.- Specified by:
-
lessThanin interfaceNumberExpression - Parameters:
-
other- the secondObservableNumberValue - Returns:
- the new
BooleanBinding
lessThan
public BooleanBinding lessThan(double other)
NumberExpressionBooleanBinding that holds true if this NumberExpression is lesser than a constant value.- Specified by:
-
lessThanin interfaceNumberExpression - Parameters:
-
other- the constant value - Returns:
- the new
BooleanBinding
lessThan
public BooleanBinding lessThan(float other)
NumberExpressionBooleanBinding that holds true if this NumberExpression is lesser than a constant value.- Specified by:
-
lessThanin interfaceNumberExpression - Parameters:
-
other- the constant value - Returns:
- the new
BooleanBinding
lessThan
public BooleanBinding lessThan(long other)
NumberExpressionBooleanBinding that holds true if this NumberExpression is lesser than a constant value.- Specified by:
-
lessThanin interfaceNumberExpression - Parameters:
-
other- the constant value - Returns:
- the new
BooleanBinding
lessThan
public BooleanBinding lessThan(int other)
NumberExpressionBooleanBinding that holds true if this NumberExpression is lesser than a constant value.- Specified by:
-
lessThanin interfaceNumberExpression - Parameters:
-
other- the constant value - Returns:
- the new
BooleanBinding
greaterThanOrEqualTo
public BooleanBinding greaterThanOrEqualTo(ObservableNumberValue other)
NumberExpressionBooleanBinding that holds true if this NumberExpression is greater than or equal to another ObservableNumberValue.- Specified by:
-
greaterThanOrEqualToin interfaceNumberExpression - Parameters:
-
other- the secondObservableNumberValue - Returns:
- the new
BooleanBinding
greaterThanOrEqualTo
public BooleanBinding greaterThanOrEqualTo(double other)
NumberExpressionBooleanBinding that holds true if this NumberExpression is greater than or equal to a constant value.- Specified by:
-
greaterThanOrEqualToin interfaceNumberExpression - Parameters:
-
other- the constant value - Returns:
- the new
BooleanBinding
greaterThanOrEqualTo
public BooleanBinding greaterThanOrEqualTo(float other)
NumberExpressionBooleanBinding that holds true if this NumberExpression is greater than or equal to a constant value.- Specified by:
-
greaterThanOrEqualToin interfaceNumberExpression - Parameters:
-
other- the constant value - Returns:
- the new
BooleanBinding
greaterThanOrEqualTo
public BooleanBinding greaterThanOrEqualTo(long other)
NumberExpressionBooleanBinding that holds true if this NumberExpression is greater than or equal to a constant value.- Specified by:
-
greaterThanOrEqualToin interfaceNumberExpression - Parameters:
-
other- the constant value - Returns:
- the new
BooleanBinding
greaterThanOrEqualTo
public BooleanBinding greaterThanOrEqualTo(int other)
NumberExpressionBooleanBinding that holds true if this NumberExpression is greater than or equal to a constant value.- Specified by:
-
greaterThanOrEqualToin interfaceNumberExpression - Parameters:
-
other- the constant value - Returns:
- the new
BooleanBinding
lessThanOrEqualTo
public BooleanBinding lessThanOrEqualTo(ObservableNumberValue other)
NumberExpressionBooleanBinding that holds true if this NumberExpression is less than or equal to another ObservableNumberValue.- Specified by:
-
lessThanOrEqualToin interfaceNumberExpression - Parameters:
-
other- the secondObservableNumberValue - Returns:
- the new
BooleanBinding
lessThanOrEqualTo
public BooleanBinding lessThanOrEqualTo(double other)
NumberExpressionBooleanBinding that holds true if this NumberExpression is less than or equal to a constant value.- Specified by:
-
lessThanOrEqualToin interfaceNumberExpression - Parameters:
-
other- the constant value - Returns:
- the new
BooleanBinding
lessThanOrEqualTo
public BooleanBinding lessThanOrEqualTo(float other)
NumberExpressionBooleanBinding that holds true if this NumberExpression is less than or equal to a constant value.- Specified by:
-
lessThanOrEqualToin interfaceNumberExpression - Parameters:
-
other- the constant value - Returns:
- the new
BooleanBinding
lessThanOrEqualTo
public BooleanBinding lessThanOrEqualTo(long other)
NumberExpressionBooleanBinding that holds true if this NumberExpression is less than or equal to a constant value.- Specified by:
-
lessThanOrEqualToin interfaceNumberExpression - Parameters:
-
other- the constant value - Returns:
- the new
BooleanBinding
lessThanOrEqualTo
public BooleanBinding lessThanOrEqualTo(int other)
NumberExpressionBooleanBinding that holds true if this NumberExpression is less than or equal to a constant value.- Specified by:
-
lessThanOrEqualToin interfaceNumberExpression - Parameters:
-
other- the constant value - Returns:
- the new
BooleanBinding
asString
public StringBinding asString()
NumberExpressionStringBinding 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.
- Specified by:
-
asStringin interfaceNumberExpression - Returns:
- the new
StringBinding
asString
public StringBinding asString(String format)
NumberExpressionStringBinding 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.
- Specified by:
-
asStringin interfaceNumberExpression - Parameters:
-
format- the formattingString - Returns:
- the new
StringBinding
asString
public StringBinding asString(Locale locale, String format)
NumberExpressionStringBinding 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.
- Specified by:
-
asStringin interfaceNumberExpression - Parameters:
-
locale- the Locale to be used -
format- the formattingString - Returns:
- the new
StringBinding
© 2008, 2025, Oracle and/or its affiliates. All rights reserved.
Documentation extracted from JavaFX API Documentation.
Licensed under the GNU General Public License, version 2, with the Classpath Exception.
Java, JavaFX and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.