--- /dev/null
+/*\r
+\r
+ Derby - Class org.apache.derby.iapi.sql.compile.OptimizableList\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
+import org.apache.derby.iapi.sql.dictionary.DataDictionary;\r
+\r
+/**\r
+ * OptimizableList provides services for optimizing a list of\r
+ * Optimizables (tables) in a query.\r
+ */\r
+\r
+public interface OptimizableList {\r
+\r
+ /**\r
+ * Return the number of Optimizables in the list.\r
+ *\r
+ * @return integer The number of Optimizables in the list.\r
+ */\r
+ public int size();\r
+\r
+ /**\r
+ * Return the nth Optimizable in the list.\r
+ *\r
+ * @param n "index" (0 based) into the list.\r
+ *\r
+ * @return Optimizable The nth Optimizables in the list.\r
+ */\r
+ public Optimizable getOptimizable(int n);\r
+\r
+ /**\r
+ * Set the nth Optimizable to the specified Optimizable.\r
+ *\r
+ * @param n "index" (0 based) into the list.\r
+ * @param optimizable New nth Optimizable.\r
+ */\r
+ public void setOptimizable(int n, Optimizable optimizable);\r
+\r
+ /** \r
+ * Verify that the Properties list with optimizer overrides, if specified, is valid\r
+ *\r
+ * @param dDictionary The DataDictionary to use.\r
+ *\r
+ * @exception StandardException Thrown on error\r
+ */\r
+ public void verifyProperties(DataDictionary dDictionary) throws StandardException;\r
+\r
+ /**\r
+ * Set the join order for this list of optimizables. The join order is\r
+ * represented as an array of integers - each entry in the array stands\r
+ * for the order of the corresponding element in the list. For example,\r
+ * a joinOrder of {2, 0, 1} means that the 3rd Optimizable in the list\r
+ * (element 2, since we are zero-based) is the first one in the join\r
+ * order, followed by the 1st element in the list, and finally by the\r
+ * 2nd element in the list.\r
+ *\r
+ * This method shuffles this OptimizableList to match the join order.\r
+ *\r
+ * Obviously, the size of the array must equal the number of elements in\r
+ * the array, and the values in the array must be between 0 and the\r
+ * number of elements in the array minus 1, and the values in the array\r
+ * must be unique.\r
+ */\r
+ public void reOrder(int[] joinOrder);\r
+\r
+ /**\r
+ * user can specify that s/he doesn't want statistics to be considered when\r
+ * optimizing the query.\r
+ */\r
+ public boolean useStatistics();\r
+\r
+ /**\r
+ * Tell whether the join order should be optimized.\r
+ */\r
+ public boolean optimizeJoinOrder();\r
+\r
+ /**\r
+ * Tell whether the join order is legal.\r
+ */\r
+ public boolean legalJoinOrder(int numTablesInQuery);\r
+\r
+ /**\r
+ * Init the access paths for these optimizables.\r
+ *\r
+ * @param optimizer The optimizer being used.\r
+ */\r
+ public void initAccessPaths(Optimizer optimizer);\r
+}\r