Guitar
Diff.hpp
Go to the documentation of this file.
1 
36 /* If you use this library, you must include dtl.hpp only. */
37 
38 #ifndef DTL_DIFF_H
39 #define DTL_DIFF_H
40 
41 namespace dtl {
42 
47  template <typename elem, typename sequence = vector< elem >, typename comparator = Compare< elem > >
48  class Diff
49  {
50  private :
51  dtl_typedefs(elem, sequence)
52  sequence A;
53  sequence B;
54  size_t M;
55  size_t N;
56  size_t delta;
57  size_t offset;
58  long long *fp;
59  long long editDistance;
64  bool swapped;
65  bool huge;
66  bool trivial;
68  uniHunkVec uniHunks;
69  comparator cmp;
70  long long ox;
71  long long oy;
72  public :
73  Diff () {}
74 
75  Diff (const sequence& a,
76  const sequence& b) : A(a), B(b), ses(false) {
77  init();
78  }
79 
80  Diff (const sequence& a,
81  const sequence& b,
82  bool deletesFirst) : A(a), B(b), ses(deletesFirst) {
83  init();
84  }
85 
86  Diff (const sequence& a,
87  const sequence& b,
88  const comparator& comp) : A(a), B(b), ses(false), cmp(comp) {
89  init();
90  }
91 
92  Diff (const sequence& a,
93  const sequence& b,
94  bool deleteFirst,
95  const comparator& comp) : A(a), B(b), ses(deleteFirst), cmp(comp) {
96  init();
97  }
98 
99  ~Diff() {}
100 
101  long long getEditDistance () const {
102  return editDistance;
103  }
104 
105  Lcs< elem > getLcs () const {
106  return lcs;
107  }
108 
109  elemVec getLcsVec () const {
110  return lcs.getSequence();
111  }
112 
113  Ses< elem > getSes () const {
114  return ses;
115  }
116 
117  uniHunkVec getUniHunks () const {
118  return uniHunks;
119  }
120 
121  /* These should be deprecated */
122  bool isHuge () const {
123  return huge;
124  }
125 
126  void onHuge () {
127  this->huge = true;
128  }
129 
130  void offHuge () {
131  this->huge = false;
132  }
133 
134  bool isUnserious () const {
135  return trivial;
136  }
137 
138  void onUnserious () {
139  this->trivial = true;
140  }
141 
142  void offUnserious () {
143  this->trivial = false;
144  }
145 
147  this->editDistanceOnly = true;
148  }
149 
150  /* These are the replacements for the above */
151  bool hugeEnabled () const {
152  return huge;
153  }
154 
155  void enableHuge () {
156  this->huge = true;
157  }
158 
159  void disableHuge () {
160  this->huge = false;
161  }
162 
163  bool trivialEnabled () const {
164  return trivial;
165  }
166 
167  void enableTrivial () const {
168  this->trivial = true;
169  }
170 
171  void disableTrivial () {
172  this->trivial = false;
173  }
174 
176  this->editDistanceOnly = true;
177  }
178 
182  sequence uniPatch (const sequence& seq) {
183  elemList seqLst(seq.begin(), seq.end());
184  sesElemVec shunk;
185  sesElemVec_iter vsesIt;
186  elemList_iter lstIt = seqLst.begin();
187  long long inc_dec_total = 0;
188  long long gap = 1;
189  for (uniHunkVec_iter it=uniHunks.begin();it!=uniHunks.end();++it) {
190  joinSesVec(shunk, it->common[0]);
191  joinSesVec(shunk, it->change);
192  joinSesVec(shunk, it->common[1]);
193  it->a += inc_dec_total;
194  inc_dec_total += it->inc_dec_count;
195  for (long long i=0;i<it->a - gap;++i) {
196  ++lstIt;
197  }
198  gap = it->a + it->b + it->inc_dec_count;
199  vsesIt = shunk.begin();
200  while (vsesIt!=shunk.end()) {
201  switch (vsesIt->second.type) {
202  case SES_ADD :
203  seqLst.insert(lstIt, vsesIt->first);
204  break;
205  case SES_DELETE :
206  if (lstIt != seqLst.end()) {
207  lstIt = seqLst.erase(lstIt);
208  }
209  break;
210  case SES_COMMON :
211  if (lstIt != seqLst.end()) {
212  ++lstIt;
213  }
214  break;
215  default :
216  // no fall-through
217  break;
218  }
219  ++vsesIt;
220  }
221  shunk.clear();
222  }
223 
224  sequence patchedSeq(seqLst.begin(), seqLst.end());
225  return patchedSeq;
226  }
227 
231  sequence patch (const sequence& seq) const {
232  sesElemVec sesSeq = ses.getSequence();
233  elemList seqLst(seq.begin(), seq.end());
234  elemList_iter lstIt = seqLst.begin();
235  for (sesElemVec_iter sesIt=sesSeq.begin();sesIt!=sesSeq.end();++sesIt) {
236  switch (sesIt->second.type) {
237  case SES_ADD :
238  seqLst.insert(lstIt, sesIt->first);
239  break;
240  case SES_DELETE :
241  lstIt = seqLst.erase(lstIt);
242  break;
243  case SES_COMMON :
244  ++lstIt;
245  break;
246  default :
247  // no through
248  break;
249  }
250  }
251  sequence patchedSeq(seqLst.begin(), seqLst.end());
252  return patchedSeq;
253  }
254 
260  void compose() {
261 
262  if (isHuge()) {
264  }
265  ox = 0;
266  oy = 0;
267  long long p = -1;
268  fp = new long long[M + N + 3];
269  fill(&fp[0], &fp[M + N + 3], -1);
270  path = editPath(M + N + 3);
271  fill(path.begin(), path.end(), -1);
272  ONP:
273  do {
274  ++p;
275  for (long long k=-p;k<=static_cast<long long>(delta)-1;++k) {
276  fp[k+offset] = snake(k, fp[k-1+offset]+1, fp[k+1+offset]);
277  }
278  for (long long k=static_cast<long long>(delta)+p;k>=static_cast<long long>(delta)+1;--k) {
279  fp[k+offset] = snake(k, fp[k-1+offset]+1, fp[k+1+offset]);
280  }
281  fp[delta+offset] = snake(static_cast<long long>(delta), fp[delta-1+offset]+1, fp[delta+1+offset]);
282  } while (fp[delta+offset] != static_cast<long long>(N) && pathCordinates.size() < MAX_CORDINATES_SIZE);
283 
284  editDistance += static_cast<long long>(delta) + 2 * p;
285  long long r = path[delta+offset];
286  P cordinate;
287  editPathCordinates epc(0);
288 
289  // recording edit distance only
290  if (editDistanceOnly) {
291  delete[] this->fp;
292  return;
293  }
294 
295  while(r != -1) {
296  cordinate.x = pathCordinates[(size_t)r].x;
297  cordinate.y = pathCordinates[(size_t)r].y;
298  epc.push_back(cordinate);
299  r = pathCordinates[(size_t)r].k;
300  }
301 
302  // record Longest Common Subsequence & Shortest Edit Script
303  if (!recordSequence(epc)) {
304  pathCordinates.resize(0);
305  epc.resize(0);
306  p = -1;
307  goto ONP;
308  }
309  delete[] this->fp;
310  }
311 
315  template < typename stream >
316  void printSES (stream& out) const {
317  sesElemVec ses_v = ses.getSequence();
318  for_each(ses_v.begin(), ses_v.end(), ChangePrinter< sesElem, stream >(out));
319  }
320 
321  void printSES (ostream& out = cout) const {
322  printSES< ostream >(out);
323  }
324 
328  template < typename stream >
329  static void printSES (const Ses< elem >& s, stream& out) {
330  sesElemVec ses_v = s.getSequence();
331  for_each(ses_v.begin(), ses_v.end(), ChangePrinter< sesElem, stream >(out));
332  }
333 
334  static void printSES (const Ses< elem >& s, ostream& out = cout) {
335  printSES< ostream >(s, out);
336  }
337 
341  template < typename stream, template < typename SEET, typename STRT > class PT >
342  void printSES (stream& out) const {
343  sesElemVec ses_v = ses.getSequence ();
344  for_each (ses_v.begin (), ses_v.end(), PT < sesElem, stream > (out));
345  }
346 
350  template < typename storedData, template < typename SEET, typename STRT > class ST >
351  void storeSES(storedData& sd) const {
352  sesElemVec ses_v = ses.getSequence();
353  for_each(ses_v.begin(), ses_v.end(), ST < sesElem, storedData >(sd));
354  }
355 
359  template < typename stream >
360  void printUnifiedFormat (stream& out) const {
361  for_each(uniHunks.begin(), uniHunks.end(), UniHunkPrinter< sesElem, stream >(out));
362  }
363 
364  void printUnifiedFormat (ostream& out = cout) const {
365  printUnifiedFormat< ostream >(out);
366  }
367 
371  template < typename stream >
372  static void printUnifiedFormat (const uniHunkVec& hunks, stream& out) {
373  for_each(hunks.begin(), hunks.end(), UniHunkPrinter< sesElem >(out));
374  }
375 
376  static void printUnifiedFormat (const uniHunkVec& hunks, ostream& out = cout) {
377  printUnifiedFormat< ostream >(hunks, out);
378  }
379 
384  sesElemVec common[2];
385  sesElemVec change;
386  sesElemVec ses_v = ses.getSequence();
387  long long l_cnt = 1;
388  long long length = distance(ses_v.begin(), ses_v.end());
389  long long middle = 0;
390  bool isMiddle, isAfter;
391  elemInfo einfo;
392  long long a, b, c, d; // @@ -a,b +c,d @@
393  long long inc_dec_count = 0;
394  uniHunk< sesElem > hunk;
395  sesElemVec adds;
396  sesElemVec deletes;
397 
398  isMiddle = isAfter = false;
399  a = b = c = d = 0;
400 
401  for (sesElemVec_iter it=ses_v.begin();it!=ses_v.end();++it, ++l_cnt) {
402  einfo = it->second;
403  switch (einfo.type) {
404  case SES_ADD :
405  middle = 0;
406  ++inc_dec_count;
407  adds.push_back(*it);
408  if (!isMiddle) isMiddle = true;
409  if (isMiddle) ++d;
410  if (l_cnt >= length) {
411  joinSesVec(change, deletes);
412  joinSesVec(change, adds);
413  isAfter = true;
414  }
415  break;
416  case SES_DELETE :
417  middle = 0;
418  --inc_dec_count;
419  deletes.push_back(*it);
420  if (!isMiddle) isMiddle = true;
421  if (isMiddle) ++b;
422  if (l_cnt >= length) {
423  joinSesVec(change, deletes);
424  joinSesVec(change, adds);
425  isAfter = true;
426  }
427  break;
428  case SES_COMMON :
429  ++b;++d;
430  if (common[1].empty() && adds.empty() && deletes.empty() && change.empty()) {
431  if (static_cast<long long>(common[0].size()) < DTL_CONTEXT_SIZE) {
432  if (a == 0 && c == 0) {
433  if (!wasSwapped()) {
434  a = einfo.beforeIdx;
435  c = einfo.afterIdx;
436  } else {
437  a = einfo.afterIdx;
438  c = einfo.beforeIdx;
439  }
440  }
441  common[0].push_back(*it);
442  } else {
443  rotate(common[0].begin(), common[0].begin() + 1, common[0].end());
444  common[0].pop_back();
445  common[0].push_back(*it);
446  ++a;++c;
447  --b;--d;
448  }
449  }
450  if (isMiddle && !isAfter) {
451  ++middle;
452  joinSesVec(change, deletes);
453  joinSesVec(change, adds);
454  change.push_back(*it);
455  if (middle >= DTL_SEPARATE_SIZE || l_cnt >= length) {
456  isAfter = true;
457  }
458  adds.clear();
459  deletes.clear();
460  }
461  break;
462  default :
463  // no through
464  break;
465  }
466  // compose unified format hunk
467  if (isAfter && !change.empty()) {
468  sesElemVec_iter cit = it;
469  long long cnt = 0;
470  for (long long i=0;i<DTL_SEPARATE_SIZE && (cit != ses_v.end());++i, ++cit) {
471  if (cit->second.type == SES_COMMON) {
472  ++cnt;
473  }
474  }
475  if (cnt < DTL_SEPARATE_SIZE && l_cnt < length) {
476  middle = 0;
477  isAfter = false;
478  continue;
479  }
480  if (static_cast<long long>(common[0].size()) >= DTL_SEPARATE_SIZE) {
481  long long c0size = static_cast<long long>(common[0].size());
482  rotate(common[0].begin(),
483  common[0].begin() + (size_t)c0size - DTL_SEPARATE_SIZE,
484  common[0].end());
485  for (long long i=0;i<c0size - DTL_SEPARATE_SIZE;++i) {
486  common[0].pop_back();
487  }
488  a += c0size - DTL_SEPARATE_SIZE;
489  c += c0size - DTL_SEPARATE_SIZE;
490  }
491  if (a == 0) ++a;
492  if (c == 0) ++c;
493  if (wasSwapped()) swap(a, c);
494  hunk.a = a;
495  hunk.b = b;
496  hunk.c = c;
497  hunk.d = d;
498  hunk.common[0] = common[0];
499  hunk.change = change;
500  hunk.common[1] = common[1];
501  hunk.inc_dec_count = inc_dec_count;
502  uniHunks.push_back(hunk);
503  isMiddle = false;
504  isAfter = false;
505  common[0].clear();
506  common[1].clear();
507  adds.clear();
508  deletes.clear();
509  change.clear();
510  a = b = c = d = middle = inc_dec_count = 0;
511  }
512  }
513  }
514 
518  template <typename stream>
519  static Ses< elem > composeSesFromStream (stream& st)
520  {
521  elem line;
522  Ses< elem > ret;
523  long long x_idx, y_idx;
524  x_idx = y_idx = 1;
525  while (getline(st, line)) {
526  elem mark(line.begin(), line.begin() + 1);
527  elem e(line.begin() + 1, line.end());
528  if (mark == SES_MARK_DELETE) {
529  ret.addSequence(e, x_idx, 0, SES_DELETE);
530  ++x_idx;
531  } else if (mark == SES_MARK_ADD) {
532  ret.addSequence(e, y_idx, 0, SES_ADD);
533  ++y_idx;
534  } else if (mark == SES_MARK_COMMON) {
535  ret.addSequence(e, x_idx, y_idx, SES_COMMON);
536  ++x_idx;
537  ++y_idx;
538  }
539  }
540  return ret;
541  }
542 
543  private :
547  void init () {
548  M = distance(A.begin(), A.end());
549  N = distance(B.begin(), B.end());
550  if (M < N) {
551  swapped = false;
552  } else {
553  swap(A, B);
554  swap(M, N);
555  swapped = true;
556  }
557  editDistance = 0;
558  delta = N - M;
559  offset = M + 1;
560  huge = false;
561  trivial = false;
562  editDistanceOnly = false;
563  fp = NULL;
564  }
565 
569  long long snake(const long long& k, const long long& above, const long long& below) {
570  long long r = above > below ? path[(size_t)k-1+offset] : path[(size_t)k+1+offset];
571  long long y = max(above, below);
572  long long x = y - k;
573  while ((size_t)x < M && (size_t)y < N && (swapped ? cmp.impl(B[(size_t)y], A[(size_t)x]) : cmp.impl(A[(size_t)x], B[(size_t)y]))) {
574  ++x;++y;
575  }
576 
577  path[(size_t)k+offset] = static_cast<long long>(pathCordinates.size());
578  if (!editDistanceOnly) {
579  P p;
580  p.x = x;p.y = y;p.k = r;
581  pathCordinates.push_back(p);
582  }
583  return y;
584  }
585 
590  sequence_const_iter x(A.begin());
591  sequence_const_iter y(B.begin());
592  long long x_idx, y_idx; // line number for Unified Format
593  long long px_idx, py_idx; // cordinates
594  bool complete = false;
595  x_idx = y_idx = 1;
596  px_idx = py_idx = 0;
597  for (size_t i=v.size()-1;!complete;--i) {
598  while(px_idx < v[i].x || py_idx < v[i].y) {
599  if (v[i].y - v[i].x > py_idx - px_idx) {
600  if (!wasSwapped()) {
601  ses.addSequence(*y, 0, y_idx + oy, SES_ADD);
602  } else {
603  ses.addSequence(*y, y_idx + oy, 0, SES_DELETE);
604  }
605  ++y;
606  ++y_idx;
607  ++py_idx;
608  } else if (v[i].y - v[i].x < py_idx - px_idx) {
609  if (!wasSwapped()) {
610  ses.addSequence(*x, x_idx + ox, 0, SES_DELETE);
611  } else {
612  ses.addSequence(*x, 0, x_idx + ox, SES_ADD);
613  }
614  ++x;
615  ++x_idx;
616  ++px_idx;
617  } else {
618  if (!wasSwapped()) {
619  lcs.addSequence(*x);
620  ses.addSequence(*x, x_idx + ox, y_idx + oy, SES_COMMON);
621  } else {
622  lcs.addSequence(*y);
623  ses.addSequence(*y, y_idx + oy, x_idx + ox, SES_COMMON);
624  }
625  ++x;
626  ++y;
627  ++x_idx;
628  ++y_idx;
629  ++px_idx;
630  ++py_idx;
631  }
632  }
633  if (i == 0) complete = true;
634  }
635 
636  if (x_idx > static_cast<long long>(M) && y_idx > static_cast<long long>(N)) {
637  // all recording succeeded
638  } else {
639  // trivial difference
640  if (trivialEnabled()) {
641  if (!wasSwapped()) {
642  recordOddSequence(x_idx, M, x, SES_DELETE);
643  recordOddSequence(y_idx, N, y, SES_ADD);
644  } else {
645  recordOddSequence(x_idx, M, x, SES_ADD);
646  recordOddSequence(y_idx, N, y, SES_DELETE);
647  }
648  return true;
649  }
650 
651  // nontrivial difference
652  sequence A_(A.begin() + (size_t)x_idx - 1, A.end());
653  sequence B_(B.begin() + (size_t)y_idx - 1, B.end());
654  A = A_;
655  B = B_;
656  M = distance(A.begin(), A.end());
657  N = distance(B.begin(), B.end());
658  delta = N - M;
659  offset = M + 1;
660  delete[] fp;
661  fp = new long long[M + N + 3];
662  fill(&fp[0], &fp[M + N + 3], -1);
663  fill(path.begin(), path.end(), -1);
664  ox = x_idx - 1;
665  oy = y_idx - 1;
666  return false;
667  }
668  return true;
669  }
670 
674  void inline recordOddSequence (long long idx, long long length, sequence_const_iter it, const edit_t et) {
675  while(idx < length){
676  ses.addSequence(*it, idx, 0, et);
677  ++it;
678  ++idx;
679  ++editDistance;
680  }
681  ses.addSequence(*it, idx, 0, et);
682  ++editDistance;
683  }
684 
688  void inline joinSesVec (sesElemVec& s1, sesElemVec& s2) const {
689  if (!s2.empty()) {
690  for (sesElemVec_iter vit=s2.begin();vit!=s2.end();++vit) {
691  s1.push_back(*vit);
692  }
693  }
694  }
695 
699  bool inline wasSwapped () const {
700  return swapped;
701  }
702 
703  };
704 }
705 
706 #endif // DTL_DIFF_H
dtl::uniHunk::common
vector< sesElem > common[2]
Definition: variables.hpp:121
dtl::eleminfo::afterIdx
long long afterIdx
Definition: variables.hpp:88
dtl::Diff::oy
long long oy
Definition: Diff.hpp:71
dtl::Diff::disableHuge
void disableHuge()
Definition: Diff.hpp:159
dtl::Diff::recordOddSequence
void recordOddSequence(long long idx, long long length, sequence_const_iter it, const edit_t et)
Definition: Diff.hpp:674
dtl::Diff::patch
sequence patch(const sequence &seq) const
Definition: Diff.hpp:231
dtl::DTL_CONTEXT_SIZE
const long long DTL_CONTEXT_SIZE
Definition: variables.hpp:96
dtl::Diff::disableTrivial
void disableTrivial()
Definition: Diff.hpp:171
dtl::Diff::ses
Ses< elem > ses
Definition: Diff.hpp:61
dtl::Diff::printSES
static void printSES(const Ses< elem > &s, ostream &out=cout)
Definition: Diff.hpp:334
dtl::Diff::onUnserious
void onUnserious()
Definition: Diff.hpp:138
dtl::Diff::printSES
static void printSES(const Ses< elem > &s, stream &out)
Definition: Diff.hpp:329
dtl::Diff::printUnifiedFormat
void printUnifiedFormat(ostream &out=cout) const
Definition: Diff.hpp:364
dtl::Diff::onHuge
void onHuge()
Definition: Diff.hpp:126
dtl::Diff::storeSES
void storeSES(storedData &sd) const
Definition: Diff.hpp:351
dtl::Point::x
long long x
Definition: variables.hpp:102
dtl::SES_ADD
const edit_t SES_ADD
Definition: variables.hpp:74
SES_MARK_COMMON
#define SES_MARK_COMMON
Definition: variables.hpp:80
dtl::uniHunk::b
long long b
Definition: variables.hpp:120
dtl::DTL_SEPARATE_SIZE
const long long DTL_SEPARATE_SIZE
Definition: variables.hpp:95
dtl::Diff::Diff
Diff()
Definition: Diff.hpp:73
dtl::editPathCordinates
vector< P > editPathCordinates
Definition: variables.hpp:113
dtl::uniHunk::c
long long c
Definition: variables.hpp:120
dtl::edit_t
int edit_t
Definition: variables.hpp:71
dtl::uniHunk::inc_dec_count
long long inc_dec_count
Definition: variables.hpp:123
dtl::Diff::init
void init()
Definition: Diff.hpp:547
dtl::Diff::getUniHunks
uniHunkVec getUniHunks() const
Definition: Diff.hpp:117
SES_MARK_ADD
#define SES_MARK_ADD
Definition: variables.hpp:81
dtl::uniHunk::d
long long d
Definition: variables.hpp:120
dtl::Lcs
Definition: Lcs.hpp:47
dtl::Diff::enableTrivial
void enableTrivial() const
Definition: Diff.hpp:167
dtl::SES_DELETE
const edit_t SES_DELETE
Definition: variables.hpp:72
dtl::Diff::enableHuge
void enableHuge()
Definition: Diff.hpp:155
dtl::SES_COMMON
const edit_t SES_COMMON
Definition: variables.hpp:73
dtl::Diff::snake
long long snake(const long long &k, const long long &above, const long long &below)
Definition: Diff.hpp:569
dtl::Diff::Diff
Diff(const sequence &a, const sequence &b, bool deletesFirst)
Definition: Diff.hpp:80
dtl::Point::y
long long y
Definition: variables.hpp:103
dtl::Ses::getSequence
sesElemVec getSequence() const
Definition: Ses.hpp:119
SES_MARK_DELETE
#define SES_MARK_DELETE
Definition: variables.hpp:79
dtl::eleminfo
Definition: variables.hpp:86
dtl::Diff::getLcsVec
elemVec getLcsVec() const
Definition: Diff.hpp:109
dtl::Diff::hugeEnabled
bool hugeEnabled() const
Definition: Diff.hpp:151
dtl::Diff::~Diff
~Diff()
Definition: Diff.hpp:99
dtl::Diff::editDistance
long long editDistance
Definition: Diff.hpp:59
dtl::uniHunk::a
long long a
Definition: variables.hpp:120
dtl
Definition: Diff.hpp:41
dtl::Diff::joinSesVec
void joinSesVec(sesElemVec &s1, sesElemVec &s2) const
Definition: Diff.hpp:688
dtl::Diff::cmp
comparator cmp
Definition: Diff.hpp:69
dtl::Diff::fp
long long * fp
Definition: Diff.hpp:58
dtl::Diff::getEditDistance
long long getEditDistance() const
Definition: Diff.hpp:101
dtl::Point::k
long long k
Definition: variables.hpp:104
dtl::Diff::Diff
Diff(const sequence &a, const sequence &b)
Definition: Diff.hpp:75
dtl::Diff::getLcs
Lcs< elem > getLcs() const
Definition: Diff.hpp:105
dtl::Diff::printUnifiedFormat
void printUnifiedFormat(stream &out) const
Definition: Diff.hpp:360
dtl::Diff::uniPatch
sequence uniPatch(const sequence &seq)
Definition: Diff.hpp:182
dtl::Diff::printSES
void printSES(stream &out) const
Definition: Diff.hpp:316
dtl::Diff::isHuge
bool isHuge() const
Definition: Diff.hpp:122
dtl::uniHunk
Definition: variables.hpp:119
dtl::Diff::composeSesFromStream
static Ses< elem > composeSesFromStream(stream &st)
Definition: Diff.hpp:519
dtl::Diff::Diff
Diff(const sequence &a, const sequence &b, const comparator &comp)
Definition: Diff.hpp:86
dtl::Diff::N
size_t N
Definition: Diff.hpp:55
dtl::eleminfo::type
edit_t type
Definition: variables.hpp:89
dtl::Diff::Diff
Diff(const sequence &a, const sequence &b, bool deleteFirst, const comparator &comp)
Definition: Diff.hpp:92
dtl::Diff::M
size_t M
Definition: Diff.hpp:54
dtl::ChangePrinter
Definition: functors.hpp:77
dtl::Diff::editDistanceOnly
bool editDistanceOnly
Definition: Diff.hpp:67
dtl::Diff::onOnlyEditDistance
void onOnlyEditDistance()
Definition: Diff.hpp:146
dtl::Diff::offHuge
void offHuge()
Definition: Diff.hpp:130
dtl::Diff
Definition: Diff.hpp:48
dtl::Diff::lcs
Lcs< elem > lcs
Definition: Diff.hpp:60
dtl::eleminfo::beforeIdx
long long beforeIdx
Definition: variables.hpp:87
dtl::Diff::ox
long long ox
Definition: Diff.hpp:70
dtl::Diff::offUnserious
void offUnserious()
Definition: Diff.hpp:142
dtl::uniHunk::change
vector< sesElem > change
Definition: variables.hpp:122
dtl::Diff::offset
size_t offset
Definition: Diff.hpp:57
dtl::Diff::trivial
bool trivial
Definition: Diff.hpp:66
dtl::Diff::printSES
void printSES(ostream &out=cout) const
Definition: Diff.hpp:321
dtl::Diff::swapped
bool swapped
Definition: Diff.hpp:64
dtl::Diff::isUnserious
bool isUnserious() const
Definition: Diff.hpp:134
dtl::UniHunkPrinter
Definition: functors.hpp:102
dtl::Diff::recordSequence
bool recordSequence(const editPathCordinates &v)
Definition: Diff.hpp:589
dtl::Diff::trivialEnabled
bool trivialEnabled() const
Definition: Diff.hpp:163
dtl::Diff::delta
size_t delta
Definition: Diff.hpp:56
dtl::MAX_CORDINATES_SIZE
const unsigned long long MAX_CORDINATES_SIZE
Definition: variables.hpp:110
dtl::editPath
vector< long long > editPath
Definition: variables.hpp:112
dtl::Diff::compose
void compose()
Definition: Diff.hpp:260
dtl::Diff::uniHunks
uniHunkVec uniHunks
Definition: Diff.hpp:68
dtl::Diff::getSes
Ses< elem > getSes() const
Definition: Diff.hpp:113
dtl::Diff::dtl_typedefs
dtl_typedefs(elem, sequence) sequence A
dtl::Diff::printUnifiedFormat
static void printUnifiedFormat(const uniHunkVec &hunks, ostream &out=cout)
Definition: Diff.hpp:376
dtl::Diff::wasSwapped
bool wasSwapped() const
Definition: Diff.hpp:699
dtl::Point
Definition: variables.hpp:101
dtl::Diff::printSES
void printSES(stream &out) const
Definition: Diff.hpp:342
dtl::Diff::huge
bool huge
Definition: Diff.hpp:65
dtl::Diff::composeUnifiedHunks
void composeUnifiedHunks()
Definition: Diff.hpp:383
dtl::Diff::printUnifiedFormat
static void printUnifiedFormat(const uniHunkVec &hunks, stream &out)
Definition: Diff.hpp:372
dtl::Diff::B
sequence B
Definition: Diff.hpp:53
dtl::Diff::pathCordinates
editPathCordinates pathCordinates
Definition: Diff.hpp:63
dtl::Ses::addSequence
void addSequence(elem e, long long beforeIdx, long long afterIdx, const edit_t type)
Definition: Ses.hpp:83
dtl::Diff::editDistanceOnlyEnabled
void editDistanceOnlyEnabled()
Definition: Diff.hpp:175
dtl::Diff::path
editPath path
Definition: Diff.hpp:62
dtl::Ses
Definition: Ses.hpp:47