MathPHP\SetTheory\Set::isProperSuperset PHP 메소드

isProperSuperset() 공개 메소드

Superset (A ⊇ B & A ≠ B) Is the set a superset of the other set? In other words, does the the set contain all the elements of the other set, and the set is not the same set as the other set?
public isProperSuperset ( Set $B ) : boolean
$B Set
리턴 boolean
    public function isProperSuperset(Set $B) : bool
    {
        $B_array = $B->asArray();
        $A∩B = array_intersect_key($this->A, $B_array);
        $A∖B = array_diff_key($B_array, $this->A);
        return count($A∩B) === $B->length() && empty($A∖B) && $this != $B;
    }

Usage Example

예제 #1
0
 /**
  * @dataProvider dataProviderForIsProperSet
  */
 public function testIsProperSuperset(array $A, array $B)
 {
     $setA = new Set($B);
     $setB = new Set($A);
     $this->assertFalse($setA->isProperSuperset($setB));
 }