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.
- Version:
- 1.4 (06/2015)
- Author:
- Grégory Mantelet (CDS;ARI)
- 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 ADQLOperand
Gets the left part of the comparison.getName()
Gets the name of this object in ADQL.Gets the comparison symbol.final TextPosition
Gets the position of this object/token in the ADQL query.Gets the right part of the comparison.void
setLeftOperand
(ADQLOperand newLeftOperand) Changes the left operand of this comparison.void
setOperation
(ComparisonOperator newOperation) Changes the type of this operation.final void
setPosition
(TextPosition position) Set the position of thisComparison
in the given ADQL query string.void
setRightOperand
(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 incompatibles.- 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
-
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:ADQLObject
Gets the position of this object/token in the ADQL query.
By default, no position should be set.
- Specified by:
getPosition
in 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 thisComparison
in the given ADQL query string.- Parameters:
position
- New position of thisComparison
.- Since:
- 1.4
-
getCopy
Description copied from interface:ADQLObject
Gets a (deep) copy of this ADQL object.- Specified by:
getCopy
in interfaceADQLObject
- Returns:
- The copy of this ADQL object.
- Throws:
Exception
- If there is any error during the copy.
-
getName
Description copied from interface:ADQLObject
Gets the name of this object in ADQL.- Specified by:
getName
in interfaceADQLObject
- Returns:
- The name of this ADQL object.
-
adqlIterator
Description copied from interface:ADQLObject
Gets an iterator on the intern ADQL objects.
Note:The returned iterator is particularly used by a
ISearchHandler
extension to browse a whole ADQL tree.- Specified by:
adqlIterator
in interfaceADQLObject
- Returns:
- An ADQL objects iterator.
- See Also:
-
toADQL
Description copied from interface:ADQLObject
Gets the ADQL expression of this object.- Specified by:
toADQL
in interfaceADQLObject
- Returns:
- The corresponding ADQL expression.
-