Exemplo n.º 1
0
 public function testConstructAndCountAndGetAndSet()
 {
     $interval = new Interval([4, 18, 25, 42]);
     $this->assertTrue($interval->size() == 4);
     $this->assertTrue($interval->get(0) == 4);
     $this->assertTrue($interval->get(3) == 42);
     $interval->set(2, 40);
     $this->assertTrue($interval->get(2) == 40);
 }
Exemplo n.º 2
0
 public function getResults(Interval $intv, ListScheme $schemes)
 {
     $freq = 0;
     $max = $this->tNbr + $this->distance;
     $bIntv = false;
     for ($i = $this->distance; $i < $max; $i++) {
         $j = 0;
         while ($j < $intv->size()) {
             $intvNumber = $intv->get($j);
             if (!$schemes->get($i)->hasNumber(new Number($intvNumber, false))) {
                 $bIntv = false;
                 break;
             }
             $bIntv = true;
             $j++;
         }
         if ($bIntv) {
             $freq++;
         }
     }
     return $freq;
 }