Author: dr
Date: Fri Aug 10 14:09:37 2007
New Revision: 5872

Log:
- Added some examples.

Modified:
    trunk/Tree/src/backends/memory.php
    trunk/Tree/src/backends/xml.php
    trunk/Tree/src/stores/xml_internal.php
    trunk/Tree/src/tree_node.php
    trunk/Tree/src/tree_node_list.php

Modified: trunk/Tree/src/backends/memory.php
==============================================================================
--- trunk/Tree/src/backends/memory.php [iso-8859-1] (original)
+++ trunk/Tree/src/backends/memory.php [iso-8859-1] Fri Aug 10 14:09:37 2007
@@ -11,6 +11,18 @@
  * ezcTreeMemory is an implementation of a tree backend that operates on
  * an in-memory tree structure. Meta-information is kept in objects of the
  * ezcTreeMemoryNode class.
+ *
+ * Example:
+ * <code>
+ * <?php
+ *     // Create a new tree
+ *     $tree = ezcTreeMemory::create( new ezcTreeMemoryDataStore() );
+ *     // or
+ *     $tree = new ezcTreeMemory( new ezcTreeMemoryDataStore() );
+ * ?>
+ * </code>
+ *
+ * See [EMAIL PROTECTED] ezcTree} for examples on how to operate on the tree.
  *
  * @property-read ezcTreeXmlDataStore $store
  *

Modified: trunk/Tree/src/backends/xml.php
==============================================================================
--- trunk/Tree/src/backends/xml.php [iso-8859-1] (original)
+++ trunk/Tree/src/backends/xml.php [iso-8859-1] Fri Aug 10 14:09:37 2007
@@ -10,6 +10,25 @@
 /**
  * ezcTreeXml is an implementation of a tree backend that operates on
  * an XML file.
+ *
+ * Example:
+ * <code>
+ * <?php
+ *     // Create a new tree in a new XML file
+ *     $tree = ezcTreeXml::create(
+ *         'new-tree.xml', 
+ *         new ezcTreeXmlInternalDataStore()
+ *     );
+ * 
+ *     // Open an existing XML file containing a tree structure
+ *     $tree = new ezcTreeXml(  
+ *         'existing-tree.xml',
+ *         new ezcTreeXmlInternalDataStore()
+ *     );
+ * ?>
+ * </code>
+ *
+ * See [EMAIL PROTECTED] ezcTree} for examples on how to operate on the tree.
  *
  * @property-read ezcTreeXmlDataStore $store
  *

Modified: trunk/Tree/src/stores/xml_internal.php
==============================================================================
--- trunk/Tree/src/stores/xml_internal.php [iso-8859-1] (original)
+++ trunk/Tree/src/stores/xml_internal.php [iso-8859-1] Fri Aug 10 14:09:37 2007
@@ -14,7 +14,6 @@
  *
  * @package Tree
  * @version //autogentag//
- * @mainclass
  */
 class ezcTreeXmlInternalDataStore extends ezcTreeXmlDataStore
 {

Modified: trunk/Tree/src/tree_node.php
==============================================================================
--- trunk/Tree/src/tree_node.php [iso-8859-1] (original)
+++ trunk/Tree/src/tree_node.php [iso-8859-1] Fri Aug 10 14:09:37 2007
@@ -12,7 +12,7 @@
  *
  * The methods that operate on nodes (fetchChildren, fetchPath, ...,
  * isSiblingOf) are all marshalled to calls on the tree (that is stored in the
- * $tree private variable) itself.
+ * $tree private variable) itself. 
  *
  * @property-read string  $id          The ID that uniquely identifies a node
  * @property-read ezcTree $tree        The tree object that this node belongs 
to
@@ -23,6 +23,17 @@
  * @property      bool    $dataStored  Whether the data for this node has been
  *                                     stored. Should *only* be modified by
  *                                     data store implementations.
+ *
+ * Example:
+ * <code>
+ * <?php
+ *     // Creates a new node with ID 'O' and as data 'Oxygen'
+ *     $node = new ezcTreeNode( $this->tree, 'O', 'Oxygen' );
+ * 
+ *     // Adds a node as child element to another already create node in a tree
+ *     $parentNode->addChild( $node );
+ * ?>
+ * </code>
  *
  * @package Tree
  * @version //autogentag//

Modified: trunk/Tree/src/tree_node_list.php
==============================================================================
--- trunk/Tree/src/tree_node_list.php [iso-8859-1] (original)
+++ trunk/Tree/src/tree_node_list.php [iso-8859-1] Fri Aug 10 14:09:37 2007
@@ -14,6 +14,39 @@
  * implements the ArrayAccess SPL interface. The array is indexed based on the
  * the node's ID.
  *
+ * Example:
+ * <code>
+ * <?php
+ *     // Create a list with two elements
+ *     $list = new ezcTreeNodeList;
+ *     $list->addNode( new ezcTreeNode( $tree, 'Leo' ) );
+ *     $list->addNode( new ezcTreeNode( $tree, 'Virgo' ) );
+ * 
+ *     // Retrieve the list's size
+ *     echo $list->size, "\n"; // prints 2
+ * 
+ *     // Find a node in the list
+ *     $node = $list['Virgo'];
+ * 
+ *     // Add nodes in an alternative way
+ *     $list['Libra'] = new ezcTreeNode( $tree, 'Libra' );
+ * 
+ *     // Remove a node from the list
+ *     unset( $list['Leo'] );
+ * 
+ *     // Checking if a node exists
+ *     if ( isset( $list['Scorpius'] ) )
+ *     {
+ *         // do something if it exists
+ *     }
+ * 
+ *     // Use the associated data store to fetch the data for all nodes at once
+ *     $list->fetchDataForNodes();
+ * ?>
+ * </code>
+ *
+ * @see ezcTreeNodeListIterator
+ *
  * @property-read string $size The number of nodes in the list.
  *
  * @package Tree


-- 
svn-components mailing list
[email protected]
http://lists.ez.no/mailman/listinfo/svn-components

Reply via email to