@@ 218-226 (lines=9) @@ | ||
215 | * @param EnumSet $other |
|
216 | * @return bool |
|
217 | */ |
|
218 | public function isSubset(EnumSet $other) |
|
219 | { |
|
220 | if ($this->getEnumeration() !== $other->getEnumeration()) { |
|
221 | return false; |
|
222 | } |
|
223 | ||
224 | $thisBitset = $this->getBinaryBitsetLe(); |
|
225 | return ($thisBitset & $other->getBinaryBitsetLe()) === $thisBitset; |
|
226 | } |
|
227 | ||
228 | /** |
|
229 | * Check if this EnumSet is a superset of other |
|
@@ 233-241 (lines=9) @@ | ||
230 | * @param EnumSet $other |
|
231 | * @return bool |
|
232 | */ |
|
233 | public function isSuperset(EnumSet $other) |
|
234 | { |
|
235 | if ($this->getEnumeration() !== $other->getEnumeration()) { |
|
236 | return false; |
|
237 | } |
|
238 | ||
239 | $thisBitset = $this->getBinaryBitsetLe(); |
|
240 | return ($thisBitset | $other->getBinaryBitsetLe()) === $thisBitset; |
|
241 | } |
|
242 | ||
243 | /** |
|
244 | * Produce a new set with enumerators from both this and other (this | other) |