public final class IsCondition extends Condition
Condition
that represents a special condition. An IsCondition
determines whether an expression evaluates to null
or to the special values INFINITE
or NAN
(not a number), which is the undefined result of an operation. The INFINITE
and NAN
conditions are the SQL floating-point conditions.
An IsCondition
has the following associations:
IS_INFINITE
, IS_NAN
, IS_NULL
.boolean
value that specifies whether to apply the NOT
operator to the comparison. This value is returned by the isNegated
method.The following table lists the possible combinations of comparison values and negation values, describes the results of operation that the comparison performs, and provides an example of the syntax for the condition. In the syntax, the value of the base expression is 'comm_pct'
. If you passed the syntax to the SyntaxObject.fromSyntax
method, then the method would return an IsCondition
object that specifies the operation described.
An example of creating an IsCondition
from a syntax example is the following, where metadataProvider
is an MdmMetadataProvider
:
IsCondition ic = (IsCondition) SyntaxObject.fromSyntax("'com_pct' IS NAN", metadataProvider);
Type of Comparison | isNegated Value |
Operation Result | Syntax Example |
---|---|---|---|
IS_INFINITE |
false |
Evaluates to true if the base expression is the special infinite value or to false it is not. |
'com_pct' IS INFINITE |
IS_INFINITE |
true |
Evaluates to true if the base expression is not the special infinite value or to false it is. |
'com_pct' IS NOT INFINITE |
IS_NAN |
false |
Evaluates to true if the base expression is the special not-a-number value or to false it is not. |
'com_pct' IS NAN |
IS_NAN |
true |
Evaluates to true if the base expression is not the special not-a-number value or to false it is. |
'com_pct' IS NOT NAN |
IS_NULL |
false |
Evaluates to true if the base expression is null or to false it is not. |
'com_pct' IS NULL |
IS_NULL |
true |
Evaluates to true if the base expression is not null or to false it is. |
'com_pct' IS NOT NULL |
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
IS_INFINITE
A constant for an operator that tests whether the value is infinite.
|
static java.lang.String |
IS_NAN
A constant for an operator that tests whether the value is not a number.
|
static java.lang.String |
IS_NULL
A constant for an operator that tests whether the value is
null . |
Constructor and Description |
---|
IsCondition(TypedExpression argument)
Creates an
IsCondition that has the specified argument, has a comparison type of IS_NULL , and does not include the NOT operator. |
IsCondition(TypedExpression argument, boolean negate)
Creates an
IsCondition that has the specified argument and negation indicator, and has a comparison type of IS_NULL . |
IsCondition(TypedExpression argument, java.lang.String comparisonType, boolean negate)
Creates an
IsCondition that has the specified argument, comparison type, and negation indicator. |
Modifier and Type | Method and Description |
---|---|
TypedExpression |
getBaseExpression()
Gets the expression that is the basis of the condition determination.
|
java.lang.String |
getComparison()
Gets the comparison type, which can be one of the
IsCondition constants. |
boolean |
isNegated()
Indicates whether this
IsCondition includes the NOT operator. |
java.lang.Object |
visit(SyntaxObjectVisitor visitor, java.lang.Object context)
Calls the
visitIsCondition method of the SyntaxObjectVisitor and passes that method this IsCondition and an Object . |
and, isCompositeObject, not, or
equals, equals, fromSyntax, fromSyntax, fromSyntax, fromSyntax, fromSyntax, isValid, toSyntax, toSyntax, toSyntax, toSyntax, toSyntax, toSyntax
public static final java.lang.String IS_NULL
null
.public static final java.lang.String IS_NAN
public static final java.lang.String IS_INFINITE
public IsCondition(TypedExpression argument, java.lang.String comparisonType, boolean negate)
IsCondition
that has the specified argument, comparison type, and negation indicator.argument
- A TypedExpression
that has the value to compare.comparisonType
- A String
that specifies the comparison type, which can be one of the IsCondition
constants.negate
- A boolean
that specifies whether to include the NOT
operator in the condition.public IsCondition(TypedExpression argument, boolean negate)
IsCondition
that has the specified argument and negation indicator, and has a comparison type of IS_NULL
.argument
- A TypedExpression
that has the value to compare.negate
- A boolean
that specifies whether to include the NOT
operator in the condition.public IsCondition(TypedExpression argument)
IsCondition
that has the specified argument, has a comparison type of IS_NULL
, and does not include the NOT
operator.argument
- A TypedExpression
that has the value to compare.public java.lang.Object visit(SyntaxObjectVisitor visitor, java.lang.Object context)
visitIsCondition
method of the SyntaxObjectVisitor
and passes that method this IsCondition
and an Object
.visit
in class SyntaxObject
visitor
- A SyntaxObjectVisitor
.context
- An Object
.Object
returned by the visitIsCondition
method.public java.lang.String getComparison()
IsCondition
constants.String
that has the comparison type.public boolean isNegated()
IsCondition
includes the NOT
operator.boolean
that is true
if this IsCondition
includes the NOT
operator or false
if it does not.public TypedExpression getBaseExpression()
TypedExpression
that has the value that is the basis of the test of the condition.