| [ Index ] |
PHP Cross Reference of Unnamed Project |
[Source view] [Print] [Project Stats]
(no description)
| File Size: | 157 lines (5 kb) |
| Included or required: | 1 time |
| Referenced: | 0 times |
| Includes or requires: | 0 files |
HTMLPurifier_Zipper:: (11 methods):
__construct()
fromArray()
toArray()
next()
advance()
prev()
delete()
done()
insertBefore()
insertAfter()
splice()
Class: HTMLPurifier_Zipper - X-Ref
A zipper is a purely-functional data structure which contains| __construct($front, $back) X-Ref |
| No description |
| fromArray($array) X-Ref |
| Creates a zipper from an array, with a hole in the 0-index position. param: Array to zipper-ify. return: Tuple of zipper and element of first position. |
| toArray($t = NULL) X-Ref |
| Convert zipper back into a normal array, optionally filling in the hole with a value. (Usually you should supply a $t, unless you are at the end of the array.) |
| next($t) X-Ref |
| Move hole to the next element. param: $t Element to fill hole with return: Original contents of new hole. |
| advance($t, $n) X-Ref |
| Iterated hole advancement. param: $t Element to fill hole with param: $i How many forward to advance hole return: Original contents of new hole, i away |
| prev($t) X-Ref |
| Move hole to the previous element param: $t Element to fill hole with return: Original contents of new hole. |
| delete() X-Ref |
| Delete contents of current hole, shifting hole to next element. return: Original contents of new hole. |
| done() X-Ref |
| Returns true if we are at the end of the list. return: bool |
| insertBefore($t) X-Ref |
| Insert element before hole. param: Element to insert |
| insertAfter($t) X-Ref |
| Insert element after hole. param: Element to insert |
| splice($t, $delete, $replacement) X-Ref |
| Splice in multiple elements at hole. Functional specification in terms of array_splice: $arr1 = $arr; $old1 = array_splice($arr1, $i, $delete, $replacement); list($z, $t) = HTMLPurifier_Zipper::fromArray($arr); $t = $z->advance($t, $i); list($old2, $t) = $z->splice($t, $delete, $replacement); $arr2 = $z->toArray($t); assert($old1 === $old2); assert($arr1 === $arr2); NB: the absolute index location after this operation is *unchanged!* param: Current contents of hole. |
| Generated: Tue Mar 17 22:47:18 2015 | Cross-referenced by PHPXref 0.7.1 |