org.eclipse.emf.query.conditions.numbers
Class NumberCondition<N extends
Number &
Comparable<? super N>>
java.lang.Object
org.eclipse.emf.query.conditions.Condition
org.eclipse.emf.query.conditions.DataTypeCondition<N>
org.eclipse.emf.query.conditions.numbers.NumberCondition<N>
-
Direct Known Subclasses:
-
NumberCondition.ByteValue,
NumberCondition.DoubleValue,
NumberCondition.FloatValue,
NumberCondition.IntegerValue,
NumberCondition.LongValue,
NumberCondition.ShortValue
-
public class NumberCondition<N extends
Number &
Comparable<? super N>>
- extends
DataTypeCondition<N>
A Condition object that tests for numeric arguments. The
arguments being evaluated are adapted to a Number first using
a NumberAdapter and then compared to the initialization value
of this NumberCondition. It evaluates to true
when the values are equal or if the value is within the range of supplied
lower-bound and upper-bound.
Since the 1.2 release, this class is no longer abstract, serving as a generic
number condition, applicable to any number type. Indeed, the nested
subclasses specific to different precisions are obsolete (though not
deprecated).
-
See Also:
-
|
Nested Class Summary
|
static class
|
NumberCondition.ByteValue
A subclass of NumberCondition to be used to test for byte
values Clients can either use the default implementation supplied or have
their own. |
static class
|
NumberCondition.DoubleValue
A subclass of NumberCondition to be used to test for
double values Clients can either use the default implementation supplied
or have their own. |
static class
|
NumberCondition.FloatValue
A subclass of NumberCondition to be used to test for float
values Clients can either use the default implementation supplied or have
their own. |
static class
|
NumberCondition.IntegerValue
A subclass of NumberCondition to be used to test for
integer values Clients can either use the default implementation supplied
or have their own. |
static class
|
NumberCondition.LongValue
A subclass of NumberCondition to be used to test for long
values Clients can either use the default implementation supplied or have
their own. |
static class
|
NumberCondition.RelationalOperator
The relational operator that a
NumberCondition applies to test
input values against its own value or, in the case of
NumberCondition.RelationalOperator.BETWEEN,
its upper and lower bounds. |
static class
|
NumberCondition.ShortValue
A subclass of NumberCondition to be used to test for short
values Clients can either use the default implementation supplied or have
their own. |
|
Constructor Summary
|
NumberCondition
(
N number)
Initializes me with a single number against which to test input
values, assuming that they will be numbers of the appropriate kind. |
NumberCondition
(
N lowerBound,
boolean lowerInclusive,
N upperBound,
boolean upperInclusive)
Initializes me with upper and lower bounds against which to test input
values, assuming that they will be numbers of the appropriate kind. |
NumberCondition
(
N lowerBound,
boolean lowerInclusive,
N upperBound,
boolean upperInclusive,
NumberAdapter<? extends
N> adapter)
Initializes me with upper and lower bounds against which to test input
values, and an adapter to convert those inputs to numbers. |
NumberCondition
(
N lowerBound,
N upperBound)
Initializes me with upper and lower bounds against which to test input
values, assuming that they will be numbers of the appropriate kind. |
NumberCondition
(
N lowerBound,
N upperBound,
NumberAdapter<? extends
N> adapter)
Initializes me with upper and lower bounds against which to test input
values, and an adapter to convert those inputs to numbers. |
NumberCondition
(
N number,
NumberAdapter<? extends
N> adapter)
Initializes me with a single number against which to test input
values, and an adapter to convert those inputs to numbers. |
NumberCondition
(
N number,
NumberCondition.RelationalOperator operator)
Initializes me with a number against which to test input values
and a relational operator to apply in comparisons. |
NumberCondition
(
N number,
NumberCondition.RelationalOperator operator,
NumberAdapter<? extends
N> adapter)
Initializes me with a number against which to test input values,
a relational operator to apply in comparisons, and an adapter to
convert those inputs to numbers. |
|
Method Summary
|
static
|
between
(N lowerBound,
boolean lowerInclusive,
N upperBound,
boolean upperInclusive)
Obtains a condition checking for values in the range to the specified
lowerBound and upperBound. |
static
|
between
(N lowerBound,
N upperBound)
Obtains a condition checking for values in the range to the specified
lowerBound and upperBound (inclusive). |
static
|
equals
(N number)
Obtains a condition checking for values equal to the specified
number. |
static
|
greaterThan
(N number)
Obtains a condition checking for values greater than the specified
number. |
static
|
greaterThanOrEquals
(N number)
Obtains a condition checking for values greater than or equal to the specified
number. |
boolean
|
isSatisfied
(byte byteValue)
Tests if the argument's value equals/in-range the initialization
number(s) |
boolean
|
isSatisfied
(
Byte byteNumber)
Tests if the argument's value equals/in-range the initialization
number(s) |
boolean
|
isSatisfied
(double doubleValue)
Tests if the argument's value equals/in-range the initialization
number(s) |
boolean
|
isSatisfied
(
Double doubleNumber)
Tests if the argument's value equals/in-range the initialization
number(s) |
boolean
|
isSatisfied
(float floatValue)
Tests if the argument's value equals/in-range the initialization
number(s) |
boolean
|
isSatisfied
(
Float floatNumber)
Tests if the argument's value equals/in-range the initialization
number(s) |
boolean
|
isSatisfied
(int intValue)
Tests if the argument's value equals/in-range the initialization
number(s) |
boolean
|
isSatisfied
(
Integer intNumber)
Tests if the argument's value equals/in-range the initialization
number(s) |
boolean
|
isSatisfied
(long longValue)
Tests if the argument's value equals/in-range the initialization
number(s) |
boolean
|
isSatisfied
(
Long longNumber)
Tests if the argument's value equals/in-range the initialization
number(s) |
boolean
|
isSatisfied
(
Object object)
This operation is the evaluation operation of this Condition
in regard to the argument Object. |
boolean
|
isSatisfied
(short shortValue)
Tests if the argument's value equals/in-range the initialization
number(s) |
boolean
|
isSatisfied
(
Short shortNumber)
Tests if the argument's value equals/in-range the initialization
number(s) |
static
|
lessThan
(N number)
Obtains a condition checking for values less than the specified
number. |
static
|
lessThanOrEquals
(N number)
Obtains a condition checking for values less than or equal to the specified
number. |
static
|
notEquals
(N number)
Obtains a condition checking for values not equal equal to the specified
number. |
|
Methods inherited from class java.lang.
Object
|
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait
|
EQUAL_TO
public static
NumberCondition.RelationalOperator EQUAL_TO
- The numeric = operator.
NOT_EQUAL_TO
public static
NumberCondition.RelationalOperator NOT_EQUAL_TO
- The numeric != operator.
LESS_THAN
public static
NumberCondition.RelationalOperator LESS_THAN
- The numeric < operator.
LESS_THAN_OR_EQUAL_TO
public static
NumberCondition.RelationalOperator LESS_THAN_OR_EQUAL_TO
- The numeric <= operator.
GREATER_THAN
public static
NumberCondition.RelationalOperator GREATER_THAN
- The numeric > operator.
GREATER_THAN_OR_EQUAL_TO
public static
NumberCondition.RelationalOperator GREATER_THAN_OR_EQUAL_TO
- The numeric >= operator.
BETWEEN
public static
NumberCondition.RelationalOperator BETWEEN
- The numeric "between" operator.
upperBound
protected
N extends
Number &
Comparable<? super
N> upperBound
- The upper bound of a range condition.
upperInclusive
protected boolean upperInclusive
- Whether the upper bound is inclusive.
lowerBound
protected
N extends
Number &
Comparable<? super
N> lowerBound
- The lower bound of a range condition.
lowerInclusive
protected boolean lowerInclusive
- Whether the lower bound is inclusive.
operator
protected
NumberCondition.RelationalOperator operator
- The operator of a relational condition.
NumberCondition
public NumberCondition(
N number)
- Initializes me with a single number against which to test input
values, assuming that they will be numbers of the appropriate kind.
I am, by default, an
equality
test.
-
Parameters:
-
number - the number to match against input values -
Since:
- 1.2
NumberCondition
public NumberCondition(
N number,
NumberAdapter<? extends
N> adapter)
- Initializes me with a single number against which to test input
values, and an adapter to convert those inputs to numbers.
I am, by default, an
equality
test.
-
Parameters:
-
number - the number to match against input values -
adapter - to convert input values to the appropriate number kind -
Since:
- 1.2
NumberCondition
public NumberCondition(
N number,
NumberCondition.RelationalOperator operator)
- Initializes me with a number against which to test input values
and a relational operator to apply in comparisons. I assume that inputs
are numbers of the appropriate kind.
-
Parameters:
-
number - the number to match against input values -
operator - the relational operator to test -
Since:
- 1.2
NumberCondition
public NumberCondition(
N number,
NumberCondition.RelationalOperator operator,
NumberAdapter<? extends
N> adapter)
- Initializes me with a number against which to test input values,
a relational operator to apply in comparisons, and an adapter to
convert those inputs to numbers.
-
Parameters:
-
number - the number to match against input values -
operator - the relational operator to test -
adapter - to convert input values to the appropriate number kind -
Since:
- 1.2
NumberCondition
public NumberCondition(
N lowerBound,
N upperBound)
- Initializes me with upper and lower bounds against which to test input
values, assuming that they will be numbers of the appropriate kind.
I am, by default, a
between
test.
-
Parameters:
-
lowerBound - the lower bound to test -
upperBound - the upper bound to test -
Since:
- 1.2
NumberCondition
public NumberCondition(
N lowerBound,
N upperBound,
NumberAdapter<? extends
N> adapter)
- Initializes me with upper and lower bounds against which to test input
values, and an adapter to convert those inputs to numbers.
-
Parameters:
-
lowerBound - the lower bound to test -
upperBound - the upper bound to test -
adapter - to convert input values to the appropriate number kind -
Since:
- 1.2
NumberCondition
public NumberCondition(
N lowerBound,
boolean lowerInclusive,
N upperBound,
boolean upperInclusive)
- Initializes me with upper and lower bounds against which to test input
values, assuming that they will be numbers of the appropriate kind.
I am, by default, a
between
test.
-
Parameters:
-
lowerBound - the lower bound to test -
lowerInclusive - whether the lower bound is inclusive -
upperBound - the upper bound to test -
upperInclusive - whether the upper bound is inclusive -
Since:
- 1.2
NumberCondition
public NumberCondition(
N lowerBound,
boolean lowerInclusive,
N upperBound,
boolean upperInclusive,
NumberAdapter<? extends
N> adapter)
- Initializes me with upper and lower bounds against which to test input
values, and an adapter to convert those inputs to numbers.
-
Parameters:
-
lowerBound - the lower bound to test -
lowerInclusive - whether the lower bound is inclusive -
upperBound - the upper bound to test -
upperInclusive - whether the upper bound is inclusive -
adapter - to convert input values to the appropriate number kind -
Since:
- 1.2
equals
public static <N extends
Number &
Comparable<? super N>>
NumberCondition<N> equals(N number)
- Obtains a condition checking for values equal to the specified
number.
-
-
Parameters:
-
number - a number to check for
-
Returns:
- a condition that does the checking
-
Since:
- 1.2
notEquals
public static <N extends
Number &
Comparable<? super N>>
NumberCondition<N> notEquals(N number)
- Obtains a condition checking for values not equal equal to the specified
number.
-
-
Parameters:
-
number - a number to check for
-
Returns:
- a condition that does the checking
-
Since:
- 1.2
lessThan
public static <N extends
Number &
Comparable<? super N>>
NumberCondition<N> lessThan(N number)
- Obtains a condition checking for values less than the specified
number.
-
-
Parameters:
-
number - a number to check for
-
Returns:
- a condition that does the checking
-
Since:
- 1.2
lessThanOrEquals
public static <N extends
Number &
Comparable<? super N>>
NumberCondition<N> lessThanOrEquals(N number)
- Obtains a condition checking for values less than or equal to the specified
number.
-
-
Parameters:
-
number - a number to check for
-
Returns:
- a condition that does the checking
-
Since:
- 1.2
greaterThan
public static <N extends
Number &
Comparable<? super N>>
NumberCondition<N> greaterThan(N number)
- Obtains a condition checking for values greater than the specified
number.
-
-
Parameters:
-
number - a number to check for
-
Returns:
- a condition that does the checking
-
Since:
- 1.2
greaterThanOrEquals
public static <N extends
Number &
Comparable<? super N>>
NumberCondition<N> greaterThanOrEquals(N number)
- Obtains a condition checking for values greater than or equal to the specified
number.
-
-
Parameters:
-
number - a number to check for
-
Returns:
- a condition that does the checking
-
Since:
- 1.2
between
public static <N extends
Number &
Comparable<? super N>>
NumberCondition<N> between(N lowerBound,
N upperBound)
- Obtains a condition checking for values in the range to the specified
lowerBound and upperBound (inclusive).
-
-
Parameters:
-
lowerBound - the lower bound of numbers to check for (inclusive) -
upperBound - the upper bound of numbers to check for (inclusive)
-
Returns:
- a condition that does the checking
-
Since:
- 1.2
between
public static <N extends
Number &
Comparable<? super N>>
NumberCondition<N> between(N lowerBound,
boolean lowerInclusive,
N upperBound,
boolean upperInclusive)
- Obtains a condition checking for values in the range to the specified
lowerBound and upperBound.
-
-
Parameters:
-
lowerBound - the lower bound of numbers to check for -
lowerInclusive - whether the lower bound is inclusive -
upperBound - the upper bound of numbers to check for -
upperInclusive - whether the upper bound is inclusive
-
Returns:
- a condition that does the checking
-
Since:
- 1.2
isSatisfied
public boolean isSatisfied(
Byte byteNumber)
- Tests if the argument's value equals/in-range the initialization
number(s)
-
-
Parameters:
-
byteNumber - The Byte object whose value will be used in
testing
-
Returns:
- true if values are equal/in-range, false otherwise
isSatisfied
public boolean isSatisfied(byte byteValue)
- Tests if the argument's value equals/in-range the initialization
number(s)
-
-
Parameters:
-
byteValue - The byte value which will be used in testing
-
Returns:
- true if values are equal/in-range, false otherwise
isSatisfied
public boolean isSatisfied(
Double doubleNumber)
- Tests if the argument's value equals/in-range the initialization
number(s)
-
-
Parameters:
-
doubleNumber - The Double object whose value will be used in
testing
-
Returns:
- true if values are equal/in-range, false otherwise
isSatisfied
public boolean isSatisfied(double doubleValue)
- Tests if the argument's value equals/in-range the initialization
number(s)
-
-
Parameters:
-
doubleValue - The double value which will be used in testing
-
Returns:
- true if values are equal/in-range, false otherwise
isSatisfied
public boolean isSatisfied(
Float floatNumber)
- Tests if the argument's value equals/in-range the initialization
number(s)
-
-
Parameters:
-
floatNumber - The Float object whose value will be used in
testing
-
Returns:
- true if values are equal/in-range, false otherwise
isSatisfied
public boolean isSatisfied(float floatValue)
- Tests if the argument's value equals/in-range the initialization
number(s)
-
-
Parameters:
-
floatValue - The float value which will be used in testing
-
Returns:
- true if values are equal/in-range, false otherwise
isSatisfied
public boolean isSatisfied(
Integer intNumber)
- Tests if the argument's value equals/in-range the initialization
number(s)
-
-
Parameters:
-
intNumber - The Integer object whose value will be used in
testing
-
Returns:
- true if values are equal/in-range, false otherwise
isSatisfied
public boolean isSatisfied(int intValue)
- Tests if the argument's value equals/in-range the initialization
number(s)
-
-
Parameters:
-
intValue - The int value which will be used in testing
-
Returns:
- true if values are equal/in-range, false otherwise
isSatisfied
public boolean isSatisfied(
Long longNumber)
- Tests if the argument's value equals/in-range the initialization
number(s)
-
-
Parameters:
-
longNumber - The Long object whose value will be used in
testing
-
Returns:
- true if values are equal/in-range, false otherwise
isSatisfied
public boolean isSatisfied(long longValue)
- Tests if the argument's value equals/in-range the initialization
number(s)
-
-
Parameters:
-
longValue - The long value which will be used in testing
-
Returns:
- true if values are equal/in-range, false otherwise
isSatisfied
public boolean isSatisfied(
Short shortNumber)
- Tests if the argument's value equals/in-range the initialization
number(s)
-
-
Parameters:
-
shortNumber - The Short object whose value will be used in
testing
-
Returns:
- true if values are equal/in-range, false otherwise
isSatisfied
public boolean isSatisfied(short shortValue)
- Tests if the argument's value equals/in-range the initialization
number(s)
-
-
Parameters:
-
shortValue - The short value which will be used in testing
-
Returns:
- true if values are equal/in-range, false otherwise
isSatisfied
public boolean isSatisfied(
Object object)
-
Description copied from class:
Condition
- This operation is the evaluation operation of this
Condition
in regard to the argument Object. In other words, the operation answers
whether the argument Object satisfied this Condition or
not.
-
-
Overrides:
-
isSatisfied
in class
DataTypeCondition<
N extends
Number &
Comparable<? super
N>>
-
-
Parameters:
-
object - an Object to check if it satisfies this Condition
-
Returns:
-
true if the argument Object satisfies this
Condition,false otherwise.