Adding JMCR-Stable version
[Benchmarks_CSolver.git] / JMCR-Stable / real-world application / MyDerby-10.3 / java / engine / org / apache / derby / iapi / sql / compile / CostEstimate.java
diff --git a/JMCR-Stable/real-world application/MyDerby-10.3/java/engine/org/apache/derby/iapi/sql/compile/CostEstimate.java b/JMCR-Stable/real-world application/MyDerby-10.3/java/engine/org/apache/derby/iapi/sql/compile/CostEstimate.java
new file mode 100644 (file)
index 0000000..f6176d2
--- /dev/null
@@ -0,0 +1,112 @@
+/*\r
+\r
+   Derby - Class org.apache.derby.iapi.sql.compile.CostEstimate\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.store.access.StoreCostResult;\r
+\r
+/**\r
+ * A CostEstimate represents the cost of getting a ResultSet, along with the\r
+ * ordering of rows in the ResultSet, and the estimated number of rows in\r
+ * this ResultSet.\r
+ *\r
+ */\r
+\r
+public interface CostEstimate extends StoreCostResult\r
+{\r
+       /**\r
+        * Set the cost for this cost estimate.\r
+        */\r
+       void setCost(double cost, double rowCount, double singleScanRowCount);\r
+\r
+       /**\r
+        * Copy the values from the given cost estimate into this one.\r
+        */\r
+       void setCost(CostEstimate other);\r
+\r
+       /**\r
+        * Set the single scan row count.\r
+        */\r
+       void setSingleScanRowCount(double singleRowScanCount);\r
+\r
+       /**\r
+        * Compare this cost estimate with the given cost estimate.\r
+        *\r
+        * @param other         The cost estimate to compare this one with\r
+        *\r
+        * @return      < 0 if this < other, 0 if this == other, > 0 if this > other\r
+        */\r
+       double compare(CostEstimate other);\r
+\r
+       /**\r
+        * Add this cost estimate to another one.  This presumes that any row\r
+        * ordering is destroyed.\r
+        *\r
+        * @param addend        This cost estimate to add this one to.\r
+        * @param retval        If non-null, put the result here.\r
+        * \r
+        * @return  this + other.\r
+        */\r
+       CostEstimate add(CostEstimate addend, CostEstimate retval);\r
+\r
+       /**\r
+        * Multiply this cost estimate by a scalar, non-dimensional number.  This\r
+        * presumes that any row ordering is destroyed.\r
+        *\r
+        * @param multiplicand  The value to multiply this CostEstimate by.\r
+        * @param retval        If non-null, put the result here.\r
+        * \r
+        * @return      this * multiplicand\r
+        */\r
+       CostEstimate multiply(double multiplicand, CostEstimate retval);\r
+\r
+       /**\r
+        * Divide this cost estimate by a scalar, non-dimensional number.\r
+        *\r
+        * @param divisor       The value to divide this CostEstimate by.\r
+        * @param retval        If non-null, put the result here.\r
+        *\r
+        * @return      this / divisor\r
+        */\r
+       CostEstimate divide(double divisor, CostEstimate retval);\r
+\r
+       /**\r
+        * Get the estimated number of rows returned by the ResultSet that this\r
+        * CostEstimate models.\r
+        */\r
+       double rowCount();\r
+\r
+       /**\r
+        * Get the estimated number of rows returned by a single scan of\r
+        * the ResultSet that this CostEstimate models.\r
+        */\r
+       double singleScanRowCount();\r
+\r
+       /** Get a copy of this CostEstimate */\r
+       CostEstimate cloneMe();\r
+\r
+       /**\r
+        * Return whether or not this CostEstimate is uninitialized.\r
+        *\r
+        * @return Whether or not this CostEstimate is uninitialized.\r
+        */\r
+       public boolean isUninitialized();\r
+}\r