public class Operation extends java.lang.Object implements ADQLOperand
OperationType
Constructor and Description |
---|
Operation(ADQLOperand leftOp,
OperationType op,
ADQLOperand rightOp)
Builds an operation.
|
Operation(Operation toCopy)
Builds an Operation by copying the given one.
|
Modifier and Type | Method and Description |
---|---|
ADQLIterator |
adqlIterator()
Gets an iterator on the intern ADQL objects.
|
ADQLObject |
getCopy()
Gets a (deep) copy of this ADQL object.
|
ADQLOperand |
getLeftOperand()
Gets the left part of the operation.
|
java.lang.String |
getName()
Gets the name of this object in ADQL.
|
OperationType |
getOperation()
Gets the operation symbol.
|
TextPosition |
getPosition()
Gets the position of this object/token in the ADQL query.
|
ADQLOperand |
getRightOperand()
Gets the right part of the operation.
|
boolean |
isGeometry()
Always returns false.
|
boolean |
isNumeric()
Always returns true.
|
boolean |
isString()
Always returns false.
|
void |
setLeftOperand(ADQLOperand newLeftOperand)
Changes the left operand of this operation.
|
void |
setOperation(OperationType newOperation)
Changes the type of this operation (SUM, SUB, MULT, DIV).
|
void |
setPosition(TextPosition position)
Sets the position at which this
WrappedOperand has been found in the original ADQL query string. |
void |
setRightOperand(ADQLOperand newRightOperand)
Changes the right operand of this operation.
|
java.lang.String |
toADQL()
Gets the ADQL expression of this object.
|
public Operation(ADQLOperand leftOp, OperationType op, ADQLOperand rightOp) throws java.lang.NullPointerException, java.lang.UnsupportedOperationException
leftOp
- Left operand.op
- Operation symbol.rightOp
- Right operand.java.lang.NullPointerException
- If one of the given parameters is null.java.lang.UnsupportedOperationException
setLeftOperand(ADQLOperand)
,
setRightOperand(ADQLOperand)
public Operation(Operation toCopy) throws java.lang.Exception
toCopy
- The Operand to copy.java.lang.Exception
- If there is an error during the copy.public final ADQLOperand getLeftOperand()
public void setLeftOperand(ADQLOperand newLeftOperand) throws java.lang.NullPointerException, java.lang.UnsupportedOperationException
newLeftOperand
- The new left operand.java.lang.NullPointerException
- If the given operand is null.java.lang.UnsupportedOperationException
- If the given operand is not numeric (see ADQLOperand.isNumeric()
).public final OperationType getOperation()
OperationType
public void setOperation(OperationType newOperation)
newOperation
- The new type of this operation.OperationType
public final ADQLOperand getRightOperand()
public void setRightOperand(ADQLOperand newRightOperand) throws java.lang.NullPointerException, java.lang.UnsupportedOperationException
newRightOperand
- The new right operand of this operation.java.lang.NullPointerException
- If the given operand is null.java.lang.UnsupportedOperationException
- If the given operand is not numeric (see ADQLOperand.isNumeric()
).public final boolean isNumeric()
isNumeric
in interface ADQLOperand
ADQLOperand.isNumeric()
public final boolean isString()
isString
in interface ADQLOperand
ADQLOperand.isString()
public final TextPosition getPosition()
ADQLObject
Gets the position of this object/token in the ADQL query.
By default, no position should be set.
getPosition
in interface ADQLObject
public final void setPosition(TextPosition position)
WrappedOperand
has been found in the original ADQL query string.position
- Position of this WrappedOperand
.public final boolean isGeometry()
isGeometry
in interface ADQLOperand
ADQLOperand.isGeometry()
public ADQLObject getCopy() throws java.lang.Exception
ADQLObject
getCopy
in interface ADQLObject
java.lang.Exception
- If there is any error during the copy.public java.lang.String getName()
ADQLObject
getName
in interface ADQLObject
public ADQLIterator adqlIterator()
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.
adqlIterator
in interface ADQLObject
ADQLIterator
,
ISearchHandler
public java.lang.String toADQL()
ADQLObject
toADQL
in interface ADQLObject