diff options
Diffstat (limited to 'petascope/src/petascope/wcps/server/core/StringScalarExpr.java')
-rw-r--r-- | petascope/src/petascope/wcps/server/core/StringScalarExpr.java | 86 |
1 files changed, 42 insertions, 44 deletions
diff --git a/petascope/src/petascope/wcps/server/core/StringScalarExpr.java b/petascope/src/petascope/wcps/server/core/StringScalarExpr.java index 132e99d..93b94dc 100644 --- a/petascope/src/petascope/wcps/server/core/StringScalarExpr.java +++ b/petascope/src/petascope/wcps/server/core/StringScalarExpr.java @@ -14,51 +14,49 @@ * You should have received a copy of the GNU General Public License * along with rasdaman community. If not, see <http://www.gnu.org/licenses/>. * - * Copyright 2003, 2004, 2005, 2006, 2007, 2008, 2009 Peter Baumann / - rasdaman GmbH. + * Copyright 2003 - 2010 Peter Baumann / rasdaman GmbH. * * For more information please see <http://www.rasdaman.org> * or contact Peter Baumann via <baumann@rasdaman.com>. */ -package petascope.wcps.server.core;
-
-import petascope.wcps.server.exceptions.InvalidCrsException;
-import petascope.wcps.server.exceptions.WCPSException;
-import org.w3c.dom.*;
-
-public class StringScalarExpr implements IRasNode {
-
- private String op, string;
- private CoverageExpr cov;
-
- public StringScalarExpr(Node node, XmlQuery xq) throws WCPSException, InvalidCrsException {
- while ((node != null) && (node.getNodeName().equals("#text"))) {
- node = node.getNextSibling();
- }
-
- System.err.println("Parsing String Scalar expr : " + node.getNodeName());
-
- if (node.getNodeName().equals("stringIdentifier")) {
- Node child = node.getFirstChild();
- cov = new CoverageExpr(child, xq);
- op = "id";
- } else if (node.getNodeName().equals("stringConstant")) {
- op = "constant";
- string = node.getNodeValue();
- } else {
- throw new WCPSException("Unknown String expr node: " + node.getNodeName());
- }
- }
-
- public String toRasQL() {
- String result = "";
- if (op.equals("constant")) {
- result = string;
- }
- if (op.equals("id")) {
- result = cov.toRasQL();
- }
-
- return result;
- }
-}
+package petascope.wcps.server.core; + +import petascope.exceptions.WCPSException; +import org.w3c.dom.*; + +public class StringScalarExpr implements IRasNode { + + private String op, string; + private CoverageExpr cov; + + public StringScalarExpr(Node node, XmlQuery xq) throws WCPSException { + while ((node != null) && (node.getNodeName().equals("#text"))) { + node = node.getNextSibling(); + } + + System.err.println("Parsing String Scalar expr : " + node.getNodeName()); + + if (node.getNodeName().equals("stringIdentifier")) { + Node child = node.getFirstChild(); + cov = new CoverageExpr(child, xq); + op = "id"; + } else if (node.getNodeName().equals("stringConstant")) { + op = "constant"; + string = node.getNodeValue(); + } else { + throw new WCPSException("Unknown String expr node: " + node.getNodeName()); + } + } + + public String toRasQL() { + String result = ""; + if (op.equals("constant")) { + result = string; + } + if (op.equals("id")) { + result = cov.toRasQL(); + } + + return result; + } +} |