public function needSourceIndex()
 {
     if ($this->indexes !== null) {
         return;
     }
     $state = new coopy_TableComparisonState();
     $state->a = $this->source;
     $state->b = $this->source;
     $comp = new coopy_CompareTable($state);
     $comp->storeIndexes();
     $comp->run();
     $comp->align();
     $this->indexes = $comp->getIndexes();
     $this->needSourceColumns();
 }
Beispiel #2
0
 public function checkNesting($v, $have_ll, $ll, $have_rr, $rr, $have_pp, $pp, $x, $y)
 {
     $all_tables = true;
     if ($have_ll) {
         $all_tables = $all_tables && $v->isTable($ll);
     }
     if ($have_rr) {
         $all_tables = $all_tables && $v->isTable($rr);
     }
     if ($have_pp) {
         $all_tables = $all_tables && $v->isTable($pp);
     }
     if (!$all_tables) {
         return new _hx_array(array($ll, $rr, $pp));
     }
     $ll_table = null;
     $rr_table = null;
     $pp_table = null;
     if ($have_ll) {
         $ll_table = $v->getTable($ll);
     }
     if ($have_rr) {
         $rr_table = $v->getTable($rr);
     }
     if ($have_pp) {
         $pp_table = $v->getTable($pp);
     }
     $compare = false;
     $comp = new coopy_TableComparisonState();
     $comp->a = $ll_table;
     $comp->b = $rr_table;
     $comp->p = $pp_table;
     $comp->compare_flags = $this->flags;
     $comp->getMeta();
     $key = null;
     if ($comp->a_meta !== null) {
         $key = $comp->a_meta->getName();
     }
     if ($key === null && $comp->b_meta !== null) {
         $key = $comp->b_meta->getName();
     }
     if ($key === null) {
         $key = _hx_string_rec($x, "") . "_" . _hx_string_rec($y, "");
     }
     if ($this->align->comp !== null) {
         if ($this->align->comp->children === null) {
             $this->align->comp->children = new haxe_ds_StringMap();
             $this->align->comp->child_order = new _hx_array(array());
             $compare = true;
         } else {
             $compare = !$this->align->comp->children->exists($key);
         }
     }
     if ($compare) {
         $this->nesting_present = true;
         $this->align->comp->children->set($key, $comp);
         $this->align->comp->child_order->push($key);
         $ct = new coopy_CompareTable($comp);
         $ct->align();
     } else {
         $comp = $this->align->comp->children->get($key);
     }
     $ll_out = null;
     $rr_out = null;
     $pp_out = null;
     if ($comp->alignment->isMarkedAsIdentical() || $have_ll && !$have_rr || $have_rr && !$have_ll) {
         $ll_out = "[" . _hx_string_or_null($key) . "]";
         $rr_out = $ll_out;
         $pp_out = $ll_out;
     } else {
         if ($ll !== null) {
             $ll_out = "[a." . _hx_string_or_null($key) . "]";
         }
         if ($rr !== null) {
             $rr_out = "[b." . _hx_string_or_null($key) . "]";
         }
         if ($pp !== null) {
             $pp_out = "[p." . _hx_string_or_null($key) . "]";
         }
     }
     return new _hx_array(array($ll_out, $rr_out, $pp_out));
 }
Beispiel #3
0
 static function align($local, $remote, $flags, $comp)
 {
     $comp->a = coopy_Coopy::tablify($local);
     $comp->b = coopy_Coopy::tablify($remote);
     if ($flags === null) {
         $flags = new coopy_CompareFlags();
     }
     $comp->compare_flags = $flags;
     $ct = new coopy_CompareTable($comp);
     $align = $ct->align();
     $td = new coopy_TableDiff($align, $flags);
     return $td;
 }
 static function diff($local, $remote, $flags = null)
 {
     $comp = new coopy_TableComparisonState();
     $comp->a = $local;
     $comp->b = $remote;
     if ($flags === null) {
         $flags = new coopy_CompareFlags();
     }
     $comp->compare_flags = $flags;
     $ct = new coopy_CompareTable($comp);
     $align = $ct->align();
     $td = new coopy_TableDiff($align, $flags);
     $o = new coopy_SimpleTable(0, 0);
     $td->hilite($o);
     return $o;
 }