Package adql.query.constraint
Class Comparison
java.lang.Object
adql.query.constraint.Comparison
- All Implemented Interfaces:
ADQLObject,ADQLConstraint
Represents a comparison (numeric or not) between two operands.
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionComparison(Comparison toCopy) Builds a comparison by copying the given one.Comparison(ADQLOperand left, ComparisonOperator comp, ADQLOperand right) Creates a comparison between two operands. -
Method Summary
Modifier and TypeMethodDescriptionGets an iterator on the intern ADQL objects.getCopy()Gets a (deep) copy of this ADQL object.final LanguageFeatureGet the description of this ADQL's Language Feature.final ADQLOperandGets the left part of the comparison.getName()Gets the name of this object in ADQL.Gets the comparison symbol.final TextPositionGets the position of this object/token in the ADQL query.Gets the right part of the comparison.voidsetLeftOperand(ADQLOperand newLeftOperand) Changes the left operand of this comparison.voidsetOperation(ComparisonOperator newOperation) Changes the type of this operation.final voidsetPosition(TextPosition position) Set the position of thisComparisonin the given ADQL query string.voidsetRightOperand(ADQLOperand newRightOperand) Changes the right operand of this comparison.toADQL()Gets the ADQL expression of this object.
-
Constructor Details
-
Comparison
public Comparison(ADQLOperand left, ComparisonOperator comp, ADQLOperand right) throws NullPointerException, UnsupportedOperationException Creates a comparison between two operands.- Parameters:
left- The left part.comp- The comparison symbol.right- The right part.- Throws:
NullPointerException- If one of the given parameter is NULL.UnsupportedOperationException- If the type of operands and of the operator are incompatible.- See Also:
-
Comparison
Builds a comparison by copying the given one.- Parameters:
toCopy- The comparison to copy.- Throws:
Exception- If there is an error during the copy.
-
-
Method Details
-
getFeatureDescription
Description copied from interface:ADQLObjectGet the description of this ADQL's Language Feature.Note: Getting this description is generally only useful when discovery optional features so that determining if they are allowed to be used in ADQL queries.
- Specified by:
getFeatureDescriptionin interfaceADQLObject- Returns:
- Description of this ADQL object as an ADQL's feature.
-
getLeftOperand
Gets the left part of the comparison.- Returns:
- The left operand.
-
setLeftOperand
public void setLeftOperand(ADQLOperand newLeftOperand) throws NullPointerException, UnsupportedOperationException Changes the left operand of this comparison.- Parameters:
newLeftOperand- The new left operand.- Throws:
NullPointerException- If the given operand is NULL.UnsupportedOperationException- If the type of the given operand is incompatible with the right operand and/or with the comparison operator.
-
getOperator
Gets the comparison symbol.- Returns:
- The comparison operator.
-
setOperation
public void setOperation(ComparisonOperator newOperation) throws NullPointerException, UnsupportedOperationException Changes the type of this operation.- Parameters:
newOperation- The new operation type.- Throws:
NullPointerException- If the given type is NULL.UnsupportedOperationException- If the given type is incompatible with the two operands.
-
getRightOperand
Gets the right part of the comparison.- Returns:
- The right operand.
-
setRightOperand
public void setRightOperand(ADQLOperand newRightOperand) throws NullPointerException, UnsupportedOperationException Changes the right operand of this comparison.- Parameters:
newRightOperand- The new right operand.- Throws:
NullPointerException- If the given operand is NULL.UnsupportedOperationException- If the type of the given operand is incompatible with the left operand and/or with the comparison operator.
-
getPosition
Description copied from interface:ADQLObjectGets the position of this object/token in the ADQL query.By default, no position should be set.
- Specified by:
getPositionin interfaceADQLObject- Returns:
- Position of this ADQL item in the ADQL query, or NULL if not written originally in the query (for example, if added afterwards).
-
setPosition
Set the position of thisComparisonin the given ADQL query string.- Parameters:
position- New position of thisComparison.- Since:
- 1.4
-
getCopy
Description copied from interface:ADQLObjectGets a (deep) copy of this ADQL object.- Specified by:
getCopyin interfaceADQLObject- Returns:
- The copy of this ADQL object.
- Throws:
Exception- If there is any error during the copy.
-
getName
Description copied from interface:ADQLObjectGets the name of this object in ADQL.- Specified by:
getNamein interfaceADQLObject- Returns:
- The name of this ADQL object.
-
adqlIterator
Description copied from interface:ADQLObjectGets an iterator on the intern ADQL objects.Note: The returned iterator is particularly used by a
ISearchHandlerextension to browse a whole ADQL tree.- Specified by:
adqlIteratorin interfaceADQLObject- Returns:
- An ADQL objects iterator.
- See Also:
-
toADQL
Description copied from interface:ADQLObjectGets the ADQL expression of this object.- Specified by:
toADQLin interfaceADQLObject- Returns:
- The corresponding ADQL expression.
-