public class SQLFunction extends ADQLFunction
SQLFunctionType
ADQLFunction.ParameterIterator
Constructor and Description |
---|
SQLFunction(SQLFunction toCopy)
Builds a SQL function by copying the given one.
|
SQLFunction(SQLFunctionType t,
ADQLOperand operand)
Creates a SQL function with one parameter.
|
SQLFunction(SQLFunctionType t,
ADQLOperand operand,
boolean distinctValues)
Creates a SQL function with one parameter.
|
Modifier and Type | Method and Description |
---|---|
ADQLObject |
getCopy()
Gets a (deep) copy of this ADQL object.
|
java.lang.String |
getName()
Gets the name of this object in ADQL.
|
int |
getNbParameters()
Gets the number of parameters this function has.
|
ADQLOperand |
getParameter(int index)
Gets the index-th parameter.
|
ADQLOperand[] |
getParameters()
Gets the list of all parameters of this function.
|
SQLFunctionType |
getType()
Gets the type (COUNT, SUM, AVG, ...) of this function.
|
boolean |
isDistinct()
Indicates whether values of the parameter must be distinct or not.
|
boolean |
isGeometry()
Tell whether this operand is a geometrical region or not.
|
boolean |
isNumeric()
Tell whether this operand is numeric or not.
|
boolean |
isString()
Tell whether this operand is a string or not.
|
void |
setDistinct(boolean distinctValues)
Tells if distinct values of the given parameter must be taken.
|
ADQLOperand |
setParameter(int index,
ADQLOperand replacer)
Replaces the index-th parameter by the given one.
|
java.lang.String |
toADQL()
Gets the ADQL expression of this object.
|
adqlIterator, getPosition, paramIterator, setPosition
public SQLFunction(SQLFunctionType t, ADQLOperand operand) throws java.lang.NullPointerException
t
- Type of the function.operand
- The only parameter of this function.java.lang.NullPointerException
- If the given is null or if the given operand is null EXCEPT when the given type is SQLFunctionType.COUNT_ALL
.public SQLFunction(SQLFunctionType t, ADQLOperand operand, boolean distinctValues) throws java.lang.NullPointerException
t
- Type of the function.operand
- The only parameter of this function.distinctValues
- true if the quantifier DISTINCT must be used, false otherwise (ALL).java.lang.NullPointerException
- If the given is null or if the given operand is null EXCEPT when the given type is SQLFunctionType.COUNT_ALL
.public SQLFunction(SQLFunction toCopy) throws java.lang.Exception
toCopy
- The SQL function to copy.java.lang.Exception
- If there is an error during the copy.public final boolean isDistinct()
public void setDistinct(boolean distinctValues)
distinctValues
- true means distinct values, false else.public final SQLFunctionType getType()
public ADQLObject getCopy() throws java.lang.Exception
ADQLObject
java.lang.Exception
- If there is any error during the copy.public java.lang.String getName()
ADQLObject
public final boolean isNumeric()
ADQLOperand
public final boolean isString()
ADQLOperand
public final boolean isGeometry()
ADQLOperand
public ADQLOperand[] getParameters()
ADQLFunction
getParameters
in class ADQLFunction
public int getNbParameters()
ADQLFunction
getNbParameters
in class ADQLFunction
public ADQLOperand getParameter(int index) throws java.lang.ArrayIndexOutOfBoundsException
ADQLFunction
getParameter
in class ADQLFunction
index
- Parameter number.java.lang.ArrayIndexOutOfBoundsException
- If the index is incorrect (index < 0 || index >= getNbParameters()).public ADQLOperand setParameter(int index, ADQLOperand replacer) throws java.lang.ArrayIndexOutOfBoundsException, java.lang.NullPointerException, java.lang.Exception
ADQLFunction
setParameter
in class ADQLFunction
index
- Index of the parameter to replace.replacer
- The replacer.java.lang.ArrayIndexOutOfBoundsException
- If the index is incorrect (index < 0 || index >= getNbParameters()).java.lang.NullPointerException
- If a required parameter must be replaced by a NULL object.java.lang.Exception
- If another error occurs.public java.lang.String toADQL()
ADQLObject
toADQL
in interface ADQLObject
toADQL
in class ADQLFunction