Adding JMCR-Stable version
[Benchmarks_CSolver.git] / JMCR-Stable / real-world application / MyDerby-10.3 / java / engine / org / apache / derby / iapi / sql / compile / Visitor.java
diff --git a/JMCR-Stable/real-world application/MyDerby-10.3/java/engine/org/apache/derby/iapi/sql/compile/Visitor.java b/JMCR-Stable/real-world application/MyDerby-10.3/java/engine/org/apache/derby/iapi/sql/compile/Visitor.java
new file mode 100644 (file)
index 0000000..be2461c
--- /dev/null
@@ -0,0 +1,94 @@
+/*\r
+\r
+   Derby - Class org.apache.derby.iapi.sql.compile.Visitor\r
+\r
+   Licensed to the Apache Software Foundation (ASF) under one or more\r
+   contributor license agreements.  See the NOTICE file distributed with\r
+   this work for additional information regarding copyright ownership.\r
+   The ASF licenses this file to you under the Apache License, Version 2.0\r
+   (the "License"); you may not use this file except in compliance with\r
+   the License.  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
+\r
+package        org.apache.derby.iapi.sql.compile;\r
+\r
+import org.apache.derby.iapi.error.StandardException;\r
+\r
+/**\r
+ * A visitor is an object that traverses the querytree\r
+ * and performs some action. \r
+ *\r
+ */\r
+public interface Visitor\r
+{\r
+       /**\r
+        * This is the default visit operation on a \r
+        * QueryTreeNode.  It just returns the node.  This\r
+        * will typically suffice as the default visit \r
+        * operation for most visitors unless the visitor \r
+        * needs to count the number of nodes visited or \r
+        * something like that.\r
+        * <p>\r
+        * Visitors will overload this method by implementing\r
+        * a version with a signature that matches a specific\r
+        * type of node.  For example, if I want to do\r
+        * something special with aggregate nodes, then\r
+        * that Visitor will implement a \r
+        *              <I> visit(AggregateNode node)</I>\r
+        * method which does the aggregate specific processing.\r
+        *\r
+        * @param node  the node to process\r
+        *\r
+        * @return a query tree node.  Often times this is\r
+        * the same node that was passed in, but Visitors that\r
+        * replace nodes with other nodes will use this to\r
+        * return the new replacement node.\r
+        *\r
+        * @exception StandardException may be throw an error\r
+        *      as needed by the visitor (i.e. may be a normal error\r
+        *      if a particular node is found, e.g. if checking \r
+        *      a group by, we don't expect to find any ColumnReferences\r
+        *      that aren't under an AggregateNode -- the easiest\r
+        *      thing to do is just throw an error when we find the\r
+        *      questionable node).\r
+        */\r
+       Visitable visit(Visitable node)\r
+               throws StandardException;\r
+\r
+       /**\r
+        * Method that is called to see\r
+        * if query tree traversal should be\r
+        * stopped before visiting all nodes.\r
+        * Useful for short circuiting traversal\r
+        * if we already know we are done.\r
+        *\r
+        * @return true/false\r
+        */\r
+       boolean stopTraversal();\r
+\r
+       /**\r
+        * Method that is called to indicate whether\r
+        * we should skip all nodes below this node\r
+        * for traversal.  Useful if we want to effectively\r
+        * ignore/prune all branches under a particular \r
+        * node.  \r
+        * <p>\r
+        * Differs from stopTraversal() in that it\r
+        * only affects subtrees, rather than the\r
+        * entire traversal.\r
+        *\r
+        * @param node  the node to process\r
+        * \r
+        * @return true/false\r
+        */\r
+       boolean skipChildren(Visitable node) throws StandardException;\r
+}      \r