Skip to content
Snippets Groups Projects
Commit fe3d904e authored by gmantele's avatar gmantele
Browse files

[ADQL] Fix the automatic name of some operands.

The idea is to get rid of special characters such as '-', '+' , '(', ...

This commit resolves a part of the Pull Request #14
parent 1a3bd2be
No related branches found
No related tags found
No related merge requests found
......@@ -16,7 +16,7 @@ package adql.query.operand;
* You should have received a copy of the GNU Lesser General Public License
* along with ADQLLibrary. If not, see <http://www.gnu.org/licenses/>.
*
* Copyright 2012,2014 - UDS/Centre de Données astronomiques de Strasbourg (CDS),
* Copyright 2012-2017 - UDS/Centre de Données astronomiques de Strasbourg (CDS),
* Astronomisches Rechen Institut (ARI)
*/
......@@ -27,7 +27,7 @@ import adql.query.ADQLObject;
* Represents a concatenation in ADQL (ex: <i>"_s_ra" || ':' || "_s_dec"</i>).
*
* @author Gr&eacute;gory Mantelet (CDS;ARI)
* @version 1.3 (10/2014)
* @version 1.4 (09/2017)
*/
public final class Concatenation extends ADQLList<ADQLOperand> implements ADQLOperand {
......@@ -36,7 +36,7 @@ public final class Concatenation extends ADQLList<ADQLOperand> implements ADQLOp
* To add operands, use the "add" functions.
*/
public Concatenation(){
super((String)null);
super("CONCAT_STR");
}
/**
......@@ -81,4 +81,17 @@ public final class Concatenation extends ADQLList<ADQLOperand> implements ADQLOp
return false;
}
@Override
public String toADQL(){
StringBuffer adql = new StringBuffer();
for(int i = 0; i < size(); i++){
if (i > 0)
adql.append(" " + getSeparator(i) + " ");
adql.append(get(i).toADQL());
}
return adql.toString();
}
}
\ No newline at end of file
......@@ -16,7 +16,7 @@ package adql.query.operand;
* You should have received a copy of the GNU Lesser General Public License
* along with ADQLLibrary. If not, see <http://www.gnu.org/licenses/>.
*
* Copyright 2012-2015 - UDS/Centre de Données astronomiques de Strasbourg (CDS),
* Copyright 2012-2017 - UDS/Centre de Données astronomiques de Strasbourg (CDS),
* Astronomisches Rechen Institut (ARI)
*/
......@@ -30,7 +30,7 @@ import adql.query.TextPosition;
* Lets putting a minus sign in front of any numeric operand.
*
* @author Gr&eacute;gory Mantelet (CDS;ARI)
* @version 1.4 (06/2015)
* @version 1.4 (09/2017)
*/
public final class NegativeOperand implements ADQLOperand {
......@@ -116,7 +116,7 @@ public final class NegativeOperand implements ADQLOperand {
@Override
public String getName(){
return "-" + operand.getName();
return "NEG_" + operand.getName();
}
@Override
......
......@@ -16,7 +16,7 @@ package adql.query.operand;
* You should have received a copy of the GNU Lesser General Public License
* along with ADQLLibrary. If not, see <http://www.gnu.org/licenses/>.
*
* Copyright 2012-2015 - UDS/Centre de Données astronomiques de Strasbourg (CDS),
* Copyright 2012-2017 - UDS/Centre de Données astronomiques de Strasbourg (CDS),
* Astronomisches Rechen Institut (ARI)
*/
......@@ -30,7 +30,7 @@ import adql.query.TextPosition;
* It represents a simple numeric operation (sum, difference, multiplication and division).
*
* @author Gr&eacute;gory Mantelet (CDS;ARI)
* @version 1.4 (06/2015)
* @version 1.4 (09/2017)
*
* @see OperationType
*/
......@@ -216,7 +216,7 @@ public class Operation implements ADQLOperand {
@Override
public String getName(){
return operation.toString();
return operation.name();
}
@Override
......
......@@ -16,7 +16,7 @@ package adql.query.operand;
* You should have received a copy of the GNU Lesser General Public License
* along with ADQLLibrary. If not, see <http://www.gnu.org/licenses/>.
*
* Copyright 2012-2015 - UDS/Centre de Données astronomiques de Strasbourg (CDS),
* Copyright 2012-2017 - UDS/Centre de Données astronomiques de Strasbourg (CDS),
* Astronomisches Rechen Institut (ARI)
*/
......@@ -30,7 +30,7 @@ import adql.query.TextPosition;
* Lets wrapping an operand by parenthesis.
*
* @author Gr&eacute;gory Mantelet (CDS;ARI)
* @version 1.4 (06/2015)
* @version 1.4 (09/2017)
*/
public class WrappedOperand implements ADQLOperand {
......@@ -99,7 +99,7 @@ public class WrappedOperand implements ADQLOperand {
@Override
public String getName(){
return "(" + operand.getName() + ")";
return operand.getName();
}
@Override
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment