@@ 218-227 (lines=10) @@ | ||
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 | $otherBitset = $other->getBinaryBitsetLe(); |
|
226 | return ($thisBitset & $otherBitset) === $thisBitset; |
|
227 | } |
|
228 | ||
229 | /** |
|
230 | * Check if this EnumSet is a superset of other |
|
@@ 234-243 (lines=10) @@ | ||
231 | * @param EnumSet $other |
|
232 | * @return bool |
|
233 | */ |
|
234 | public function isSuperset(EnumSet $other) |
|
235 | { |
|
236 | if ($this->getEnumeration() !== $other->getEnumeration()) { |
|
237 | return false; |
|
238 | } |
|
239 | ||
240 | $thisBitset = $this->getBinaryBitsetLe(); |
|
241 | $otherBitset = $other->getBinaryBitsetLe(); |
|
242 | return ($otherBitset | $thisBitset) === $thisBitset; |
|
243 | } |
|
244 | ||
245 | /** |
|
246 | * Get binary bitset in little-endian order |