<commit_before><?php
/* This class is part of the XP framework
 *
 * $Id$ 
 */

  define('ARCHIVE_READ',             0x0000);
  define('ARCHIVE_CREATE',           0x0001);
  define('ARCHIVE_HEADER_SIZE',      0x0100);
  define('ARCHIVE_INDEX_ENTRY_SIZE', 0x0100);

  /**
   * Simple lightweight archive reader. This is a reading-only
   * archive class which can be used to minimize class
   * dependencies.
   * 
   * @see      xp://lang.archive.ArchiveClassLoader
   * @purpose  Lightweight archive reader
   */
  class ArchiveReader extends Object {
    public
      $file     = '',
      $version  = 1;
    
    public
      $_hdl     = NULL,
      $_index   = array();

    /**
     * Constructor.
     *
     * @param   string filename
     */
    public function __construct($filename) {
      $this->file= $filename;
    }
    
    /**
     * Check whether a given element exists
     *
     * @param   string id the element's id
     * @return  bool TRUE when the element exists
     */
    public function contains($id) {
      return isset($this->_index[$id]);
    }    
    
    /**
     * Get entry (iterative use)
     * <code>
     *   $a= &new Archive(new File('port.xar'));
     *   $a->open(ARCHIVE_READ);<commit_msg>- Add getURI()<commit_after><?php
/* This class is part of the XP framework
 *
 * $Id$ 
 */

  define('ARCHIVE_READ',             0x0000);
  define('ARCHIVE_CREATE',           0x0001);
  define('ARCHIVE_HEADER_SIZE',      0x0100);
  define('ARCHIVE_INDEX_ENTRY_SIZE', 0x0100);

  /**
   * Simple lightweight archive reader. This is a reading-only
   * archive class which can be used to minimize class
   * dependencies.
   * 
   * @see      xp://lang.archive.ArchiveClassLoader
   * @purpose  Lightweight archive reader
   */
  class ArchiveReader extends Object {
    public
      $file     = '',
      $version  = 1;
    
    public
      $_hdl     = NULL,
      $_index   = array();

    /**
     * Constructor.
     *
     * @param   string filename
     */
    public function __construct($filename) {
      $this->file= $filename;
    }

    /**
     * Get URI
     *
     * @return  string uri
     */
    public function getURI() {
      return $this->file;
    }
    
    /**
     * Check whether a given element exists
     *
     * @param   string id the element's id
     * @return  bool TRUE when the element exists
     */
    public function contains($id) {
      return isset($this->_index[$id]);
    }    
    
    /**
     * Get entry (iterative use)
     * <code>
     *   $a= &new Archive(new File('port.xar'));
     *   $a->open(ARCHIVE_READ);
{'fraction_non_alphanumeric': 0.12307692307692308, 'fraction_numerical': 0.016153846153846154, 'mean_word_length': 1.9691780821917808, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 12, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6806607', 'n_tokens_mistral': 841, 'n_tokens_neox': 788, 'n_words': 207}