public class NumericConstant extends java.lang.Object implements ADQLOperand
Modifier and Type | Field and Description |
---|---|
protected TextPosition |
position
Position of this operand.
|
protected java.lang.String |
value |
Constructor and Description |
---|
NumericConstant(double val)
The numeric value is saved as a string so that the exact user format can be saved.
|
NumericConstant(long val)
The numeric value is saved as a string so that the exact user format can be saved.
|
NumericConstant(NumericConstant toCopy)
Builds a NumericConstant by copying the given one.
|
NumericConstant(java.lang.String value)
The numeric value is saved as a string so that the exact user format can be saved.
|
NumericConstant(java.lang.String value,
boolean checkNumeric)
The numeric value is saved as a string so that the exact user format can be saved.
|
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.
|
java.lang.String |
getName()
Gets the name of this object in ADQL.
|
double |
getNumericValue() |
TextPosition |
getPosition()
Gets the position of this object/token in the ADQL query.
|
java.lang.String |
getValue() |
boolean |
isGeometry()
Always returns false.
|
boolean |
isNumeric()
Always returns true.
|
boolean |
isString()
Always returns false.
|
void |
setPosition(TextPosition position)
Sets the position at which this
NumericConstant has been found in the original ADQL query string. |
void |
setValue(double value)
Sets the given value.
|
void |
setValue(long value)
Sets the given value.
|
void |
setValue(java.lang.String value)
Sets the given value (it must be convertible in a Double).
|
void |
setValue(java.lang.String value,
boolean checkNumeric)
Sets the given value.
|
java.lang.String |
toADQL()
Gets the ADQL expression of this object.
|
protected java.lang.String value
protected TextPosition position
public NumericConstant(java.lang.String value) throws java.lang.NumberFormatException
value
- The numeric value (in a String variable).java.lang.NumberFormatException
- If it is impossible to convert the given value in a Double.setValue(String)
public NumericConstant(long val)
val
- The numeric value.public NumericConstant(double val)
val
- The numeric value.public NumericConstant(java.lang.String value, boolean checkNumeric) throws java.lang.NumberFormatException
value
- The numeric value (in a String variable).checkNumeric
- true to check whether the given value is numeric, false otherwise.java.lang.NumberFormatException
- If it is impossible to convert the given value in a Double.setValue(String, boolean)
public NumericConstant(NumericConstant toCopy)
toCopy
- The NumericConstant to copy.public java.lang.String getValue()
public double getNumericValue()
public void setValue(long value)
value
- The numeric value.public void setValue(double value)
value
- The numeric value.public void setValue(java.lang.String value) throws java.lang.NumberFormatException
value
- The numeric value.java.lang.NumberFormatException
- If it is impossible to convert the given value in a Double.setValue(String, boolean)
public void setValue(java.lang.String value, boolean checkNumeric) throws java.lang.NumberFormatException
value
- The numeric value.checkNumeric
- true to check whether the given value is numeric, false otherwise.java.lang.NumberFormatException
- If the given value can not be converted in a Double.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)
NumericConstant
has been found in the original ADQL query string.position
- Position of this NumericConstant
.public final boolean isGeometry()
isGeometry
in interface ADQLOperand
ADQLOperand.isGeometry()
public ADQLObject getCopy()
ADQLObject
getCopy
in interface ADQLObject
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