PHP Class HTMLPurifier_Queue, yii

We don't use the SPL implementation because it's only supported on PHP 5.3 and later. Exercise: Prove that push/pop on this queue take amortized O(1) time. Exercise: Extend this queue to be a deque, while preserving amortized O(1) time. Some care must be taken on rebalancing to avoid quadratic behaviour caused by repeatedly shuffling data from the input stack to the output stack and back.
Afficher le fichier Open project: yiisoft/yii

Méthodes publiques

Méthode Description
__construct ( $input = [] )
isEmpty ( ) Checks if it's empty.
push ( $x ) Pushes an element onto the front of the queue.
shift ( ) Shifts an element off the front of the queue.

Method Details

__construct() public méthode

public __construct ( $input = [] )

isEmpty() public méthode

Checks if it's empty.
public isEmpty ( )

push() public méthode

Pushes an element onto the front of the queue.
public push ( $x )

shift() public méthode

Shifts an element off the front of the queue.
public shift ( )