Adding JMCR-Stable version
[Benchmarks_CSolver.git] / JMCR-Stable / real-world application / MyDerby-10.3 / java / engine / org / apache / derby / impl / sql / execute / rts / RealNoRowsResultSetStatistics.java
diff --git a/JMCR-Stable/real-world application/MyDerby-10.3/java/engine/org/apache/derby/impl/sql/execute/rts/RealNoRowsResultSetStatistics.java b/JMCR-Stable/real-world application/MyDerby-10.3/java/engine/org/apache/derby/impl/sql/execute/rts/RealNoRowsResultSetStatistics.java
new file mode 100644 (file)
index 0000000..979e713
--- /dev/null
@@ -0,0 +1,138 @@
+/*\r
+\r
+   Derby - Class org.apache.derby.impl.sql.execute.rts.RealNoRowsResultSetStatistics\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.impl.sql.execute.rts;\r
+\r
+import org.apache.derby.iapi.services.io.Formatable;\r
+import org.apache.derby.iapi.services.i18n.MessageService;\r
+import org.apache.derby.iapi.reference.SQLState;\r
+\r
+import java.io.ObjectOutput;\r
+import java.io.ObjectInput;\r
+import java.io.IOException;\r
+\r
+import java.util.Vector;\r
+\r
+/**\r
+  ResultSetStatistics implemenation for NoPutResultSetImpl.\r
+\r
+\r
+*/\r
+abstract class RealNoRowsResultSetStatistics\r
+       implements ResultSetStatistics\r
+{\r
+\r
+\r
+       /* Leave these fields public for object inspectors */\r
+\r
+       /* fields used for formating run time statistics output */\r
+       protected String indent;\r
+       protected String subIndent;\r
+       protected int sourceDepth;\r
+       public  ResultSetStatistics     sourceResultSetStatistics;\r
+       protected long executeTime;\r
+\r
+       // variables to implement the inspectable interface.\r
+       // Do these have to be public? \r
+       public long inspectOverall;\r
+       public long inspectNum;\r
+       public String inspectDesc;\r
+\r
+       // CONSTRUCTORS\r
+\r
+       /**\r
+        * Initializes the time spent in NoRowsResultSet minus the source\r
+        * result set.\r
+        */\r
+       public RealNoRowsResultSetStatistics(long executeTime, \r
+                                                                                ResultSetStatistics sourceRS)\r
+       {\r
+               if (sourceRS instanceof RealBasicNoPutResultSetStatistics)\r
+                       this.executeTime = executeTime -\r
+                               ((RealBasicNoPutResultSetStatistics)sourceRS).getTotalTime();\r
+       }\r
\r
+       /**\r
+        * Initialize the format info for run time statistics.\r
+        */\r
+       protected void initFormatInfo(int depth)\r
+       {\r
+               char [] indentchars = new char[depth];\r
+               char [] subIndentchars = new char[depth + 1];\r
+               sourceDepth = depth + 1;\r
+\r
+               /*\r
+               ** Form an array of tab characters for indentation.\r
+               */\r
+               subIndentchars[depth] = '\t';\r
+               while (depth > 0)\r
+               {\r
+                       subIndentchars[depth - 1] = '\t';\r
+                       indentchars[depth - 1] = '\t';\r
+                       depth--;\r
+               }\r
+               \r
+               indent = new String(indentchars);\r
+               subIndent = new String(subIndentchars);\r
+       }\r
+\r
+       /**\r
+        * Dump out the time information for run time stats.\r
+        *\r
+        * @return String to be printed out.\r
+        */\r
+       protected String dumpTimeStats(String indent)\r
+       {\r
+               return\r
+                       indent + MessageService.getTextMessage(SQLState.RTS_EXECUTE_TIME) +\r
+                                       " = " + executeTime + "\n";\r
+       }\r
+       /**\r
+        * Get the objects to be displayed when this tree object is expanded.\r
+        * <P>\r
+        * The objects returned can be of any type, including addtional Inspectables.\r
+   *\r
+        * @return java.util.Vector     A vector of objects.\r
+        */\r
+  public Vector getChildren(){\r
+    Vector children = new Vector();\r
+    children.addElement(sourceResultSetStatistics);\r
+    return children;\r
+  }\r
+\r
+       /**\r
+   * Format for display, a name for this node.\r
+        *\r
+        */\r
+  public abstract String getNodeName();\r
+\r
+       /**\r
+        * Get the estimated row count for the number of rows returned\r
+        * by the associated query or statement.\r
+        *\r
+        * @return      The estimated number of rows returned by the associated\r
+        * query or statement.\r
+        */\r
+       public double getEstimatedRowCount()\r
+       {\r
+               return 0.0;\r
+       }\r
+}\r