Location: PHPKode > scripts > pTree > ptree/docs/pTree.html
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  <html xmlns="http://www.w3.org/1999/xhtml">
		<head>
			<!-- template designed by Marco Von Ballmoos -->
			<title>Docs For Class pTree</title>
			<link rel="stylesheet" href="stylesheet.css" />
						<meta http-equiv='Content-Type' content='text/html; charset=iso-8859-1'/>
		</head>
		<body>
			<div class="page-body">			

<h2 class="class-name">Class pTree</h2>

<a name="sec-description"></a>
<div class="info-box">
	<div class="info-box-title">Description</div>
	<div class="nav-bar">
					<span class="disabled">Description</span> |
													<a href="#sec-var-summary">Vars</a> (<a href="#sec-vars">details</a>)
						|											<a href="#sec-method-summary">Methods</a> (<a href="#sec-methods">details</a>)
						
					</div>
	<div class="info-box-body">
        		<!-- ========== Info from phpDoc block ========= -->
<p class="short-description">pTreeNode - Generic Node for Tree Implementation</p>
<p class="description"><p>This class provides a Tree Node definition for generic tree data structure implementation</p></p>
	<ul class="tags">
				<li><span class="field">copyright:</span> Copyright® 2005, PontUKom Corp</li>
				<li><span class="field">version:</span> 1.0 First public release</li>
				<li><span class="field">author:</span> Guilherme Blanco &lt;<a href="mailto:hide@address.com">hide@address.com</a>&gt;</li>
			</ul>
		<p class="notes">
			Located in <a class="field" href="_class_pTree_php.html">/class.pTree.php</a> (line <span class="field">28</span>)
		</p>
		
				
		<pre><a href="../pTreeNode/pTreeNode.html">pTreeNode</a>
   |
   --pTree</pre>
	
			</div>
</div>



	<a name="sec-var-summary"></a>
	<div class="info-box">
		<div class="info-box-title">Variable Summary</span></div>
		<div class="nav-bar">
			<a href="#sec-description">Description</a> |
						<span class="disabled">Vars</span> (<a href="#sec-vars">details</a>)
							| 
									<a href="#sec-method-summary">Methods</a> (<a href="#sec-methods">details</a>)
							
								</div>
		<div class="info-box-body">
			<div class="var-summary">
								<div class="var-title">
					<span class="var-type">string</span>
					<a href="#$separator" title="details" class="var-name">$separator</a>
				</div>
							</div>
		</div>
	</div>

	<a name="sec-method-summary"></a>
	<div class="info-box">
		<div class="info-box-title">Method Summary</span></div>
		<div class="nav-bar">
			<a href="#sec-description">Description</a> |
																		<a href="#sec-var-summary">Vars</a> (<a href="#sec-vars">details</a>)
				 
				|
						<span class="disabled">Methods</span> (<a href="#sec-methods">details</a>)
		</div>
		<div class="info-box-body">			
			<div class="method-summary">
								
				<div class="method-definition">
											<span class="method-result">object</span>
										<a href="#__construct" title="details" class="method-name">__construct</a>
											([<span class="var-type">string</span>&nbsp;<span class="var-name">$treeSeparator</span> = <span class="var-default">"/"</span>], [<span class="var-type">string</span>&nbsp;<span class="var-name">$rootName</span> = <span class="var-default">"root"</span>])
									</div>
								
				<div class="method-definition">
											<span class="method-result">object</span>
										<a href="#add" title="details" class="method-name">add</a>
											(<span class="var-type">mixed</span>&nbsp;<span class="var-name">$node</span>, [<span class="var-type">mixed</span>&nbsp;<span class="var-name">$value</span> = <span class="var-default">null</span>])
									</div>
								
				<div class="method-definition">
											<span class="method-result">void</span>
										<a href="#comment" title="details" class="method-name">comment</a>
											(<span class="var-type">mixed</span>&nbsp;<span class="var-name">$node</span>, <span class="var-type">string</span>&nbsp;<span class="var-name">$comment</span>)
									</div>
								
				<div class="method-definition">
											<span class="method-result">mixed</span>
										<a href="#get" title="details" class="method-name">get</a>
											(<span class="var-type">mixed</span>&nbsp;<span class="var-name">$node</span>)
									</div>
								
				<div class="method-definition">
											<span class="method-result">mixed</span>
										<a href="#getChild" title="details" class="method-name">getChild</a>
											(<span class="var-type">string</span>&nbsp;<span class="var-name">$nodeName</span>)
									</div>
								
				<div class="method-definition">
											<span class="method-result">string</span>
										<a href="#getLastName" title="details" class="method-name">getLastName</a>
											(<span class="var-type">string</span>&nbsp;<span class="var-name">$nodePath</span>)
									</div>
								
				<div class="method-definition">
											<span class="method-result">object</span>
										<a href="#getRoot" title="details" class="method-name">getRoot</a>
										()
									</div>
								
				<div class="method-definition">
											<span class="method-result">boolean</span>
										<a href="#hasChilds" title="details" class="method-name">hasChilds</a>
											(<span class="var-type">string</span>&nbsp;<span class="var-name">$node</span>)
									</div>
								
				<div class="method-definition">
											<span class="method-result">boolean</span>
										<a href="#hasValue" title="details" class="method-name">hasValue</a>
											(<span class="var-type">string</span>&nbsp;<span class="var-name">$node</span>)
									</div>
								
				<div class="method-definition">
											<span class="method-result">boolean</span>
										<a href="#isRoot" title="details" class="method-name">isRoot</a>
											(<span class="var-type">string</span>&nbsp;<span class="var-name">$node</span>)
									</div>
								
				<div class="method-definition">
											<span class="method-result">void</span>
										<a href="#remove" title="details" class="method-name">remove</a>
											(<span class="var-type">mixed</span>&nbsp;<span class="var-name">$node</span>)
									</div>
								
				<div class="method-definition">
											<span class="method-result">string</span>
										<a href="#toString" title="details" class="method-name">toString</a>
											(<span class="var-type">integer</span>&nbsp;<span class="var-name">$mode</span>)
									</div>
							</div>
		</div>
	</div>		

	<a name="sec-vars"></a>
	<div class="info-box">
		<div class="info-box-title">Variables</div>
		<div class="nav-bar">
			<a href="#sec-description">Description</a> |
										<a href="#sec-var-summary">Vars</a> (<span class="disabled">details</span>)
						
			
										| 
									<a href="#sec-method-summary">Methods</a> (<a href="#sec-methods">details</a>)
							
					</div>
		<div class="info-box-body">
			<a name="var$separator" id="$separator"><!-- --></A>
<div class="evenrow">

	<div class="var-header">
		<span class="var-title">
			<span class="var-type">string</span>
			<span class="var-name">$separator</span>
			 = <span class="var-default"> &quot;/&quot;</span>			(line <span class="line-number">34</span>)
		</span>
	</div>

	<!-- ========== Info from phpDoc block ========= -->
	<ul class="tags">
				<li><span class="field">var:</span> Tree Path Separator</li>
				<li><span class="field">access:</span> protected</li>
			</ul>
	
	
		
		

</div>

							<h4>Inherited Variables</h4>
				<A NAME='inherited_vars'><!-- --></A>
									<p>Inherited from <span class="classname"><a href="../pTreeNode/pTreeNode.html">pTreeNode</a></span></p>
					<blockquote>
													<span class="var-title">
								<span class="var-name"><a href="../pTreeNode/pTreeNode.html#var$childNodes">pTreeNode::$childNodes</a></span><br>
							</span>
													<span class="var-title">
								<span class="var-name"><a href="../pTreeNode/pTreeNode.html#var$comment">pTreeNode::$comment</a></span><br>
							</span>
													<span class="var-title">
								<span class="var-name"><a href="../pTreeNode/pTreeNode.html#var$depth">pTreeNode::$depth</a></span><br>
							</span>
													<span class="var-title">
								<span class="var-name"><a href="../pTreeNode/pTreeNode.html#var$name">pTreeNode::$name</a></span><br>
							</span>
													<span class="var-title">
								<span class="var-name"><a href="../pTreeNode/pTreeNode.html#var$parentNode">pTreeNode::$parentNode</a></span><br>
							</span>
													<span class="var-title">
								<span class="var-name"><a href="../pTreeNode/pTreeNode.html#var$value">pTreeNode::$value</a></span><br>
							</span>
											</blockquote> 
										
		</div>
	</div>
	
	<a name="sec-methods"></a>
	<div class="info-box">
		<div class="info-box-title">Methods</div>
		<div class="nav-bar">
			<a href="#sec-description">Description</a> |
															<a href="#sec-var-summary">Vars</a> (<a href="#sec-vars">details</a>)
																	<a href="#sec-method-summary">Methods</a> (<span class="disabled">details</span>)
						
		</div>
		<div class="info-box-body">
			<A NAME='method_detail'></A>
<a name="method__construct" id="__construct"><!-- --></a>
<div class="oddrow">
	
	<div class="method-header">
		<span class="method-title">Constructor __construct</span> (line <span class="line-number">45</span>)
	</div> 
	
	<!-- ========== Info from phpDoc block ========= -->
<p class="short-description">Constructor - Generates a Tree Data Structure</p>
	<ul class="tags">
				<li><span class="field">return:</span> Tree</li>
				<li><span class="field">access:</span> public</li>
			</ul>
	
	<div class="method-signature">
		<span class="method-result">object</span>
		<span class="method-name">
			__construct
		</span>
					([<span class="var-type">string</span>&nbsp;<span class="var-name">$treeSeparator</span> = <span class="var-default">"/"</span>], [<span class="var-type">string</span>&nbsp;<span class="var-name">$rootName</span> = <span class="var-default">"root"</span>])
			</div>
	
			<ul class="parameters">
					<li>
				<span class="var-type">string</span>
				<span class="var-name">$treeSeparator</span><span class="var-description">: Path Char Separator</span>			</li>
					<li>
				<span class="var-type">string</span>
				<span class="var-name">$rootName</span><span class="var-description">: Name of Root</span>			</li>
				</ul>
		
			<hr class="separator" />
		<div class="notes">Redefinition of:</div>
		<dl>
			<dt><a href="../pTreeNode/pTreeNode.html#method__construct">pTreeNode::__construct()</a></dt>
						<dd>Constructor - Should not be called directly. Please use <a href="../pTreeNode/pTreeNode.html#methodaddChild">addChild</a> instead.</dd>
					</dl>
		
	</div>
<a name="methodadd" id="add"><!-- --></a>
<div class="evenrow">
	
	<div class="method-header">
		<span class="method-title">add</span> (line <span class="line-number">61</span>)
	</div> 
	
	<!-- ========== Info from phpDoc block ========= -->
<p class="short-description">Add - Insert OR Update Tree Node with Value</p>
	<ul class="tags">
				<li><span class="field">return:</span> Tree Node Created OR Updated</li>
				<li><span class="field">access:</span> public</li>
			</ul>
	
	<div class="method-signature">
		<span class="method-result">object</span>
		<span class="method-name">
			add
		</span>
					(<span class="var-type">mixed</span>&nbsp;<span class="var-name">$node</span>, [<span class="var-type">mixed</span>&nbsp;<span class="var-name">$value</span> = <span class="var-default">null</span>])
			</div>
	
			<ul class="parameters">
					<li>
				<span class="var-type">mixed</span>
				<span class="var-name">$node</span><span class="var-description">: Node Path or Object</span>			</li>
					<li>
				<span class="var-type">mixed</span>
				<span class="var-name">$value</span><span class="var-description">: Node Value</span>			</li>
				</ul>
		
		
	</div>
<a name="methodcomment" id="comment"><!-- --></a>
<div class="oddrow">
	
	<div class="method-header">
		<span class="method-title">comment</span> (line <span class="line-number">122</span>)
	</div> 
	
	<!-- ========== Info from phpDoc block ========= -->
<p class="short-description">Comment - Insert a Tree Node Comment</p>
	<ul class="tags">
				<li><span class="field">access:</span> public</li>
			</ul>
	
	<div class="method-signature">
		<span class="method-result">void</span>
		<span class="method-name">
			comment
		</span>
					(<span class="var-type">mixed</span>&nbsp;<span class="var-name">$node</span>, <span class="var-type">string</span>&nbsp;<span class="var-name">$comment</span>)
			</div>
	
			<ul class="parameters">
					<li>
				<span class="var-type">mixed</span>
				<span class="var-name">$node</span><span class="var-description">: Node Name or Object</span>			</li>
					<li>
				<span class="var-type">string</span>
				<span class="var-name">$comment</span><span class="var-description">: Node Comment</span>			</li>
				</ul>
		
		
	</div>
<a name="methodget" id="get"><!-- --></a>
<div class="evenrow">
	
	<div class="method-header">
		<span class="method-title">get</span> (line <span class="line-number">106</span>)
	</div> 
	
	<!-- ========== Info from phpDoc block ========= -->
<p class="short-description">Get - Retrieves Node Value</p>
	<ul class="tags">
				<li><span class="field">return:</span> Tree Node Value</li>
				<li><span class="field">access:</span> public</li>
			</ul>
	
	<div class="method-signature">
		<span class="method-result">mixed</span>
		<span class="method-name">
			get
		</span>
					(<span class="var-type">mixed</span>&nbsp;<span class="var-name">$node</span>)
			</div>
	
			<ul class="parameters">
					<li>
				<span class="var-type">mixed</span>
				<span class="var-name">$node</span><span class="var-description">: Node Path or Object</span>			</li>
				</ul>
		
		
	</div>
<a name="methodgetChild" id="getChild"><!-- --></a>
<div class="oddrow">
	
	<div class="method-header">
		<span class="method-title">getChild</span> (line <span class="line-number">138</span>)
	</div> 
	
	<!-- ========== Info from phpDoc block ========= -->
<p class="short-description">Get Child - Retrieve a Child Node of Tree</p>
	<ul class="tags">
				<li><span class="field">return:</span> Tree Node</li>
				<li><span class="field">access:</span> protected</li>
			</ul>
	
	<div class="method-signature">
		<span class="method-result">mixed</span>
		<span class="method-name">
			getChild
		</span>
					(<span class="var-type">string</span>&nbsp;<span class="var-name">$nodeName</span>)
			</div>
	
			<ul class="parameters">
					<li>
				<span class="var-type">string</span>
				<span class="var-name">$nodeName</span><span class="var-description">: Name of Child Node</span>			</li>
				</ul>
		
		
	</div>
<a name="methodgetLastName" id="getLastName"><!-- --></a>
<div class="evenrow">
	
	<div class="method-header">
		<span class="method-title">getLastName</span> (line <span class="line-number">257</span>)
	</div> 
	
	<!-- ========== Info from phpDoc block ========= -->
<p class="short-description">Get Last Name - Retrieves the basename of a given Node Path</p>
	<ul class="tags">
				<li><span class="field">return:</span> Tree Node Basename (Node Name)</li>
				<li><span class="field">access:</span> protected</li>
			</ul>
	
	<div class="method-signature">
		<span class="method-result">string</span>
		<span class="method-name">
			getLastName
		</span>
					(<span class="var-type">string</span>&nbsp;<span class="var-name">$nodePath</span>)
			</div>
	
			<ul class="parameters">
					<li>
				<span class="var-type">string</span>
				<span class="var-name">$nodePath</span><span class="var-description">: Tree Node Path</span>			</li>
				</ul>
		
		
	</div>
<a name="methodgetRoot" id="getRoot"><!-- --></a>
<div class="oddrow">
	
	<div class="method-header">
		<span class="method-title">getRoot</span> (line <span class="line-number">162</span>)
	</div> 
	
	<!-- ========== Info from phpDoc block ========= -->
<p class="short-description">Get Root - Retrieve Root Node</p>
	<ul class="tags">
				<li><span class="field">return:</span> Root Node of Tree</li>
				<li><span class="field">access:</span> public</li>
			</ul>
	
	<div class="method-signature">
		<span class="method-result">object</span>
		<span class="method-name">
			getRoot
		</span>
				()
			</div>
	
		
		
	</div>
<a name="methodhasChilds" id="hasChilds"><!-- --></a>
<div class="evenrow">
	
	<div class="method-header">
		<span class="method-title">hasChilds</span> (line <span class="line-number">196</span>)
	</div> 
	
	<!-- ========== Info from phpDoc block ========= -->
<p class="short-description">Has Childs - Checks if a Tree Node has Childs or not</p>
	<ul class="tags">
				<li><span class="field">return:</span> Returns TRUE is Tree Node has Childs and FALSE if not</li>
				<li><span class="field">access:</span> public</li>
			</ul>
	
	<div class="method-signature">
		<span class="method-result">boolean</span>
		<span class="method-name">
			hasChilds
		</span>
					(<span class="var-type">string</span>&nbsp;<span class="var-name">$node</span>)
			</div>
	
			<ul class="parameters">
					<li>
				<span class="var-type">string</span>
				<span class="var-name">$node</span><span class="var-description">: Node Name</span>			</li>
				</ul>
		
		
	</div>
<a name="methodhasValue" id="hasValue"><!-- --></a>
<div class="oddrow">
	
	<div class="method-header">
		<span class="method-title">hasValue</span> (line <span class="line-number">217</span>)
	</div> 
	
	<!-- ========== Info from phpDoc block ========= -->
<p class="short-description">Has Value - Checks if a Tree Node has Value or not</p>
	<ul class="tags">
				<li><span class="field">return:</span> Returns TRUE is Tree Node has Value; FALSE instead</li>
				<li><span class="field">access:</span> public</li>
			</ul>
	
	<div class="method-signature">
		<span class="method-result">boolean</span>
		<span class="method-name">
			hasValue
		</span>
					(<span class="var-type">string</span>&nbsp;<span class="var-name">$node</span>)
			</div>
	
			<ul class="parameters">
					<li>
				<span class="var-type">string</span>
				<span class="var-name">$node</span><span class="var-description">: Node Name</span>			</li>
				</ul>
		
		
	</div>
<a name="methodisRoot" id="isRoot"><!-- --></a>
<div class="evenrow">
	
	<div class="method-header">
		<span class="method-title">isRoot</span> (line <span class="line-number">175</span>)
	</div> 
	
	<!-- ========== Info from phpDoc block ========= -->
<p class="short-description">Is Root - Checks if a given Tree Node is the Root of Tree</p>
	<ul class="tags">
				<li><span class="field">return:</span> Returns TRUE is Tree Node is the Root of the Tree; FALSE instead</li>
				<li><span class="field">access:</span> public</li>
			</ul>
	
	<div class="method-signature">
		<span class="method-result">boolean</span>
		<span class="method-name">
			isRoot
		</span>
					(<span class="var-type">string</span>&nbsp;<span class="var-name">$node</span>)
			</div>
	
			<ul class="parameters">
					<li>
				<span class="var-type">string</span>
				<span class="var-name">$node</span><span class="var-description">: Node Name</span>			</li>
				</ul>
		
		
	</div>
<a name="methodremove" id="remove"><!-- --></a>
<div class="oddrow">
	
	<div class="method-header">
		<span class="method-title">remove</span> (line <span class="line-number">88</span>)
	</div> 
	
	<!-- ========== Info from phpDoc block ========= -->
<p class="short-description">Remove - Remove Tree Node and All Sub-Childs</p>
	<ul class="tags">
				<li><span class="field">access:</span> public</li>
			</ul>
	
	<div class="method-signature">
		<span class="method-result">void</span>
		<span class="method-name">
			remove
		</span>
					(<span class="var-type">mixed</span>&nbsp;<span class="var-name">$node</span>)
			</div>
	
			<ul class="parameters">
					<li>
				<span class="var-type">mixed</span>
				<span class="var-name">$node</span><span class="var-description">: Node Name or Object</span>			</li>
				</ul>
		
		
	</div>
<a name="methodtoString" id="toString"><!-- --></a>
<div class="evenrow">
	
	<div class="method-header">
		<span class="method-title">toString</span> (line <span class="line-number">238</span>)
	</div> 
	
	<!-- ========== Info from phpDoc block ========= -->
<p class="short-description">To String - Creates a Human readable output of Tree Node</p>
	<ul class="tags">
				<li><span class="field">return:</span> Formatted readable output of Tree</li>
				<li><span class="field">access:</span> public</li>
			</ul>
	
	<div class="method-signature">
		<span class="method-result">string</span>
		<span class="method-name">
			toString
		</span>
					(<span class="var-type">integer</span>&nbsp;<span class="var-name">$mode</span>)
			</div>
	
			<ul class="parameters">
					<li>
				<span class="var-type">integer</span>
				<span class="var-name">$mode</span><span class="var-description">: Output Mode</span>			</li>
				</ul>
		
			<hr class="separator" />
		<div class="notes">Redefinition of:</div>
		<dl>
			<dt><a href="../pTreeNode/pTreeNode.html#methodtoString">pTreeNode::toString()</a></dt>
						<dd>To String - Creates a Human readable output of Tree Node (reverse of <a href="../pTreeNode/pTreeNode.html#methodfromString">fromString</a> method)</dd>
					</dl>
		
	</div>
							<h4>Inherited Methods</h4>
				<a name='inherited_methods'><!-- --></a>	
									<!-- =========== Summary =========== -->
					<p>Inherited From <span class="classname"><a href="../pTreeNode/pTreeNode.html">pTreeNode</a></span></p>
					<blockquote>
													<span class="method-name"><a href="../pTreeNode/pTreeNode.html#method__construct">pTreeNode::__construct()</a></span><br>
													<span class="method-name"><a href="../pTreeNode/pTreeNode.html#methodaddChild">pTreeNode::addChild()</a></span><br>
													<span class="method-name"><a href="../pTreeNode/pTreeNode.html#methodaddComment">pTreeNode::addComment()</a></span><br>
													<span class="method-name"><a href="../pTreeNode/pTreeNode.html#methodfromString">pTreeNode::fromString()</a></span><br>
													<span class="method-name"><a href="../pTreeNode/pTreeNode.html#methodgetAllChilds">pTreeNode::getAllChilds()</a></span><br>
													<span class="method-name"><a href="../pTreeNode/pTreeNode.html#methodgetChildNode">pTreeNode::getChildNode()</a></span><br>
													<span class="method-name"><a href="../pTreeNode/pTreeNode.html#methodgetDepth">pTreeNode::getDepth()</a></span><br>
													<span class="method-name"><a href="../pTreeNode/pTreeNode.html#methodgetName">pTreeNode::getName()</a></span><br>
													<span class="method-name"><a href="../pTreeNode/pTreeNode.html#methodgetParent">pTreeNode::getParent()</a></span><br>
													<span class="method-name"><a href="../pTreeNode/pTreeNode.html#methodgetValue">pTreeNode::getValue()</a></span><br>
													<span class="method-name"><a href="../pTreeNode/pTreeNode.html#methodparseValue">pTreeNode::parseValue()</a></span><br>
													<span class="method-name"><a href="../pTreeNode/pTreeNode.html#methodremoveAllChilds">pTreeNode::removeAllChilds()</a></span><br>
													<span class="method-name"><a href="../pTreeNode/pTreeNode.html#methodremoveChild">pTreeNode::removeChild()</a></span><br>
													<span class="method-name"><a href="../pTreeNode/pTreeNode.html#methodsetValue">pTreeNode::setValue()</a></span><br>
													<span class="method-name"><a href="../pTreeNode/pTreeNode.html#methodtoString">pTreeNode::toString()</a></span><br>
													<span class="method-name"><a href="../pTreeNode/pTreeNode.html#method__destruct">pTreeNode::__destruct()</a></span><br>
											</blockquote>
										
		</div>
	</div>


	<p class="notes" id="credit">
		Documentation generated on Sun, 20 Feb 2005 23:03:05 -0300 by <a href="http://www.phpdoc.org" target="_blank">phpDocumentor 1.3.0RC3</a>
	</p>
	</div></body>
</html>
Return current item: pTree