예제 #1
0
 /**
  * This method evaluates whether the left operand is identical to the right operand.
  *
  * @access public
  * @static
  * @param IArrayList\Type $xs                               the left operand
  * @param Core\Type $ys                                     the right operand
  * @return IBool\Type                                       whether the left operand is identical
  *                                                          to the right operand
  */
 public static function id(IArrayList\Type $xs, Core\Type $ys) : IBool\Type
 {
     // ===
     if ($ys !== null) {
         if ($xs->__typeOf() === $ys->__typeOf()) {
             $x_length = $xs->__length();
             $y_length = $ys->__length();
             for ($i = 0; $i < $x_length && $i < $y_length; $i++) {
                 $p = IInt32\Type::box($i);
                 $r = $xs->item($p)->id($ys->item($p));
                 if (!$r->unbox()) {
                     return $r;
                 }
             }
             return IBool\Type::box($x_length == $y_length);
         }
     }
     return IBool\Type::false();
 }
예제 #2
0
 /**
  * This method evaluates whether the left operand is identical to the right operand.
  *
  * @access public
  * @static
  * @param ILinkedList\Type $xs                              the left operand
  * @param Core\Type $ys                                     the right operand
  * @return IBool\Type                                       whether the left operand is identical
  *                                                          to the right operand
  */
 public static function id(ILinkedList\Type $xs, Core\Type $ys) : IBool\Type
 {
     // ===
     if ($ys !== null && $xs->__typeOf() == $ys->typeOf()) {
         for ($as = $xs, $bs = $ys; !$as->__isEmpty() && !$bs->__isEmpty(); $as = $as->tail(), $bs = $bs->tail()) {
             $r = $as->head()->id($bs->head());
             if (!$r->unbox()) {
                 return $r;
             }
         }
         $x_length = $xs->__length();
         $y_length = $ys->__length();
         if ($x_length == $y_length) {
             return IBool\Type::true();
         }
     }
     return IBool\Type::false();
 }