Lines Matching defs:set
15 * of a sequential range of numbers that are all part of the set. For example,
16 * the set { 1, 2, 3, 4, 7, 8 } may be represented as { [1, 4], [7, 8] }.
31 * Create a set with a single element, el.
35 $set = new self();
37 $set->addOne($number);
39 return $set;
43 * Create a set with all ints within range [start..end] (inclusive).
47 $set = new self();
49 $set->addRange($start, $end);
51 return $set;
54 public function complement(IntervalSet $set) : ?self
56 if ($set->isNull()) {
60 return $set->subtract($this);
63 public function subtract(IntervalSet $set) : self
65 if ($set->isNull()) {
69 return self::subtractSets($this, $set);
83 * Compute the set difference between two interval sets. The specific
85 * it is treated as though it was an empty set.
94 // right set has no elements; just return the copy of the current set
161 // If resultI reached result.intervals.size(), we would be subtracting from an empty set.
233 $i--; // move backwards to what we just set
235 $this->intervals[$i] = $bigger->union($next); // set to 3 merged ones
353 * Returns the maximum value contained in the set if not isNull().
355 * @return int The maximum value contained in the set.
357 * @throws \RuntimeException If set is empty.
362 throw new \RuntimeException('The set is empty.');
369 * Returns the minimum value contained in the set if not isNull().
371 * @return int The minimum value contained in the set.
373 * @throws \RuntimeException If set is empty.
378 throw new \RuntimeException('The set is empty.');