Пример #1
0
 public function le($other)
 {
     return le($this, $other);
 }
Пример #2
0
 /**
  * Dequeues and returns the "smallest" object in this deap.
  * The smallest object in this deap is the object
  * which is less than or equal to all other objects in this deap.
  *
  * @return object IComparable The "smallest" object in this deap.
  */
 public function dequeueMin()
 {
     if ($this->count == 0) {
         throw new ContainerEmptyException();
     }
     $result = $this->array[2];
     $last = $this->array[$this->count + 1];
     --$this->count;
     if ($this->count <= 1) {
         $this->array[2] = $last;
     } else {
         $i = 2;
         while (2 * $i < $this->count + 2) {
             $child = 2 * $i;
             if ($child + 1 < $this->count + 2 && lt($this->array[$child + 1], $this->array[$child])) {
                 $child += 1;
             }
             $this->array[$i] = $this->array[$child];
             $i = $child;
         }
         $j = $this->dual($i);
         if (le($last, $this->array[$j])) {
             $this->insertMin($i, $last);
         } else {
             $this->array[$i] = $this->array[$j];
             $this->insertMax($j, $last);
         }
     }
     return $result;
 }
Пример #3
0
 $lat2 = $idd->response->items[$s]->fromlatitude;
 $long2 = $idd->response->items[$s]->fromlongitude;
 ///если гео данные пусты пропустить обработку клиента
 if ($long22 == "" && $long2 == "") {
     continue;
 } else {
     if ($long22 == "") {
         ////найти растояние
         $dist0 = le($lat1, $long1, $lat2, $long2);
     }
     if ($long2 == "") {
         ///найти растояние
         $dist0 = le($lat1, $long1, $lat22, $long22);
     } else {
         ///найти растояние
         $dist0 = le($lat1, $long1, $lat2, $long2);
     }
 }
 ///если фильтр растояния удовлетворяет...
 if ($dist1 >= $dist0) {
     $from = $idd->response->items[$s]->from;
     $to = $idd->response->items[$s]->to;
     $price = $idd->response->items[$s]->price;
     $phone = $idd->response->items[$s]->client->phone;
     $idd1 = $idd->response->items[$s]->id;
     $req = "INSERT INTO `current_taxa_android` (`from`, `to`, `price`, `phone`, `dist`, `id_tax`, `taxist_id`) VALUES ('{$from}', '{$to}', '{$price}', '{$phone}', '{$dist0}', '{$idd1}', '" . $ss1 . "');";
     echo $phone . "@android-out";
     //echo 104;
     db_req_without_resp($req);
     //////изменить статус на кандидат найден
     $sql = "UPDATE `indriver`.`taxist` SET `work`='5' WHERE `taxist_id`='" . $ss1 . "';";
Пример #4
0
        //        $sprites []= new Jm_Console_Sprite(' ' . round(mt_rand(0, 1)) . ' ');
    }
    // add the sprites to the stage
    $stage = Jm_Console_Stage::instance();
    foreach ($sprites as $sprite) {
        $stage->append($sprite);
    }
    // register the onEnterFrame listener
    $stage->addListener(Jm_Console_StageEvent::ENTER_FRAME, 'stage_onEnterFrame');
    // initialize the animation clock
    $t = 0;
    // start animation
    $stage->setFps(25);
    $stage->play();
} catch (Exception $e) {
    le($e);
}
/**
 *
 *
 */
function stage_onEnterFrame(Jm_Console_StageEvent $event)
{
    global $sprites;
    global $t;
    $stage = Jm_Console_Stage::instance();
    $w = $stage->getWidth();
    $h = $stage->getHeight();
    foreach ($sprites as $index => $sprite) {
        $posx = intval(ceil($w / 2)) + $index * 3;
        $posy = intval(ceil($h / 2 * (sin(($t / 100 + 3 * $index) * 3.14 / 180) * 0.35 + 1)));
Пример #5
0
<?php

$lat1 = 62.044395;
$long1 = 129.738739;
$lat2 = 62.017593;
$long2 = 129.688232;
echo le($lat1, $long1, $lat2, $long2);
function le($lat1, $long1, $lat2, $long2)
{
    $R = 6372795;
    $lat1 *= pi() / 180;
    $lat2 *= pi() / 180;
    $long1 *= pi() / 180;
    $long2 *= pi() / 180;
    $cl1 = cos($lat1);
    $cl2 = cos($lat2);
    $sl1 = sin($lat1);
    $sl2 = sin($lat2);
    $delta = $long2 - $long1;
    $cdelta = cos($delta);
    $sdelta = sin($delta);
    $y = sqrt(pow($cl2 * $sdelta, 2) + pow($cl1 * $sl2 - $sl1 * $cl2 * $cdelta, 2));
    $x = $sl1 * $sl2 + $cl1 * $cl2 * $cdelta;
    $ad = atan2($y, $x);
    $dist = $ad * $R;
    return intval($dist);
}
Пример #6
0
 /**
  * Returns a multiset which is the union of this multiset
  * and the specified multiset.
  * It is assumed that the specified multiset is an instance of
  * the MultisetAsLinkedList class.
  *
  * @param IMultiset $multiset The multiset to join with this multiset.
  * @return object IMultiset
  * The union of this multiset with the specified multiset.
  */
 public function union(IMultiset $set)
 {
     if ($this->getClass() != $set->getClass()) {
         throw new TypeError();
     }
     if ($this->universeSize != $set->universeSize) {
         throw new ArgumentError();
     }
     $result = new MultisetAsLinkedList($this->universeSize);
     $p = $this->list->getHead();
     $q = $set->list->getHead();
     while ($p !== NULL && q !== NULL) {
         if (le($p->getDatum(), $q->getDatum())) {
             $result->list->append($p->getDatum());
             $p = $p->getNext();
         } else {
             $result->list->append($q->getDatum());
             $q = $q->getNext();
         }
     }
     for (; $p !== NULL; $p = $p->getNext()) {
         $result->list->append($p->getDatum());
     }
     for (; $q != NULL; $q = $q->getNext()) {
         $result->list->append($q->getDatum());
     }
     return $result;
 }
Пример #7
0
 function exc($message, $quiet = false)
 {
     $e = new \Exception($message);
     le($e->getMessage());
     ld($e->getTraceAsString());
     if (!$quiet) {
         throw $e;
     }
 }
Пример #8
0
 /**
  * Dequeues and returns the "smallest" object in this heap.
  * The smallest element is the object in this heap
  * that is less than or equal to all other objects in this heap.
  *
  * @return object IObject The "smallest" object in this heap.
  */
 public function dequeueMin()
 {
     if ($this->count == 0) {
         throw new ContainerEmptyException();
     }
     $result = $this->array[1];
     $last = $this->array[$this->count];
     --$this->count;
     $i = 1;
     while (2 * $i < $this->count + 1) {
         $child = 2 * $i;
         if ($child + 1 < $this->count + 1 && lt($this->array[$child + 1], $this->array[$child])) {
             $child += 1;
         }
         if (le($last, $this->array[$child])) {
             break;
         }
         $this->array[$i] = $this->array[$child];
         $i = $child;
     }
     $this->array[$i] = $last;
     return $result;
 }
Пример #9
0
 public function le($column, $value)
 {
     $this->model->setCondition(le($column, $value));
     return $this;
 }