Exemple #1
0
 /**
  * This method compares the operands for order.
  *
  * @access public
  * @static
  * @param ITuple\Type $xs                                   the left operand
  * @param ITuple\Type $ys                                   the right operand
  * @return ITrit\Type                                       the order as to whether the left
  *                                                          operand is less than, equals to,
  *                                                          or greater than the right operand
  */
 public static function compare(ITuple\Type $xs, ITuple\Type $ys) : ITrit\Type
 {
     $xsl = $xs->length();
     $ysl = $ys->length();
     $length = IInt32\Module::min($xsl, $ysl);
     for ($i = IInt32\Type::zero(); IInt32\Module::lt($i, $length)->unbox(); $i = IInt32\Module::increment($i)) {
         $r = $xs->item($i)->compare($ys->item($i));
         if ($r->unbox() != 0) {
             return $r;
         }
     }
     return ITrit\Type::box($xsl->unbox() <=> $ysl->unbox());
 }