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.
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
ObservableNumberValue . |
StringBinding |
asString()
|
StringBinding |
asString(Locale locale,
String format)
|
StringBinding |
asString(String format)
|
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(ObservableNumberValue other)
Creates a new
NumberBinding that calculates
the product of this NumberExpression and another
ObservableNumberValue . |
static <S extends Number> |
numberExpression(ObservableNumberValue value)
Returns an
NumberExpressionBase that wraps a
ObservableNumberValue . |
NumberBinding |
subtract(ObservableNumberValue other)
Creates a new
NumberBinding that calculates
the difference of this NumberExpression and another
ObservableNumberValue . |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
add, add, add, add, divide, divide, divide, divide, multiply, multiply, multiply, multiply, negate, subtract, subtract, subtract, subtract
doubleValue, floatValue, intValue, longValue
addListener, getValue, removeListener
addListener, removeListener
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
.value
- The source ObservableNumberValue
NumberExpressionBase
that wraps the
ObservableNumberValue
if necessaryNullPointerException
- if value
is null
public NumberBinding add(ObservableNumberValue other)
NumberExpression
NumberBinding
that calculates
the sum of this NumberExpression
and another
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
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
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
ObservableNumberValue
.divide
in interface NumberExpression
other
- the second ObservableNumberValue
NumberBinding
public BooleanBinding isEqualTo(ObservableNumberValue other)
NumberExpression
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.
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 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 isEqualTo(double other, double epsilon)
NumberExpression
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.
isEqualTo
in interface NumberExpression
other
- the constant valueepsilon
- the permitted toleranceBooleanBinding
public BooleanBinding isEqualTo(float other, double epsilon)
NumberExpression
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.
isEqualTo
in interface NumberExpression
other
- the constant valueepsilon
- the permitted toleranceBooleanBinding
public BooleanBinding isEqualTo(long other)
NumberExpression
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.
isEqualTo
in interface NumberExpression
other
- the constant valueBooleanBinding
public BooleanBinding isEqualTo(long other, double epsilon)
NumberExpression
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.
isEqualTo
in interface NumberExpression
other
- the constant valueepsilon
- the permitted toleranceBooleanBinding
public BooleanBinding isEqualTo(int other)
NumberExpression
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.
isEqualTo
in interface NumberExpression
other
- the constant valueBooleanBinding
public BooleanBinding isEqualTo(int other, double epsilon)
NumberExpression
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.
isEqualTo
in interface NumberExpression
other
- the constant valueepsilon
- the permitted toleranceBooleanBinding
public BooleanBinding isNotEqualTo(ObservableNumberValue other)
NumberExpression
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.
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 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 isNotEqualTo(double other, double epsilon)
NumberExpression
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.
isNotEqualTo
in interface NumberExpression
other
- the constant valueepsilon
- the permitted toleranceBooleanBinding
public BooleanBinding isNotEqualTo(float other, double epsilon)
NumberExpression
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.
isNotEqualTo
in interface NumberExpression
other
- the constant valueepsilon
- the permitted toleranceBooleanBinding
public BooleanBinding isNotEqualTo(long other)
NumberExpression
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.
isNotEqualTo
in interface NumberExpression
other
- the constant valueBooleanBinding
public BooleanBinding isNotEqualTo(long other, double epsilon)
NumberExpression
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.
isNotEqualTo
in interface NumberExpression
other
- the constant valueepsilon
- the permitted toleranceBooleanBinding
public BooleanBinding isNotEqualTo(int other)
NumberExpression
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.
isNotEqualTo
in interface NumberExpression
other
- the constant valueBooleanBinding
public BooleanBinding isNotEqualTo(int other, double epsilon)
NumberExpression
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.
isNotEqualTo
in interface NumberExpression
other
- the constant valueepsilon
- the permitted toleranceBooleanBinding
public BooleanBinding greaterThan(ObservableNumberValue other)
NumberExpression
BooleanBinding
that holds true
if this NumberExpression
is greater than another
ObservableNumberValue
.greaterThan
in interface NumberExpression
other
- the second ObservableNumberValue
BooleanBinding
public BooleanBinding greaterThan(double other)
NumberExpression
BooleanBinding
that holds true
if this NumberExpression
is greater than a constant value.greaterThan
in interface NumberExpression
other
- the constant valueBooleanBinding
public BooleanBinding greaterThan(float other)
NumberExpression
BooleanBinding
that holds true
if this NumberExpression
is greater than a constant value.greaterThan
in interface NumberExpression
other
- the constant valueBooleanBinding
public BooleanBinding greaterThan(long other)
NumberExpression
BooleanBinding
that holds true
if this NumberExpression
is greater than a constant value.greaterThan
in interface NumberExpression
other
- the constant valueBooleanBinding
public BooleanBinding greaterThan(int other)
NumberExpression
BooleanBinding
that holds true
if this NumberExpression
is greater than a constant value.greaterThan
in interface NumberExpression
other
- the constant valueBooleanBinding
public BooleanBinding lessThan(ObservableNumberValue other)
NumberExpression
BooleanBinding
that holds true
if this NumberExpression
is lesser than another
ObservableNumberValue
.lessThan
in interface NumberExpression
other
- the second ObservableNumberValue
BooleanBinding
public BooleanBinding lessThan(double other)
NumberExpression
BooleanBinding
that holds true
if this NumberExpression
is lesser than a constant value.lessThan
in interface NumberExpression
other
- the constant valueBooleanBinding
public BooleanBinding lessThan(float other)
NumberExpression
BooleanBinding
that holds true
if this NumberExpression
is lesser than a constant value.lessThan
in interface NumberExpression
other
- the constant valueBooleanBinding
public BooleanBinding lessThan(long other)
NumberExpression
BooleanBinding
that holds true
if this NumberExpression
is lesser than a constant value.lessThan
in interface NumberExpression
other
- the constant valueBooleanBinding
public BooleanBinding lessThan(int other)
NumberExpression
BooleanBinding
that holds true
if this NumberExpression
is lesser than a constant value.lessThan
in interface NumberExpression
other
- the constant valueBooleanBinding
public BooleanBinding greaterThanOrEqualTo(ObservableNumberValue other)
NumberExpression
BooleanBinding
that holds true
if this NumberExpression
is greater than or equal to another
ObservableNumberValue
.greaterThanOrEqualTo
in interface NumberExpression
other
- the second ObservableNumberValue
BooleanBinding
public BooleanBinding greaterThanOrEqualTo(double other)
NumberExpression
BooleanBinding
that holds true
if this NumberExpression
is greater than or equal to a constant
value.greaterThanOrEqualTo
in interface NumberExpression
other
- the constant valueBooleanBinding
public BooleanBinding greaterThanOrEqualTo(float other)
NumberExpression
BooleanBinding
that holds true
if this NumberExpression
is greater than or equal to a constant
value.greaterThanOrEqualTo
in interface NumberExpression
other
- the constant valueBooleanBinding
public BooleanBinding greaterThanOrEqualTo(long other)
NumberExpression
BooleanBinding
that holds true
if this NumberExpression
is greater than or equal to a constant
value.greaterThanOrEqualTo
in interface NumberExpression
other
- the constant valueBooleanBinding
public BooleanBinding greaterThanOrEqualTo(int other)
NumberExpression
BooleanBinding
that holds true
if this NumberExpression
is greater than or equal to a constant
value.greaterThanOrEqualTo
in interface NumberExpression
other
- the constant valueBooleanBinding
public BooleanBinding lessThanOrEqualTo(ObservableNumberValue other)
NumberExpression
BooleanBinding
that holds true
if this NumberExpression
is less than or equal to another
ObservableNumberValue
.lessThanOrEqualTo
in interface NumberExpression
other
- the second ObservableNumberValue
BooleanBinding
public BooleanBinding lessThanOrEqualTo(double other)
NumberExpression
BooleanBinding
that holds true
if this NumberExpression
is less than or equal to a constant
value.lessThanOrEqualTo
in interface NumberExpression
other
- the constant valueBooleanBinding
public BooleanBinding lessThanOrEqualTo(float other)
NumberExpression
BooleanBinding
that holds true
if this NumberExpression
is less than or equal to a constant
value.lessThanOrEqualTo
in interface NumberExpression
other
- the constant valueBooleanBinding
public BooleanBinding lessThanOrEqualTo(long other)
NumberExpression
BooleanBinding
that holds true
if this NumberExpression
is less than or equal to a constant
value.lessThanOrEqualTo
in interface NumberExpression
other
- the constant valueBooleanBinding
public BooleanBinding lessThanOrEqualTo(int other)
NumberExpression
BooleanBinding
that holds true
if this NumberExpression
is less than or equal to a constant
value.lessThanOrEqualTo
in interface NumberExpression
other
- the constant valueBooleanBinding
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(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(Locale locale, 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
format
- the formatting String
StringBinding
Submit a bug or feature
For further API reference and developer documentation, see Java SE Documentation. That documentation contains more detailed, developer-targeted descriptions, with conceptual overviews, definitions of terms, workarounds, and working code examples.
Copyright © 2008, 2017, Oracle and/or its affiliates. All rights reserved. Use is subject to license terms. Also see the documentation redistribution policy.