static function moveWithoutExtras($src, $dest) { if ($src->length !== $dest->length) { return null; } if ($src->length <= 1) { return new _hx_array(array()); } $len = $src->length; $in_src = new haxe_ds_IntMap(); $blk_len = new haxe_ds_IntMap(); $blk_src_loc = new haxe_ds_IntMap(); $blk_dest_loc = new haxe_ds_IntMap(); $_g = 0; while ($_g < $len) { $i = $_g++; $in_src->set($src[$i], $i); $i; unset($i); } $ct = 0; $in_cursor = -2; $out_cursor = 0; $next = null; $blk = -1; $v = null; while ($out_cursor < $len) { $v = $dest[$out_cursor]; $next = $in_src->get($v); if ($next !== $in_cursor + 1) { $blk = $v; $ct = 1; $blk_src_loc->set($blk, $next); $blk_dest_loc->set($blk, $out_cursor); } else { $ct++; } $blk_len->set($blk, $ct); $in_cursor = $next; $out_cursor++; } $blks = new _hx_array(array()); if (null == $blk_len) { throw new HException('null iterable'); } $__hx__it = $blk_len->keys(); while ($__hx__it->hasNext()) { unset($k); $k = $__hx__it->next(); $blks->push($k); } $blks->sort(array(new _hx_lambda(array(&$blk, &$blk_dest_loc, &$blk_len, &$blk_src_loc, &$blks, &$ct, &$dest, &$in_cursor, &$in_src, &$len, &$next, &$out_cursor, &$src, &$v), "coopy_Mover_0"), 'execute')); $moved = new _hx_array(array()); while ($blks->length > 0) { $blk1 = $blks->shift(); $blen = $blks->length; $ref_src_loc = $blk_src_loc->get($blk1); $ref_dest_loc = $blk_dest_loc->get($blk1); $i1 = $blen - 1; while ($i1 >= 0) { $blki = $blks[$i1]; $blki_src_loc = $blk_src_loc->get($blki); $to_left_src = $blki_src_loc < $ref_src_loc; $to_left_dest = $blk_dest_loc->get($blki) < $ref_dest_loc; if ($to_left_src !== $to_left_dest) { $ct1 = $blk_len->get($blki); $_g1 = 0; while ($_g1 < $ct1) { $j = $_g1++; $moved->push($src[$blki_src_loc]); $blki_src_loc++; unset($j); } unset($_g1); $blks->splice($i1, 1); unset($ct1); } $i1--; unset($to_left_src, $to_left_dest, $blki_src_loc, $blki); } unset($ref_src_loc, $ref_dest_loc, $i1, $blk1, $blen); } return $moved; }