Dodo
DOm DOcument implementation
Loading...
Searching...
No Matches
Wikimedia\Dodo\Internal\MultiId Class Reference

Public Member Functions

 __construct (Element $node)
 
 add (Element $node)
 Add an Element to array in O(1) time by using Node::$_documentIndex as the array index.
 
 del (Element $node)
 Remove an Element from the array in O(1) time by using Node::$_documentIndex to perform the lookup.
 
Element getFirst ()
 Retrieve that Element from the array which appears first in document order in the associated document.
 
Element MultiId downgrade ()
 If there is only one node left, return it.
 

Public Attributes

Element[] $table = array( )
 
int $length = 0
 
Element $first = null
 The first element, in document order.
 

Constructor & Destructor Documentation

◆ __construct()

Wikimedia\Dodo\Internal\MultiId::__construct ( Element $node)
Parameters
Element$node

Member Function Documentation

◆ add()

Wikimedia\Dodo\Internal\MultiId::add ( Element $node)

Add an Element to array in O(1) time by using Node::$_documentIndex as the array index.

Parameters
Element$node

◆ del()

Wikimedia\Dodo\Internal\MultiId::del ( Element $node)

Remove an Element from the array in O(1) time by using Node::$_documentIndex to perform the lookup.

Parameters
Element$node

◆ downgrade()

Element MultiId Wikimedia\Dodo\Internal\MultiId::downgrade ( )

If there is only one node left, return it.

Otherwise return "this".

Returns
Element|MultiId

◆ getFirst()

Element Wikimedia\Dodo\Internal\MultiId::getFirst ( )

Retrieve that Element from the array which appears first in document order in the associated document.

Cache the value for repeated lookups.

The cache is invalidated each time the array is modified. The list is modified when a Node is inserted or removed from a Document, or when the 'id' attribute value of a Node is changed.

Returns
?Element null if there are no nodes

Member Data Documentation

◆ $first

Element Wikimedia\Dodo\Internal\MultiId::$first = null

The first element, in document order.

null indicates the cache is not set and the first element must be re-computed.

◆ $length

int Wikimedia\Dodo\Internal\MultiId::$length = 0

◆ $table

Element [] Wikimedia\Dodo\Internal\MultiId::$table = array( )

The documentation for this class was generated from the following file: