Class: dataList

Attributes:
Inherits:
Implements:

Contents:

Introduction

Meta Data

Attention
Attention: There is no meta data for this class.

Constants

There are no constants defined for this class.

Properties

Methods

Also See

Attention
Attention: There are no additional references for this class.

Class Syntax

In file D:\oblib-core\php\oblib\dataList\dataList.list.php between lines 45 and 220.

<?php
 
    
/**
     * 
     */

    
abstract class dataList extends data implements Iterator
    
{
        
        private 
$_strNodeType;
        private 
$_arrNode = Array ();
        
        public 
$slp_strNodeType;
        public 
$slp_arrNode;
        
        abstract function 
___Index ($objNode);
        
        function 
__construct ($strNodeName$strNodeType=NULL)
        {
            
parent::__construct ($strNodeName);
            
            if (
$strNodeType !== NULL)
            {
                if (!
class_exists ($strNodeType))
                {
                    throw new 
ExceptionCore ('Class does not exist: ' $strNodeType);
                }
                
                if (!
is_subclass_of ($strNodeType'data'))
                {
                    throw new 
ExceptionCore ('Class is not inheritance of data: ' $strNodeType);
                }
                
                
$this->_strNodeType $strNodeType;
            }
            
            
$this->_arrNode = Array ();
        }
        
        public function 
___Pull ($mixIndex)
        {
            if (isset (
$this->_arrNode [$mixIndex]))
            {
                return 
$this->_arrNode [$mixIndex];
            }
            
            return 
NULL;
        }
        
        public function 
___Push ($objNode)
        {
            if (!
is_object ($objNode) || !($objNode instanceOf data))
            {
                throw new 
ExceptionCore ('Variable is not an object: ' $objNode);
            }
            
            
$mixIndex $this->___Index ($objNode);
            
            if (isset (
$this->_arrNode [$mixIndex]))
            {
                throw new 
ExceptionCore ('Index Defined');
            }
            
            
$this->_arrNode [$mixIndex] = $objNode;
            
            return 
$this->_arrNode [$mixIndex];
        }
        
        public function 
___Pop ($objNode)
        {
            unset (
$this->_arrNode [$this->___Index ($objNode)]);
            
            return 
NULL;
        }
        
        public function 
___Wipe ()
        {
            foreach (
$this->_arrNode AS $mixIndex => &$objChild)
            {
                unset (
$this->_arrNode [$mixIndex]);
            }
        }
        
        public function 
___Length ()
        {
            return 
count ($this->_arrNode);
        }
        
        public function &
___Render (DOMNode $domBase=NULL)
        {
            
$domElement    parent::___Render ($domBase);
            
            foreach (
$this->_arrNode as $objNode)
            {
                
$objNode->___Render ($domElement);
            }
            
            return 
$domElement;
        }
        
        function 
__get ($mixIndex)
        {
            return 
$this->___Pull ($mixIndex);
        }
        
        
//************************************************************************
        // SPL - Iterator Implementation
        //************************************************************************
        
        
private $_bolValid FALSE;
        
        public function 
Current ()
        {
            return 
current ($this->_arrNode);
        }
        
        public function 
Key ()
        {
            return 
key ($this->_arrNode);
        }
        
        public function 
Next ()
        {
            
$this->_bolValid = (next ($this->_arrNode) !== FALSE);
        }
        
        public function 
Rewind ()
        {
            
$this->_bolValid = (reset ($this->_arrNode) !== FALSE);
        }
        
        public function 
Valid ()
        {
            return 
$this->_bolValid;
        }
        
        
//************************************************************************
        // __sleep and __wakeup Magic Methods
        //************************************************************************
        
        
function __sleep ()
        {
            
$this->slp_strNodeType $this->_strNodeType;
            
$this->slp_arrNode = Array ();
            
            if (
$this->_arrNode)
            {
                foreach (
$this->_arrNode as $objChild)
                {
                    
$this->slp_arrNode [] = $objChild;
                }
            }
            
            
$arrSleep parent::__sleep ();
            
$arrSleep [] = 'slp_strNodeType';
            
            if (
$this->slp_arrNode)
            {
                
$arrSleep [] = 'slp_arrNode';
            }
            
            return 
$arrSleep;
        }
        
        function 
__wakeup ()
        {
            
parent::__wakeup ();
            
            
$this->_strNodeType $this->slp_strNodeType;
            
            if (
$this->slp_arrNode)
            {
                foreach (
$this->slp_arrNode as $objNode)
                {
                    
$this->___Push ($objNode);
                }
            }
            
            
$this->slp_strNodeType '';
            
$this->slp_arrNode = Array ();
        }
    }

?>