private function addSet($set)
    {
        if (is_array($set)) {
            $set = new \ArrayIterator($set);
        } elseif ($set instanceof \Traversable) {
            $set = new \IteratorIterator($set);
        } else {
            throw new \InvalidArgumentException('Set must be either an array or Traversable');
        }

        $this->sets[] = $set;
    }