- 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:
IntegerExpression
,LongExpression
,FloatExpression
,DoubleExpression
-
Constructor Summary
Constructors Constructor Description NumberExpressionBase()
-
Method Summary
Modifier and Type Method Description NumberBinding
add(ObservableNumberValue other)
Creates a newNumberBinding
that calculates the sum of thisNumberExpression
and anotherObservableNumberValue
.StringBinding
asString()
StringBinding
asString(String format)
StringBinding
asString(Locale locale, String format)
NumberBinding
divide(ObservableNumberValue other)
Creates a newNumberBinding
that calculates the division of thisNumberExpression
and anotherObservableNumberValue
.BooleanBinding
greaterThan(double other)
Creates a newBooleanBinding
that holdstrue
if thisNumberExpression
is greater than a constant value.BooleanBinding
greaterThan(float other)
Creates a newBooleanBinding
that holdstrue
if thisNumberExpression
is greater than a constant value.BooleanBinding
greaterThan(int other)
Creates a newBooleanBinding
that holdstrue
if thisNumberExpression
is greater than a constant value.BooleanBinding
greaterThan(long other)
Creates a newBooleanBinding
that holdstrue
if thisNumberExpression
is greater than a constant value.BooleanBinding
greaterThan(ObservableNumberValue other)
Creates a newBooleanBinding
that holdstrue
if thisNumberExpression
is greater than anotherObservableNumberValue
.BooleanBinding
greaterThanOrEqualTo(double other)
Creates a newBooleanBinding
that holdstrue
if thisNumberExpression
is greater than or equal to a constant value.BooleanBinding
greaterThanOrEqualTo(float other)
Creates a newBooleanBinding
that holdstrue
if thisNumberExpression
is greater than or equal to a constant value.BooleanBinding
greaterThanOrEqualTo(int other)
Creates a newBooleanBinding
that holdstrue
if thisNumberExpression
is greater than or equal to a constant value.BooleanBinding
greaterThanOrEqualTo(long other)
Creates a newBooleanBinding
that holdstrue
if thisNumberExpression
is greater than or equal to a constant value.BooleanBinding
greaterThanOrEqualTo(ObservableNumberValue other)
Creates a newBooleanBinding
that holdstrue
if thisNumberExpression
is greater than or equal to anotherObservableNumberValue
.BooleanBinding
isEqualTo(double other, double epsilon)
Creates a newBooleanBinding
that holdstrue
if thisNumberExpression
is equal to a constant value (with a tolerance).BooleanBinding
isEqualTo(float other, double epsilon)
Creates a newBooleanBinding
that holdstrue
if thisNumberExpression
is equal to a constant value (with a tolerance).BooleanBinding
isEqualTo(int other)
BooleanBinding
isEqualTo(int other, double epsilon)
Creates a newBooleanBinding
that holdstrue
if thisNumberExpression
is equal to a constant value (with a tolerance).BooleanBinding
isEqualTo(long other)
BooleanBinding
isEqualTo(long other, double epsilon)
Creates a newBooleanBinding
that holdstrue
if thisNumberExpression
is equal to a constant value (with a tolerance).BooleanBinding
isEqualTo(ObservableNumberValue other)
BooleanBinding
isEqualTo(ObservableNumberValue other, double epsilon)
Creates a newBooleanBinding
that holdstrue
if this and anotherObservableNumberValue
are equal (with a tolerance).BooleanBinding
isNotEqualTo(double other, double epsilon)
Creates a newBooleanBinding
that holdstrue
if thisNumberExpression
is not equal to a constant value (with a tolerance).BooleanBinding
isNotEqualTo(float other, double epsilon)
Creates a newBooleanBinding
that holdstrue
if thisNumberExpression
is not equal to a constant value (with a tolerance).BooleanBinding
isNotEqualTo(int other)
Creates a newBooleanBinding
that holdstrue
if thisNumberExpression
is not equal to a constant value.BooleanBinding
isNotEqualTo(int other, double epsilon)
Creates a newBooleanBinding
that holdstrue
if thisNumberExpression
is not equal to a constant value (with a tolerance).BooleanBinding
isNotEqualTo(long other)
Creates a newBooleanBinding
that holdstrue
if thisNumberExpression
is not equal to a constant value.BooleanBinding
isNotEqualTo(long other, double epsilon)
Creates a newBooleanBinding
that holdstrue
if thisNumberExpression
is not equal to a constant value (with a tolerance).BooleanBinding
isNotEqualTo(ObservableNumberValue other)
Creates a newBooleanBinding
that holdstrue
if this and anotherObservableNumberValue
are not equal.BooleanBinding
isNotEqualTo(ObservableNumberValue other, double epsilon)
Creates a newBooleanBinding
that holdstrue
if this and anotherObservableNumberValue
are not equal (with a tolerance).BooleanBinding
lessThan(double other)
Creates a newBooleanBinding
that holdstrue
if thisNumberExpression
is lesser than a constant value.BooleanBinding
lessThan(float other)
Creates a newBooleanBinding
that holdstrue
if thisNumberExpression
is lesser than a constant value.BooleanBinding
lessThan(int other)
Creates a newBooleanBinding
that holdstrue
if thisNumberExpression
is lesser than a constant value.BooleanBinding
lessThan(long other)
Creates a newBooleanBinding
that holdstrue
if thisNumberExpression
is lesser than a constant value.BooleanBinding
lessThan(ObservableNumberValue other)
Creates a newBooleanBinding
that holdstrue
if thisNumberExpression
is lesser than anotherObservableNumberValue
.BooleanBinding
lessThanOrEqualTo(double other)
Creates a newBooleanBinding
that holdstrue
if thisNumberExpression
is less than or equal to a constant value.BooleanBinding
lessThanOrEqualTo(float other)
Creates a newBooleanBinding
that holdstrue
if thisNumberExpression
is less than or equal to a constant value.BooleanBinding
lessThanOrEqualTo(int other)
Creates a newBooleanBinding
that holdstrue
if thisNumberExpression
is less than or equal to a constant value.BooleanBinding
lessThanOrEqualTo(long other)
Creates a newBooleanBinding
that holdstrue
if thisNumberExpression
is less than or equal to a constant value.BooleanBinding
lessThanOrEqualTo(ObservableNumberValue other)
Creates a newBooleanBinding
that holdstrue
if thisNumberExpression
is less than or equal to anotherObservableNumberValue
.NumberBinding
multiply(ObservableNumberValue other)
Creates a newNumberBinding
that calculates the product of thisNumberExpression
and anotherObservableNumberValue
.static <S extends Number>
NumberExpressionBasenumberExpression(ObservableNumberValue value)
Returns anNumberExpressionBase
that wraps aObservableNumberValue
.NumberBinding
subtract(ObservableNumberValue other)
Creates a newNumberBinding
that calculates the difference of thisNumberExpression
and anotherObservableNumberValue
.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface javafx.beans.binding.NumberExpression
add, add, add, add, divide, divide, divide, divide, multiply, multiply, multiply, multiply, negate, subtract, subtract, subtract, subtract
Methods inherited from interface javafx.beans.value.ObservableNumberValue
doubleValue, floatValue, intValue, longValue
Methods inherited from interface javafx.beans.value.ObservableValue
addListener, getValue, removeListener
-
Constructor Details
-
NumberExpressionBase
public NumberExpressionBase()
-
-
Method Details
-
numberExpression
public static <S extends Number> NumberExpressionBase numberExpression(ObservableNumberValue value)Returns anNumberExpressionBase
that wraps aObservableNumberValue
. If theObservableNumberValue
is already an instance ofNumberExpressionBase
, it will be returned. Otherwise a newNumberBinding
is created that is bound to theObservableNumberValue
.- Type Parameters:
S
- The type of Number to be wrapped- Parameters:
value
- The sourceObservableNumberValue
- Returns:
- An
NumberExpressionBase
that wraps theObservableNumberValue
if necessary - Throws:
NullPointerException
- ifvalue
isnull
-
add
Description copied from interface:NumberExpression
Creates a newNumberBinding
that calculates the sum of thisNumberExpression
and anotherObservableNumberValue
.- Specified by:
add
in interfaceNumberExpression
- Parameters:
other
- the secondObservableNumberValue
- Returns:
- the new
NumberBinding
-
subtract
Description copied from interface:NumberExpression
Creates a newNumberBinding
that calculates the difference of thisNumberExpression
and anotherObservableNumberValue
.- Specified by:
subtract
in interfaceNumberExpression
- Parameters:
other
- the secondObservableNumberValue
- Returns:
- the new
NumberBinding
-
multiply
Description copied from interface:NumberExpression
Creates a newNumberBinding
that calculates the product of thisNumberExpression
and anotherObservableNumberValue
.- Specified by:
multiply
in interfaceNumberExpression
- Parameters:
other
- the secondObservableNumberValue
- Returns:
- the new
NumberBinding
-
divide
Description copied from interface:NumberExpression
Creates a newNumberBinding
that calculates the division of thisNumberExpression
and anotherObservableNumberValue
.- Specified by:
divide
in interfaceNumberExpression
- Parameters:
other
- the secondObservableNumberValue
- Returns:
- the new
NumberBinding
-
isEqualTo
Description copied from interface:NumberExpression
Creates a newBooleanBinding
that holdstrue
if this and anotherObservableNumberValue
are equal.When comparing floating-point numbers it is recommended to use the
isEqualTo()
method that allows a small tolerance.- Specified by:
isEqualTo
in interfaceNumberExpression
- Parameters:
other
- the secondObservableNumberValue
- Returns:
- the new
BooleanBinding
-
isEqualTo
Description copied from interface:NumberExpression
Creates a newBooleanBinding
that holdstrue
if this and anotherObservableNumberValue
are equal (with a tolerance).Two operands
a
andb
are considered equal ifMath.abs(a-b) <= epsilon
.Allowing a small tolerance is recommended when comparing floating-point numbers because of rounding-errors.
- Specified by:
isEqualTo
in interfaceNumberExpression
- Parameters:
other
- the secondObservableNumberValue
epsilon
- the tolerance- Returns:
- the new
BooleanBinding
-
isEqualTo
Description copied from interface:NumberExpression
Creates a newBooleanBinding
that holdstrue
if thisNumberExpression
is equal to a constant value (with a tolerance).Two operands
a
andb
are considered equal ifMath.abs(a-b) <= epsilon
.Allowing a small tolerance is recommended when comparing floating-point numbers because of rounding-errors.
- Specified by:
isEqualTo
in interfaceNumberExpression
- Parameters:
other
- the constant valueepsilon
- the permitted tolerance- Returns:
- the new
BooleanBinding
-
isEqualTo
Description copied from interface:NumberExpression
Creates a newBooleanBinding
that holdstrue
if thisNumberExpression
is equal to a constant value (with a tolerance).Two operands
a
andb
are considered equal ifMath.abs(a-b) <= epsilon
.Allowing a small tolerance is recommended when comparing floating-point numbers because of rounding-errors.
- Specified by:
isEqualTo
in interfaceNumberExpression
- Parameters:
other
- the constant valueepsilon
- the permitted tolerance- Returns:
- the new
BooleanBinding
-
isEqualTo
Description copied from interface:NumberExpression
Creates a newBooleanBinding
that holdstrue
if thisNumberExpression
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:
isEqualTo
in interfaceNumberExpression
- Parameters:
other
- the constant value- Returns:
- the new
BooleanBinding
-
isEqualTo
Description copied from interface:NumberExpression
Creates a newBooleanBinding
that holdstrue
if thisNumberExpression
is equal to a constant value (with a tolerance).Two operands
a
andb
are considered equal ifMath.abs(a-b) <= epsilon
.Allowing a small tolerance is recommended when comparing floating-point numbers because of rounding-errors.
- Specified by:
isEqualTo
in interfaceNumberExpression
- Parameters:
other
- the constant valueepsilon
- the permitted tolerance- Returns:
- the new
BooleanBinding
-
isEqualTo
Description copied from interface:NumberExpression
Creates a newBooleanBinding
that holdstrue
if thisNumberExpression
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:
isEqualTo
in interfaceNumberExpression
- Parameters:
other
- the constant value- Returns:
- the new
BooleanBinding
-
isEqualTo
Description copied from interface:NumberExpression
Creates a newBooleanBinding
that holdstrue
if thisNumberExpression
is equal to a constant value (with a tolerance).Two operands
a
andb
are considered equal ifMath.abs(a-b) <= epsilon
.Allowing a small tolerance is recommended when comparing floating-point numbers.
- Specified by:
isEqualTo
in interfaceNumberExpression
- Parameters:
other
- the constant valueepsilon
- the permitted tolerance- Returns:
- the new
BooleanBinding
-
isNotEqualTo
Description copied from interface:NumberExpression
Creates a newBooleanBinding
that holdstrue
if this and anotherObservableNumberValue
are not equal.When comparing floating-point numbers it is recommended to use the
isNotEqualTo()
method that allows a small tolerance.- Specified by:
isNotEqualTo
in interfaceNumberExpression
- Parameters:
other
- the secondObservableNumberValue
- Returns:
- the new
BooleanBinding
-
isNotEqualTo
Description copied from interface:NumberExpression
Creates a newBooleanBinding
that holdstrue
if this and anotherObservableNumberValue
are not equal (with a tolerance).Two operands
a
andb
are considered not equal ifMath.abs(a-b) > epsilon
.Allowing a small tolerance is recommended when comparing floating-point numbers because of rounding-errors.
- Specified by:
isNotEqualTo
in interfaceNumberExpression
- Parameters:
other
- the secondObservableNumberValue
epsilon
- the permitted tolerance- Returns:
- the new
BooleanBinding
-
isNotEqualTo
Description copied from interface:NumberExpression
Creates a newBooleanBinding
that holdstrue
if thisNumberExpression
is not equal to a constant value (with a tolerance).Two operands
a
andb
are considered not equal ifMath.abs(a-b) > epsilon
.Allowing a small tolerance is recommended when comparing floating-point numbers.
- Specified by:
isNotEqualTo
in interfaceNumberExpression
- Parameters:
other
- the constant valueepsilon
- the permitted tolerance- Returns:
- the new
BooleanBinding
-
isNotEqualTo
Description copied from interface:NumberExpression
Creates a newBooleanBinding
that holdstrue
if thisNumberExpression
is not equal to a constant value (with a tolerance).Two operands
a
andb
are considered not equal ifMath.abs(a-b) > epsilon
.Allowing a small tolerance is recommended when comparing floating-point numbers.
- Specified by:
isNotEqualTo
in interfaceNumberExpression
- Parameters:
other
- the constant valueepsilon
- the permitted tolerance- Returns:
- the new
BooleanBinding
-
isNotEqualTo
Description copied from interface:NumberExpression
Creates a newBooleanBinding
that holdstrue
if thisNumberExpression
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:
isNotEqualTo
in interfaceNumberExpression
- Parameters:
other
- the constant value- Returns:
- the new
BooleanBinding
-
isNotEqualTo
Description copied from interface:NumberExpression
Creates a newBooleanBinding
that holdstrue
if thisNumberExpression
is not equal to a constant value (with a tolerance).Two operands
a
andb
are considered not equal ifMath.abs(a-b) > epsilon
.Allowing a small tolerance is recommended when comparing floating-point numbers.
- Specified by:
isNotEqualTo
in interfaceNumberExpression
- Parameters:
other
- the constant valueepsilon
- the permitted tolerance- Returns:
- the new
BooleanBinding
-
isNotEqualTo
Description copied from interface:NumberExpression
Creates a newBooleanBinding
that holdstrue
if thisNumberExpression
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:
isNotEqualTo
in interfaceNumberExpression
- Parameters:
other
- the constant value- Returns:
- the new
BooleanBinding
-
isNotEqualTo
Description copied from interface:NumberExpression
Creates a newBooleanBinding
that holdstrue
if thisNumberExpression
is not equal to a constant value (with a tolerance).Two operands
a
andb
are considered not equal ifMath.abs(a-b) > epsilon
.Allowing a small tolerance is recommended when comparing floating-point numbers.
- Specified by:
isNotEqualTo
in interfaceNumberExpression
- Parameters:
other
- the constant valueepsilon
- the permitted tolerance- Returns:
- the new
BooleanBinding
-
greaterThan
Description copied from interface:NumberExpression
Creates a newBooleanBinding
that holdstrue
if thisNumberExpression
is greater than anotherObservableNumberValue
.- Specified by:
greaterThan
in interfaceNumberExpression
- Parameters:
other
- the secondObservableNumberValue
- Returns:
- the new
BooleanBinding
-
greaterThan
Description copied from interface:NumberExpression
Creates a newBooleanBinding
that holdstrue
if thisNumberExpression
is greater than a constant value.- Specified by:
greaterThan
in interfaceNumberExpression
- Parameters:
other
- the constant value- Returns:
- the new
BooleanBinding
-
greaterThan
Description copied from interface:NumberExpression
Creates a newBooleanBinding
that holdstrue
if thisNumberExpression
is greater than a constant value.- Specified by:
greaterThan
in interfaceNumberExpression
- Parameters:
other
- the constant value- Returns:
- the new
BooleanBinding
-
greaterThan
Description copied from interface:NumberExpression
Creates a newBooleanBinding
that holdstrue
if thisNumberExpression
is greater than a constant value.- Specified by:
greaterThan
in interfaceNumberExpression
- Parameters:
other
- the constant value- Returns:
- the new
BooleanBinding
-
greaterThan
Description copied from interface:NumberExpression
Creates a newBooleanBinding
that holdstrue
if thisNumberExpression
is greater than a constant value.- Specified by:
greaterThan
in interfaceNumberExpression
- Parameters:
other
- the constant value- Returns:
- the new
BooleanBinding
-
lessThan
Description copied from interface:NumberExpression
Creates a newBooleanBinding
that holdstrue
if thisNumberExpression
is lesser than anotherObservableNumberValue
.- Specified by:
lessThan
in interfaceNumberExpression
- Parameters:
other
- the secondObservableNumberValue
- Returns:
- the new
BooleanBinding
-
lessThan
Description copied from interface:NumberExpression
Creates a newBooleanBinding
that holdstrue
if thisNumberExpression
is lesser than a constant value.- Specified by:
lessThan
in interfaceNumberExpression
- Parameters:
other
- the constant value- Returns:
- the new
BooleanBinding
-
lessThan
Description copied from interface:NumberExpression
Creates a newBooleanBinding
that holdstrue
if thisNumberExpression
is lesser than a constant value.- Specified by:
lessThan
in interfaceNumberExpression
- Parameters:
other
- the constant value- Returns:
- the new
BooleanBinding
-
lessThan
Description copied from interface:NumberExpression
Creates a newBooleanBinding
that holdstrue
if thisNumberExpression
is lesser than a constant value.- Specified by:
lessThan
in interfaceNumberExpression
- Parameters:
other
- the constant value- Returns:
- the new
BooleanBinding
-
lessThan
Description copied from interface:NumberExpression
Creates a newBooleanBinding
that holdstrue
if thisNumberExpression
is lesser than a constant value.- Specified by:
lessThan
in interfaceNumberExpression
- Parameters:
other
- the constant value- Returns:
- the new
BooleanBinding
-
greaterThanOrEqualTo
Description copied from interface:NumberExpression
Creates a newBooleanBinding
that holdstrue
if thisNumberExpression
is greater than or equal to anotherObservableNumberValue
.- Specified by:
greaterThanOrEqualTo
in interfaceNumberExpression
- Parameters:
other
- the secondObservableNumberValue
- Returns:
- the new
BooleanBinding
-
greaterThanOrEqualTo
Description copied from interface:NumberExpression
Creates a newBooleanBinding
that holdstrue
if thisNumberExpression
is greater than or equal to a constant value.- Specified by:
greaterThanOrEqualTo
in interfaceNumberExpression
- Parameters:
other
- the constant value- Returns:
- the new
BooleanBinding
-
greaterThanOrEqualTo
Description copied from interface:NumberExpression
Creates a newBooleanBinding
that holdstrue
if thisNumberExpression
is greater than or equal to a constant value.- Specified by:
greaterThanOrEqualTo
in interfaceNumberExpression
- Parameters:
other
- the constant value- Returns:
- the new
BooleanBinding
-
greaterThanOrEqualTo
Description copied from interface:NumberExpression
Creates a newBooleanBinding
that holdstrue
if thisNumberExpression
is greater than or equal to a constant value.- Specified by:
greaterThanOrEqualTo
in interfaceNumberExpression
- Parameters:
other
- the constant value- Returns:
- the new
BooleanBinding
-
greaterThanOrEqualTo
Description copied from interface:NumberExpression
Creates a newBooleanBinding
that holdstrue
if thisNumberExpression
is greater than or equal to a constant value.- Specified by:
greaterThanOrEqualTo
in interfaceNumberExpression
- Parameters:
other
- the constant value- Returns:
- the new
BooleanBinding
-
lessThanOrEqualTo
Description copied from interface:NumberExpression
Creates a newBooleanBinding
that holdstrue
if thisNumberExpression
is less than or equal to anotherObservableNumberValue
.- Specified by:
lessThanOrEqualTo
in interfaceNumberExpression
- Parameters:
other
- the secondObservableNumberValue
- Returns:
- the new
BooleanBinding
-
lessThanOrEqualTo
Description copied from interface:NumberExpression
Creates a newBooleanBinding
that holdstrue
if thisNumberExpression
is less than or equal to a constant value.- Specified by:
lessThanOrEqualTo
in interfaceNumberExpression
- Parameters:
other
- the constant value- Returns:
- the new
BooleanBinding
-
lessThanOrEqualTo
Description copied from interface:NumberExpression
Creates a newBooleanBinding
that holdstrue
if thisNumberExpression
is less than or equal to a constant value.- Specified by:
lessThanOrEqualTo
in interfaceNumberExpression
- Parameters:
other
- the constant value- Returns:
- the new
BooleanBinding
-
lessThanOrEqualTo
Description copied from interface:NumberExpression
Creates a newBooleanBinding
that holdstrue
if thisNumberExpression
is less than or equal to a constant value.- Specified by:
lessThanOrEqualTo
in interfaceNumberExpression
- Parameters:
other
- the constant value- Returns:
- the new
BooleanBinding
-
lessThanOrEqualTo
Description copied from interface:NumberExpression
Creates a newBooleanBinding
that holdstrue
if thisNumberExpression
is less than or equal to a constant value.- Specified by:
lessThanOrEqualTo
in interfaceNumberExpression
- Parameters:
other
- the constant value- Returns:
- the new
BooleanBinding
-
asString
Description copied from interface:NumberExpression
Creates aStringBinding
that holds the value of theNumberExpression
turned into aString
. If the value of thisNumberExpression
changes, the value of theStringBinding
will be updated automatically.The conversion is done without any formatting applied.
- Specified by:
asString
in interfaceNumberExpression
- Returns:
- the new
StringBinding
-
asString
Description copied from interface:NumberExpression
Creates aStringBinding
that holds the value of theNumberExpression
turned into aString
. If the value of thisNumberExpression
changes, the value of theStringBinding
will be updated automatically.The result is formatted according to the formatting
String
. Seejava.util.Formatter
for formatting rules.- Specified by:
asString
in interfaceNumberExpression
- Parameters:
format
- the formattingString
- Returns:
- the new
StringBinding
-
asString
Description copied from interface:NumberExpression
Creates aStringBinding
that holds the value of theNumberExpression
turned into aString
. If the value of thisNumberExpression
changes, the value of theStringBinding
will be updated automatically.The result is formatted according to the formatting
String
and the passed inLocale
. Seejava.util.Formatter
for formatting rules. Seejava.util.Locale
for details onLocale
.- Specified by:
asString
in interfaceNumberExpression
- Parameters:
locale
- the Locale to be usedformat
- the formattingString
- Returns:
- the new
StringBinding
-