SetaPDF_Core_DataStructure_NumberTree Data structure class for Number Trees

File: /SetaPDF/Core/DataStructure/NumberTree.php

Class hierarchy

Implements

Summary

Static Properties

$leafNodesPerNode

Leaf nodes per node


Properties

$_document

The document to which the tree depends to

$_isNew

Is this a new tree or should we update an existing one

$_rootDictionary

The dictionary entry in the dictionary of the root object

$_values

The index is the key while the value is an array of both key and value object.


Methods

__construct()

public SetaPDF_Core_DataStructure_Tree::__construct ( SetaPDF_Core_Type_Dictionary $rootDictionary, SetaPDF_Core_Document $document )

The constructor.

Parameters
$rootDictionary : SetaPDF_Core_Type_Dictionary
 
$document : SetaPDF_Core_Document
 

_findLastLeafNode()

protected bool|SetaPDF_Core_Type_Dictionary SetaPDF_Core_DataStructure_Tree::_findLastLeafNode ( SetaPDF_Core_Type_Dictionary $node, array &$intermediateNodes )

Finds the last leaf node.

Parameters
$node : SetaPDF_Core_Type_Dictionary
 
$intermediateNodes : array
 

_findLeaveNodeByKey()

protected bool|SetaPDF_Core_Type_Dictionary SetaPDF_Core_DataStructure_Tree::_findLeaveNodeByKey ( SetaPDF_Core_Type_Dictionary $node, int $key [, bool $exactMatch = true [, array &$intermediateNodes = array ( ) ]] )

Find a appropriate leaf node by a key.

If $lowest is set to false the method will search for a leaf node where the key fits between its limit values. If $lowest is set to true the method will return the first leaf node it finds which left limit is bigger than the key.

Parameters
$node : SetaPDF_Core_Type_Dictionary
 
$key : int
 
$exactMatch : bool
 
$intermediateNodes : array
 

_get()

protected array|false SetaPDF_Core_DataStructure_Tree::_get ( SetaPDF_Core_Type_Dictionary $node, string $key )

Gets a key value pair by a root node and a key.

Parameters
$node : SetaPDF_Core_Type_Dictionary
 
$key : string
 

_getEntriesKeyName()

protected string SetaPDF_Core_DataStructure_NumberTree::_getEntriesKeyName ( void )

Get the entries key name for this implementation.

See

_getKeyClassName()

protected string SetaPDF_Core_DataStructure_NumberTree::_getKeyClassName ( void )

Get the key class name used by this tree implementation.

See

_getKeyInstanceName()

protected string SetaPDF_Core_DataStructure_Tree::_getKeyInstanceName ( void )

Get the key instance name by tree implementation.

_getSortType()

protected integer SetaPDF_Core_DataStructure_NumberTree::_getSortType ( void )

Get the sort type for this tree implementation.

See

add()

public void SetaPDF_Core_DataStructure_Tree::add ( int|string $key, SetaPDF_Core_Type_AbstractType $value )

Add a keyed value to the tree.

For name trees: Make sure you pass the name in PDFDocEncoding or UTF-16BE including BOM.

Parameters
$key : int|string

Depends on the implementation

$value : SetaPDF_Core_Type_AbstractType
 
Exceptions

Throws SetaPDF_Core_DataStructure_Tree_KeyAlreadyExistsException

See

cleanUp()

public void SetaPDF_Core_DataStructure_Tree::cleanUp ( void )

Release objects to free memory and cycled references

After calling this method the instance of this object is unusable!

get()

public SetaPDF_Core_Type_AbstractType|false SetaPDF_Core_DataStructure_Tree::get ( string $key [, string $className = null ] )

Get an object by a key.

Parameters
$key : string
 
$className : string
 

getAll()

public array SetaPDF_Core_DataStructure_Tree::getAll ( [ bool $keysOnly = false [, null|string $className = null ]] )

Get all keyed objects.

Parameters
$keysOnly : bool
 
$className : null|string
 

getValue()

public SetaPDF_Core_Type_Dictionary SetaPDF_Core_DataStructure_Tree::getValue ( void )

Get the root dictionary entry

See

merge()

public array SetaPDF_Core_DataStructure_Tree::merge ( SetaPDF_Core_DataStructure_Tree $tree [, null|callback $alreadyExistsCallback = null ] )

Merges another tree into this tree.

As all items have to be unique this method will call a callback function given in $alreadyExistsCallback if an item already exists.

Parameters
$tree : SetaPDF_Core_DataStructure_Tree
 
$alreadyExistsCallback : null|callback

Will be called if a item already exists.
This method can take control over the renaming of the item. The method will be called as long as it will not throw an exception of SetaPDF_Core_DataStructure_Tree_KeyAlreadyExistsException.
The parameter of the callback function are: The key value and an incremental number of renaming attempts.

Return Values

An array of renamed items

Exceptions

Throws SetaPDF_Core_DataStructure_Tree_KeyAlreadyExistsException

remove()

public boolean SetaPDF_Core_DataStructure_Tree::remove ( string $key )

Remove a key from the tree

Parameters
$key : string
 

toPhp()

public array SetaPDF_Core_DataStructure_Tree::toPhp ( void )

Returns an array with named keys and name values

See