<commit_before><?php

namespace Ardent;

use Ardent\Exception\EmptyException,
    Ardent\Exception\TypeException,
    Ardent\Iterator\SortedSetIterator;
use Ardent\Exception\StateException;

class SortedSet extends AbstractSet implements Set {

    use StructureCollection;

    /**
     * @var BinarySearchTree
     */
    private $bst;

    /**
     * @var callable
     */
    private $comparator;

    /**
     * @param callable $comparator
     * @param BinarySearchTree $tree
     * @throws \Ardent\Exception\StateException
     */
    function __construct(callable $comparator = NULL, BinarySearchTree $tree = NULL) {
        if ($tree !== NULL) {
            if (!$tree->isEmpty()) {
                throw new StateException(
                    'The BinarySearchTree provided to SortedSet was not empty'
                );
            }
            $this->bst = $tree;
            if ($comparator !== NULL) {
                $tree->setCompare($comparator);
            }
        } else {
            $this->bst = new SplayTree($comparator);
        }
    }

    /**
     * @return void
     */
    function clear() {<commit_msg>SortedSet will once again use AvlTree if you don't provide an implementation.<commit_after><?php

namespace Ardent;

use Ardent\Exception\EmptyException,
    Ardent\Exception\TypeException,
    Ardent\Iterator\SortedSetIterator;
use Ardent\Exception\StateException;

class SortedSet extends AbstractSet implements Set {

    use StructureCollection;

    /**
     * @var BinarySearchTree
     */
    private $bst;

    /**
     * @var callable
     */
    private $comparator;

    /**
     * @param callable $comparator
     * @param BinarySearchTree $tree
     * @throws \Ardent\Exception\StateException
     */
    function __construct(callable $comparator = NULL, BinarySearchTree $tree = NULL) {
        if ($tree !== NULL) {
            if (!$tree->isEmpty()) {
                throw new StateException(
                    'The BinarySearchTree provided to SortedSet was not empty'
                );
            }
            $this->bst = $tree;
            if ($comparator !== NULL) {
                $tree->setCompare($comparator);
            }
        } else {
            $this->bst = new AvlTree($comparator);
        }
    }

    /**
     * @return void
     */
    function clear() {
{'fraction_non_alphanumeric': 0.1095890410958904, 'fraction_numerical': 0.0, 'mean_word_length': 1.9103362391033625, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5491177', 'n_tokens_mistral': 664, 'n_tokens_neox': 638, 'n_words': 151}