OSDN Git Service

removed all files
[xerial/xerial-core.git] / src / main / java / org / xerial / lens / relation / lang / RelationExpr.java
diff --git a/src/main/java/org/xerial/lens/relation/lang/RelationExpr.java b/src/main/java/org/xerial/lens/relation/lang/RelationExpr.java
deleted file mode 100755 (executable)
index d207adb..0000000
+++ /dev/null
@@ -1,143 +0,0 @@
-/*--------------------------------------------------------------------------\r
- *  Copyright 2009 Taro L. Saito\r
- *\r
- *  Licensed under the Apache License, Version 2.0 (the "License");\r
- *  you may not use this file except in compliance with the License.\r
- *  You may obtain a copy of the License at\r
- *\r
- *     http://www.apache.org/licenses/LICENSE-2.0\r
- *\r
- *  Unless required by applicable law or agreed to in writing, software\r
- *  distributed under the License is distributed on an "AS IS" BASIS,\r
- *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- *  See the License for the specific language governing permissions and\r
- *  limitations under the License.\r
- *--------------------------------------------------------------------------*/\r
-//--------------------------------------\r
-// XerialJ\r
-//\r
-// Relation.java\r
-// Since: Aug 6, 2009 11:04:31 AM\r
-//\r
-// $URL$\r
-// $Author$\r
-//--------------------------------------\r
-package org.xerial.lens.relation.lang;\r
-\r
-import org.antlr.runtime.ANTLRStringStream;\r
-import org.antlr.runtime.CommonTokenStream;\r
-import org.antlr.runtime.RecognitionException;\r
-import org.antlr.runtime.tree.Tree;\r
-import org.xerial.core.XerialErrorCode;\r
-import org.xerial.core.XerialException;\r
-import org.xerial.lens.Lens;\r
-import org.xerial.lens.relation.Tuple;\r
-import org.xerial.lens.relation.TupleElement;\r
-import org.xerial.lens.relation.query.QuerySet;\r
-import org.xerial.lens.relation.query.QuerySet.QuerySetBuilder;\r
-import org.xerial.lens.relation.query.impl.LensQueryLexer;\r
-import org.xerial.lens.relation.query.impl.LensQueryParser;\r
-import org.xerial.lens.relation.schema.Schema;\r
-import org.xerial.lens.relation.schema.SchemaBuilder;\r
-import org.xerial.util.antlr.ANTLRUtil;\r
-import org.xerial.util.log.Logger;\r
-\r
-/**\r
- * Relation expression\r
- * \r
- * @author leo\r
- * \r
- */\r
-public class RelationExpr extends Tuple<RelationAttribute> {\r
-\r
-    private static Logger _logger = Logger.getLogger(RelationExpr.class);\r
-\r
-    public String name;\r
-    public String alias;\r
-\r
-    private static class RelationQuery {\r
-        public RelationExpr relation;\r
-    }\r
-\r
-    public static RelationExpr parse(String expr) throws XerialException {\r
-\r
-        LensQueryLexer l = new LensQueryLexer(new ANTLRStringStream(expr));\r
-        CommonTokenStream ct = new CommonTokenStream(l);\r
-        LensQueryParser p = new LensQueryParser(ct);\r
-\r
-        try {\r
-            LensQueryParser.relation_return ret = p.relation();\r
-            if (_logger.isDebugEnabled())\r
-                _logger\r
-                        .debug(ANTLRUtil\r
-                                .parseTree((Tree) ret.getTree(), LensQueryParser.tokenNames));\r
-\r
-            RelationQuery r = Lens.loadANTLRParseTree(RelationQuery.class, (Tree) ret.getTree(),\r
-                    LensQueryParser.tokenNames);\r
-\r
-            return r.relation;\r
-        }\r
-        catch (RecognitionException e) {\r
-            throw new XerialException(XerialErrorCode.PARSE_ERROR, e);\r
-        }\r
-\r
-    }\r
-\r
-    public void addNode(RelationAttribute node) {\r
-        this.add(node);\r
-    }\r
-\r
-    public void addRelation(RelationExpr relation) {\r
-        this.add(relation);\r
-    }\r
-\r
-    @Override\r
-    public String toString() {\r
-        return String.format("%s%s%s", name, alias != null ? " as " + alias : "", super.toString());\r
-    }\r
-\r
-    public Schema toSchema() {\r
-\r
-        SchemaBuilder parent = new SchemaBuilder();\r
-        parent.add(name);\r
-\r
-        for (TupleElement<RelationAttribute> each : this) {\r
-            if (each.isTuple()) {\r
-                RelationExpr re = RelationExpr.class.cast(each);\r
-                parent.add(re.toSchema());\r
-            }\r
-            else {\r
-                RelationAttribute ra = RelationAttribute.class.cast(each);\r
-                parent.add(ra.name);\r
-            }\r
-        }\r
-\r
-        return parent.build();\r
-\r
-    }\r
-\r
-    public QuerySet buildQuerySet() {\r
-\r
-        QuerySetBuilder b = new QuerySetBuilder();\r
-\r
-        SchemaBuilder parent = new SchemaBuilder();\r
-        parent.add(name);\r
-\r
-        for (TupleElement<RelationAttribute> each : this) {\r
-\r
-            if (each.isTuple()) {\r
-                RelationExpr re = RelationExpr.class.cast(each);\r
-                for (Schema s : re.buildQuerySet().getTargetQuerySet())\r
-                    b.addQueryTarget(s);\r
-            }\r
-            else {\r
-                RelationAttribute ra = RelationAttribute.class.cast(each);\r
-                parent.add(ra.name);\r
-            }\r
-        }\r
-        b.addQueryTarget(parent.build());\r
-\r
-        return b.build();\r
-    }\r
-\r
-}\r