original_string: public static function createIndex(Zend_Search_Lucene_Storage_Directory $directory, $generation, $nameCount)
      {
          if ($generation == 0) {
              // Create index in pre-2.1 mode
              foreach ($directory->fileList() as $file) {
                  if ($file == 'deletable' 
                      || $file == 'segments'  
                      || isset(self::$_indexExtensions[ substr($file, strlen($file)-4)]) 
                      || preg_match('/\.f\d+$/i', $file) /* matches <segment_name>.f<decimal_nmber> file names */
                  ) {
                          $directory->deleteFile($file);
                  }
              }
  
              $segmentsFile = $directory->createFile('segments');
              $segmentsFile->writeInt((int)0xFFFFFFFF);
  
              // write version (initialized by current time)
              $segmentsFile->writeLong(round(microtime(true)));
  
              // write name counter
              $segmentsFile->writeInt($nameCount);
              // write segment counter
              $segmentsFile->writeInt(0);
  
              $deletableFile = $directory->createFile('deletable');
              // write counter
              $deletableFile->writeInt(0);
          } else {
              $genFile = $directory->createFile('segments.gen');
  
              $genFile->writeInt((int)0xFFFFFFFE);
              // Write generation two times
              $genFile->writeLong($generation);
              $genFile->writeLong($generation);
  
              $segmentsFile = $directory->createFile(Zend_Search_Lucene::getSegmentFileName($generation));
              $segmentsFile->writeInt((int)0xFFFFFFFD);
  
              // write version (initialized by current time)
              $segmentsFile->writeLong(round(microtime(true)));
  
              // write name counter
              $segmentsFile->writeInt($nameCount);
              // write segment counter
              $segmentsFile->writeInt(0);
          }
      }
code: public static function createIndex(Zend_Search_Lucene_Storage_Directory $directory, $generation, $nameCount)
      {
          if ($generation == 0) {
              // Create index in pre-2.1 mode
              foreach ($directory->fileList() as $file) {
                  if ($file == 'deletable' 
                      || $file == 'segments'  
                      || isset(self::$_indexExtensions[ substr($file, strlen($file)-4)]) 
                      || preg_match('/\.f\d+$/i', $file) /* matches <segment_name>.f<decimal_nmber> file names */
                  ) {
                          $directory->deleteFile($file);
                  }
              }
  
              $segmentsFile = $directory->createFile('segments');
              $segmentsFile->writeInt((int)0xFFFFFFFF);
  
              // write version (initialized by current time)
              $segmentsFile->writeLong(round(microtime(true)));
  
              // write name counter
              $segmentsFile->writeInt($nameCount);
              // write segment counter
              $segmentsFile->writeInt(0);
  
              $deletableFile = $directory->createFile('deletable');
              // write counter
              $deletableFile->writeInt(0);
          } else {
              $genFile = $directory->createFile('segments.gen');
  
              $genFile->writeInt((int)0xFFFFFFFE);
              // Write generation two times
              $genFile->writeLong($generation);
              $genFile->writeLong($generation);
  
              $segmentsFile = $directory->createFile(Zend_Search_Lucene::getSegmentFileName($generation));
              $segmentsFile->writeInt((int)0xFFFFFFFD);
  
              // write version (initialized by current time)
              $segmentsFile->writeLong(round(microtime(true)));
  
              // write name counter
              $segmentsFile->writeInt($nameCount);
              // write segment counter
              $segmentsFile->writeInt(0);
          }
      }
code_tokens: public static function createIndex ( Zend_Search_Lucene_Storage_Directory $ directory , $ generation , $ nameCount ) { if ( $ generation == 0 ) { // Create index in pre-2.1 mode foreach ( $ directory -> fileList ( ) as $ file ) { if ( $ file == 'deletable' || $ file == 'segments' || isset ( self :: $ _indexExtensions [ substr ( $ file , strlen ( $ file ) - 4 ) ] ) || preg_match ( '/\.f\d+$/i' , $ file ) /* matches <segment_name>.f<decimal_nmber> file names */ ) { $ directory -> deleteFile ( $ file ) ; } } $ segmentsFile = $ directory -> createFile ( 'segments' ) ; $ segmentsFile -> writeInt ( ( int ) 0xFFFFFFFF ) ; // write version (initialized by current time) $ segmentsFile -> writeLong ( round ( microtime ( true ) ) ) ; // write name counter $ segmentsFile -> writeInt ( $ nameCount ) ; // write segment counter $ segmentsFile -> writeInt ( 0 ) ; $ deletableFile = $ directory -> createFile ( 'deletable' ) ; // write counter $ deletableFile -> writeInt ( 0 ) ; } else { $ genFile = $ directory -> createFile ( 'segments.gen' ) ; $ genFile -> writeInt ( ( int ) 0xFFFFFFFE ) ; // Write generation two times $ genFile -> writeLong ( $ generation ) ; $ genFile -> writeLong ( $ generation ) ; $ segmentsFile = $ directory -> createFile ( Zend_Search_Lucene :: getSegmentFileName ( $ generation ) ) ; $ segmentsFile -> writeInt ( ( int ) 0xFFFFFFFD ) ; // write version (initialized by current time) $ segmentsFile -> writeLong ( round ( microtime ( true ) ) ) ; // write name counter $ segmentsFile -> writeInt ( $ nameCount ) ; // write segment counter $ segmentsFile -> writeInt ( 0 ) ; } }
docstring: Create empty index
  
  @param Zend_Search_Lucene_Storage_Directory $directory
  @param integer                              $generation
  @param integer                              $nameCount
docstring_tokens: Create empty index