- Home
- About
- Testimonials
- Demos
- Download
- Documentation
- Blogs
- Forum
- Support

Packages:
default
System
System.Caching
System.Collections
System.Data
System.Data.ActiveRecord
System.Data.ActiveRecord.Relations
System.Data.ActiveRecord.Scaffold
System.Data.ActiveReecord.Scaffold.InputBuilder
System.Data.Commom.Sqlite
System.Data.Common
System.Data.Common.Mssql
System.Data.Common.Mysql
System.Data.Common.Oracle
System.Data.Common.Pgsql
System.Data.Common.Sqlite
System.Data.DataGateway
System.Data.SqlMap
System.Data.SqlMap.Configuration
System.Data.SqlMap.Statements
System.Exceptions
System.I18N
System.IO
System.Security
System.Util
System.Web
System.Web.Services
System.Web.UI
System.Web.UI.ActiveControls
System.Web.UI.WebControls
System.Web.UI.WebControls.assets
System.Xml
Classes:
IMappedStatement
TCachingStatement
TDeleteMappedStatement
TInsertMappedStatement
TMappedStatement
TPostSelectBinding
TPreparedCommand
TPreparedStatement
TPreparedStatementFactory
TResultSetListItemParameter
TResultSetMapItemParameter
TSelectMappedStatement
TSimpleDynamicSql
TSqlMapObjectCollectionTree
TSqlMapSelect
TStaticSql
TUpdateMappedStatement

Keyword

# Class TSqlMapObjectCollectionTree

TSQLMapObjectCollectionTree class.

Maps object collection graphs as trees. Nodes in the collection can be add using parent relationships. The object collections can be build using the collect method.

Since: 3.1
Author: Wei Zhuo <weizhuo[at]gmail[dot]com>

Method Summary
void | add ( string $parent, string $node, mixed $object) Add a new node to the object tree graph.
protected boolean | addNode ( array &$childs, string $parent, string $node) Find the parent node and add the new node as its child.
array | collect ()
protected void | collectChildren ( string $parent, array &$nodes) Visit all the child nodes and collect them by removing.
protected array | getCollection ()
protected boolean | hasChildren ( array &$nodes)
boolean | isEmpty ()
protected void | onChildNodesVisited ( string $parent, array $nodes) Set the object properties for all the child nodes visited.

Method Details

## add

public void add | (string $parent , string $node , mixed $object )

Add a new node to the object tree graph.

Input
string | $parent | parent node id
string | $node | new node id
mixed | $object | node value
Output
Exception

## addNode

protected boolean addNode | (array &$childs , string $parent , string $node )

Find the parent node and add the new node as its child.

Input
array | &$childs | list of nodes to check
string | $parent | parent node id
string | $node | new node id
Output
boolean | true if parent node is found.
Exception

## collect

public array collect | ()

Output
array | object collection
Exception

## collectChildren

protected void collectChildren | (string $parent , array &$nodes )

Visit all the child nodes and collect them by removing.

Input
string | $parent | parent node id
array | &$nodes | list of child nodes.
Output
Exception

## getCollection

protected array getCollection | ()

Output
array | object collection.
Exception

## hasChildren

protected boolean hasChildren | (array &$nodes )

Input
array | &$nodes | list of nodes to check
Output
boolean | true if all nodes are leaf nodes, false otherwise
Exception

## isEmpty

public boolean isEmpty | ()

Output
boolean | true if the graph is empty
Exception

## onChildNodesVisited

protected void onChildNodesVisited | (string $parent , array $nodes )

Set the object properties for all the child nodes visited.

Input
string | $parent | parent node id
array | $nodes | list of child nodes visited.
Output
Exception