xref: /dokuwiki/inc/Search/Query/NegatedEntry.php (revision 0b1bbbbb7d4e3c531cd255dbf878ce27d5967a0c)
1*0b1bbbbbSAndreas Gohr<?php
2*0b1bbbbbSAndreas Gohr
3*0b1bbbbbSAndreas Gohrnamespace dokuwiki\Search\Query;
4*0b1bbbbbSAndreas Gohr
5*0b1bbbbbSAndreas Gohr/**
6*0b1bbbbbSAndreas Gohr * Wraps a StackEntry to indicate logical NOT
7*0b1bbbbbSAndreas Gohr *
8*0b1bbbbbSAndreas Gohr * NOT does not compute a complement immediately. Instead, binary operators
9*0b1bbbbbSAndreas Gohr * (AND, OR) detect NegatedEntry operands and choose the appropriate operation:
10*0b1bbbbbSAndreas Gohr * AND with a NegatedEntry becomes set subtraction, avoiding the need to
11*0b1bbbbbSAndreas Gohr * materialize the full page universe.
12*0b1bbbbbSAndreas Gohr */
13*0b1bbbbbSAndreas Gohrclass NegatedEntry implements StackEntry
14*0b1bbbbbSAndreas Gohr{
15*0b1bbbbbSAndreas Gohr    protected StackEntry $inner;
16*0b1bbbbbSAndreas Gohr
17*0b1bbbbbSAndreas Gohr    public function __construct(StackEntry $inner)
18*0b1bbbbbSAndreas Gohr    {
19*0b1bbbbbSAndreas Gohr        $this->inner = $inner;
20*0b1bbbbbSAndreas Gohr    }
21*0b1bbbbbSAndreas Gohr
22*0b1bbbbbSAndreas Gohr    /**
23*0b1bbbbbSAndreas Gohr     * @return StackEntry the wrapped entry (PageSet or NamespacePredicate)
24*0b1bbbbbSAndreas Gohr     */
25*0b1bbbbbSAndreas Gohr    public function getInner(): StackEntry
26*0b1bbbbbSAndreas Gohr    {
27*0b1bbbbbSAndreas Gohr        return $this->inner;
28*0b1bbbbbSAndreas Gohr    }
29*0b1bbbbbSAndreas Gohr}
30