public function hasTagged(int $tag): bool
    {
        // lazily build lookup map
        if (!isset($this->_taggedMap)) {
            $this->_taggedMap = [];
            foreach ($this->_elements as $element) {
                if ($element->isTagged()) {
                    $this->_taggedMap[$element->tag()] = $element;
                }
            }
        }
        return isset($this->_taggedMap[$tag]);
    }