More cleanups of public closeFile() method as it is private now and shall only
[core.git] / inc / classes / main / index / class_BaseIndex.php
index 632e444c5315cc54b7eb295656dcadfbbf5c3e0b..6dd651caf43d64d565716dfbfea6ca865223d21a 100644 (file)
@@ -4,7 +4,7 @@
  *
  * @author             Roland Haeder <webmaster@ship-simu.org>
  * @version            0.0.0
- * @copyright  Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2012 Core Developer Team
+ * @copyright  Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2015 Core Developer Team
  * @license            GNU GPL 3.0 or any newer version
  * @link               http://www.ship-simu.org
  *
@@ -89,7 +89,7 @@ class BaseIndex extends BaseFrameworkSystem {
                //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput(sprintf('[%s:%d:] Passed assert().', __METHOD__, __LINE__));
 
                // Check length of count
-               assert(strlen($header[1]) == BaseFile::LENGTH_COUNT);
+               assert(strlen($header[1]) == BaseBinaryFile::LENGTH_COUNT);
                //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput(sprintf('[%s:%d:] Passed assert().', __METHOD__, __LINE__));
 
                // Decode count
@@ -115,14 +115,14 @@ class BaseIndex extends BaseFrameworkSystem {
                        chr(BaseBinaryFile::SEPARATOR_HEADER_DATA),
 
                        // Total entries
-                       str_pad($this->dec2hex($this->getIteratorInstance()->getCounter()), BaseFile::LENGTH_COUNT, '0', STR_PAD_LEFT),
+                       str_pad($this->dec2hex($this->getIteratorInstance()->getCounter()), BaseBinaryFile::LENGTH_COUNT, '0', STR_PAD_LEFT),
 
                        // Separator header<->entries
                        chr(BaseBinaryFile::SEPARATOR_HEADER_ENTRIES)
                );
 
                // Write it to disk (header is always at seek position 0)
-               $this->writeData(0, $header, FALSE);
+               $this->getIteratorInstance()->writeData(0, $header, FALSE);
 
                //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput(sprintf('[%s:%d:] EXIT!', __METHOD__, __LINE__));
        }
@@ -154,7 +154,7 @@ class BaseIndex extends BaseFrameworkSystem {
                $this->getIteratorInstance()->setHeaderSize(
                        strlen(self::INDEX_MAGIC) +
                        strlen(chr(BaseBinaryFile::SEPARATOR_HEADER_DATA)) +
-                       BaseFile::LENGTH_COUNT +
+                       BaseBinaryFile::LENGTH_COUNT +
                        strlen(chr(BaseBinaryFile::SEPARATOR_HEADER_ENTRIES))
                );
 
@@ -184,23 +184,12 @@ class BaseIndex extends BaseFrameworkSystem {
         */
        public function calculateMinimumBlockLength () {
                // Calulcate it
-               $length = BaseFile::LENGTH_TYPE + strlen(chr(BaseBinaryFile::SEPARATOR_TYPE_POSITION)) + BaseFile::LENGTH_POSITION + strlen(chr(BaseBinaryFile::SEPARATOR_ENTRIES));
+               $length = BaseBinaryFile::LENGTH_TYPE + strlen(chr(BaseBinaryFile::SEPARATOR_TYPE_POSITION)) + BaseBinaryFile::LENGTH_POSITION + strlen(chr(BaseBinaryFile::SEPARATOR_ENTRIES));
 
                // Return it
                return $length;
        }
 
-       /**
-        * Close a file source and set it's instance to null and the file name
-        * to empty.
-        *
-        * @return      void
-        * @throws      UnsupportedOperationException   If this method is called
-        */
-       public function closeFile () {
-               throw new UnsupportedOperationException(array($this, __FUNCTION__), self::EXCEPTION_UNSPPORTED_OPERATION);
-       }
-
        /**
         * Determines whether the EOF has been reached
         *