public function __construct($fname)
 {
     $fdata = file($fname);
     $this->records = array();
     $this->uniqueRecords = array(-1, -1, -1);
     foreach ($fdata as $line) {
         $srec = SRecord::createFromString($line);
         if ($srec) {
             $this->records[] = $srec;
             $i = -1;
             switch ($srec->type) {
                 case SRecord::TYPE_HEADER:
                     $i = self::I_HEADER;
                     break;
                 case SRecord::TYPE_COUNT_16BIT:
                 case SRecord::TYPE_COUNT_24BIT:
                     $i = self::I_COUNT;
                     break;
                 case SRecord::TYPE_START_ADDR_32BIT:
                 case SRecord::TYPE_START_ADDR_24BIT:
                 case SRecord::TYPE_START_ADDR_16BIT:
                     $i = self::I_START_ADDR;
                     break;
             }
             if ($i > -1) {
                 $this->uniqueRecords[$i] = count($this->records) - 1;
             }
         }
     }
 }
 function __construct()
 {
     parent::__construct();
     $this->belongs_to('parent', 'FileItem', ':parent_id=id');
     $this->has_many('childs', 'FileItem', ':id=parent_id', array('-type', 'name'));
     $this->has_many('blocks', 'BlockItem', array(':id=file_id', array('parent_id=', 0)), 'id');
 }
 function __construct()
 {
     parent::__construct();
     $this->belongs_to('parent', 'BlockItem', ':parent_id=id');
     $this->has_many('childs', 'BlockItem', ':id=parent_id', 'id');
     $this->belongs_to('file', 'FileItem', ':file_id=id');
     $this->has_many('notes', 'NoteItem', ':id=block_id', 'id');
 }
 function __construct()
 {
     parent::__construct(true);
     $this->belongs_to('block', 'BlockItem', ':block_id=id');
 }
 public function __construct()
 {
     parent::__construct();
     $this->belongs_to('node', 'Node', 'id=:node_id');
 }
 public static function get_root_nodes()
 {
     return SRecord::find_all('Node', array('path=', ''), 'position');
 }