NumeRe v1.1.4
NumeRe: Framework für Numerische Rechnungen
|
#include <Diff.hpp>
Public Member Functions | |
Diff () | |
Diff (const sequence &a, const sequence &b) | |
Diff (const sequence &a, const sequence &b, bool deletesFirst) | |
Diff (const sequence &a, const sequence &b, const comparator &comp) | |
Diff (const sequence &a, const sequence &b, bool deleteFirst, const comparator &comp) | |
~Diff () | |
long long | getEditDistance () const |
Lcs< elem > | getLcs () const |
elemVec | getLcsVec () const |
Ses< elem > | getSes () const |
uniHunkVec | getUniHunks () const |
bool | isHuge () const |
void | onHuge () |
void | offHuge () |
bool | isUnserious () const |
void | onUnserious () |
void | offUnserious () |
void | onOnlyEditDistance () |
bool | hugeEnabled () const |
void | enableHuge () |
void | disableHuge () |
bool | trivialEnabled () const |
void | enableTrivial () const |
void | disableTrivial () |
void | editDistanceOnlyEnabled () |
sequence | uniPatch (const sequence &seq) |
sequence | patch (const sequence &seq) const |
void | compose () |
template<typename stream > | |
void | printSES (stream &out) const |
void | printSES (ostream &out=cout) const |
template<typename stream , template< typename SEET, typename STRT > class PT> | |
void | printSES (stream &out) const |
template<typename stream > | |
void | printUnifiedFormat (stream &out) const |
void | printUnifiedFormat (ostream &out=cout) const |
void | composeUnifiedHunks () |
Static Public Member Functions | |
template<typename stream > | |
static void | printSES (const Ses< elem > &s, stream &out) |
static void | printSES (const Ses< elem > &s, ostream &out=cout) |
template<typename stream > | |
static void | printUnifiedFormat (const uniHunkVec &hunks, stream &out) |
static void | printUnifiedFormat (const uniHunkVec &hunks, ostream &out=cout) |
template<typename stream > | |
static Ses< elem > | composeSesFromStream (stream &st) |
Private Member Functions | |
dtl_typedefs (elem, sequence) sequence A | |
void | init () |
long long | snake (const long long &k, const long long &above, const long long &below) |
bool | recordSequence (const editPathCordinates &v) |
void | recordOddSequence (long long idx, long long length, sequence_const_iter it, const edit_t et) |
void | joinSesVec (sesElemVec &s1, sesElemVec &s2) const |
bool | wasSwapped () const |
Private Attributes | |
sequence | B |
size_t | M |
size_t | N |
size_t | delta |
size_t | offset |
long long * | fp |
long long | editDistance |
Lcs< elem > | lcs |
Ses< elem > | ses |
editPath | path |
editPathCordinates | pathCordinates |
bool | swapped |
bool | huge |
bool | trivial |
bool | editDistanceOnly |
uniHunkVec | uniHunks |
comparator | cmp |
diff class template sequence must support random_access_iterator.
|
inline |
|
inline |
Definition at line 73 of file Diff.hpp.
References dtl::Diff< elem, sequence, comparator >::init().
|
inline |
Definition at line 78 of file Diff.hpp.
References dtl::Diff< elem, sequence, comparator >::init().
|
inline |
Definition at line 84 of file Diff.hpp.
References dtl::Diff< elem, sequence, comparator >::init().
|
inline |
Definition at line 90 of file Diff.hpp.
References dtl::Diff< elem, sequence, comparator >::init().
|
inline |
compose Longest Common Subsequence and Shortest Edit Script. The algorithm implemented here is based on "An O(NP) Sequence Comparison Algorithm" described by Sun Wu, Udi Manber and Gene Myers
Definition at line 258 of file Diff.hpp.
References dtl::Diff< elem, sequence, comparator >::delta, dtl::Diff< elem, sequence, comparator >::editDistance, dtl::Diff< elem, sequence, comparator >::editDistanceOnly, dtl::Diff< elem, sequence, comparator >::fp, dtl::Diff< elem, sequence, comparator >::isHuge(), dtl::Diff< elem, sequence, comparator >::M, dtl::MAX_CORDINATES_SIZE, dtl::Diff< elem, sequence, comparator >::N, dtl::Diff< elem, sequence, comparator >::offset, dtl::Diff< elem, sequence, comparator >::path, dtl::Diff< elem, sequence, comparator >::pathCordinates, dtl::Diff< elem, sequence, comparator >::recordSequence(), dtl::Diff< elem, sequence, comparator >::snake(), dtl::Point::x, and dtl::Point::y.
Referenced by compareFiles(), and FileRevisions::diff().
|
inlinestatic |
compose ses from stream
Definition at line 507 of file Diff.hpp.
References dtl::Ses< elem >::addSequence(), dtl::SES_ADD, dtl::SES_COMMON, dtl::SES_DELETE, SES_MARK_ADD, SES_MARK_COMMON, and SES_MARK_DELETE.
|
inline |
compose Unified Format Hunks from Shortest Edit Script
Definition at line 371 of file Diff.hpp.
References dtl::uniHunk< sesElem >::a, dtl::eleminfo::afterIdx, dtl::uniHunk< sesElem >::b, dtl::eleminfo::beforeIdx, dtl::uniHunk< sesElem >::c, dtl::uniHunk< sesElem >::change, dtl::uniHunk< sesElem >::common, dtl::uniHunk< sesElem >::d, dtl::DTL_CONTEXT_SIZE, dtl::DTL_SEPARATE_SIZE, dtl::uniHunk< sesElem >::inc_dec_count, dtl::Diff< elem, sequence, comparator >::joinSesVec(), dtl::Diff< elem, sequence, comparator >::ses, dtl::SES_ADD, dtl::SES_COMMON, dtl::SES_DELETE, dtl::eleminfo::type, dtl::Diff< elem, sequence, comparator >::uniHunks, and dtl::Diff< elem, sequence, comparator >::wasSwapped().
Referenced by compareFiles(), and FileRevisions::diff().
|
inline |
|
inline |
|
private |
|
inline |
|
inline |
|
inline |
|
inline |
Definition at line 99 of file Diff.hpp.
References dtl::Diff< elem, sequence, comparator >::editDistance.
|
inline |
Definition at line 103 of file Diff.hpp.
References dtl::Diff< elem, sequence, comparator >::lcs.
|
inline |
Definition at line 107 of file Diff.hpp.
References dtl::Diff< elem, sequence, comparator >::lcs.
|
inline |
Definition at line 111 of file Diff.hpp.
References dtl::Diff< elem, sequence, comparator >::ses.
|
inline |
Definition at line 115 of file Diff.hpp.
References dtl::Diff< elem, sequence, comparator >::uniHunks.
|
inline |
Definition at line 149 of file Diff.hpp.
References dtl::Diff< elem, sequence, comparator >::huge.
|
inlineprivate |
initialize
Definition at line 535 of file Diff.hpp.
References dtl::Diff< elem, sequence, comparator >::B, dtl::Diff< elem, sequence, comparator >::delta, dtl::Diff< elem, sequence, comparator >::editDistance, dtl::Diff< elem, sequence, comparator >::editDistanceOnly, dtl::Diff< elem, sequence, comparator >::fp, dtl::Diff< elem, sequence, comparator >::huge, dtl::Diff< elem, sequence, comparator >::M, dtl::Diff< elem, sequence, comparator >::N, dtl::Diff< elem, sequence, comparator >::offset, dtl::Diff< elem, sequence, comparator >::swapped, and dtl::Diff< elem, sequence, comparator >::trivial.
Referenced by dtl::Diff< elem, sequence, comparator >::Diff().
|
inline |
Definition at line 120 of file Diff.hpp.
References dtl::Diff< elem, sequence, comparator >::huge.
Referenced by dtl::Diff< elem, sequence, comparator >::compose().
|
inline |
Definition at line 132 of file Diff.hpp.
References dtl::Diff< elem, sequence, comparator >::trivial.
|
inlineprivate |
join SES vectors
Definition at line 674 of file Diff.hpp.
Referenced by dtl::Diff< elem, sequence, comparator >::composeUnifiedHunks(), and dtl::Diff< elem, sequence, comparator >::uniPatch().
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
patching with Shortest Edit Script (SES)
Definition at line 229 of file Diff.hpp.
References dtl::Diff< elem, sequence, comparator >::ses, dtl::SES_ADD, dtl::SES_COMMON, and dtl::SES_DELETE.
|
inlinestatic |
print differences given an SES
Definition at line 326 of file Diff.hpp.
References dtl::Ses< elem >::getSequence().
|
inline |
|
inline |
print difference between A and B as an SES
Definition at line 313 of file Diff.hpp.
References dtl::Diff< elem, sequence, comparator >::ses.
|
inline |
print difference between A and B as an SES with custom printer
Definition at line 339 of file Diff.hpp.
References dtl::Diff< elem, sequence, comparator >::ses.
|
inlinestatic |
|
inlinestatic |
|
inline |
|
inline |
print difference between A and B in the Unified Format
Definition at line 348 of file Diff.hpp.
References dtl::Diff< elem, sequence, comparator >::uniHunks.
Referenced by compareFiles(), and FileRevisions::diff().
|
inlineprivate |
record odd sequence in SES
Definition at line 660 of file Diff.hpp.
References dtl::Diff< elem, sequence, comparator >::editDistance, and dtl::Diff< elem, sequence, comparator >::ses.
Referenced by dtl::Diff< elem, sequence, comparator >::recordSequence().
|
inlineprivate |
record SES and LCS
Definition at line 577 of file Diff.hpp.
References dtl::Diff< elem, sequence, comparator >::B, dtl::Diff< elem, sequence, comparator >::delta, dtl::Diff< elem, sequence, comparator >::fp, dtl::Diff< elem, sequence, comparator >::lcs, dtl::Diff< elem, sequence, comparator >::M, dtl::Diff< elem, sequence, comparator >::N, dtl::Diff< elem, sequence, comparator >::offset, dtl::Diff< elem, sequence, comparator >::path, dtl::Diff< elem, sequence, comparator >::recordOddSequence(), dtl::Diff< elem, sequence, comparator >::ses, dtl::SES_ADD, dtl::SES_COMMON, dtl::SES_DELETE, dtl::Diff< elem, sequence, comparator >::trivialEnabled(), and dtl::Diff< elem, sequence, comparator >::wasSwapped().
Referenced by dtl::Diff< elem, sequence, comparator >::compose().
|
inlineprivate |
search shortest path and record the path
Definition at line 557 of file Diff.hpp.
References dtl::Diff< elem, sequence, comparator >::B, dtl::Diff< elem, sequence, comparator >::cmp, dtl::Diff< elem, sequence, comparator >::editDistanceOnly, dtl::Point::k, dtl::Diff< elem, sequence, comparator >::M, max, dtl::Diff< elem, sequence, comparator >::N, dtl::Diff< elem, sequence, comparator >::offset, dtl::Diff< elem, sequence, comparator >::path, dtl::Diff< elem, sequence, comparator >::pathCordinates, dtl::Diff< elem, sequence, comparator >::swapped, dtl::Point::x, and dtl::Point::y.
Referenced by dtl::Diff< elem, sequence, comparator >::compose().
|
inline |
Definition at line 161 of file Diff.hpp.
References dtl::Diff< elem, sequence, comparator >::trivial.
Referenced by dtl::Diff< elem, sequence, comparator >::recordSequence().
|
inline |
patching with Unified Format Hunks
Definition at line 180 of file Diff.hpp.
References dtl::Diff< elem, sequence, comparator >::joinSesVec(), dtl::SES_ADD, dtl::SES_COMMON, dtl::SES_DELETE, and dtl::Diff< elem, sequence, comparator >::uniHunks.
|
inlineprivate |
check if the sequences have been swapped
Definition at line 685 of file Diff.hpp.
References dtl::Diff< elem, sequence, comparator >::swapped.
Referenced by dtl::Diff< elem, sequence, comparator >::composeUnifiedHunks(), and dtl::Diff< elem, sequence, comparator >::recordSequence().
|
private |
Definition at line 53 of file Diff.hpp.
Referenced by dtl::Diff< elem, sequence, comparator >::init(), dtl::Diff< elem, sequence, comparator >::recordSequence(), and dtl::Diff< elem, sequence, comparator >::snake().
|
private |
Definition at line 69 of file Diff.hpp.
Referenced by dtl::Diff< elem, sequence, comparator >::snake().
|
private |
Definition at line 56 of file Diff.hpp.
Referenced by dtl::Diff< elem, sequence, comparator >::compose(), dtl::Diff< elem, sequence, comparator >::init(), and dtl::Diff< elem, sequence, comparator >::recordSequence().
|
private |
|
private |
Definition at line 67 of file Diff.hpp.
Referenced by dtl::Diff< elem, sequence, comparator >::compose(), dtl::Diff< elem, sequence, comparator >::init(), and dtl::Diff< elem, sequence, comparator >::snake().
|
private |
Definition at line 58 of file Diff.hpp.
Referenced by dtl::Diff< elem, sequence, comparator >::compose(), dtl::Diff< elem, sequence, comparator >::init(), and dtl::Diff< elem, sequence, comparator >::recordSequence().
|
private |
Definition at line 65 of file Diff.hpp.
Referenced by dtl::Diff< elem, sequence, comparator >::hugeEnabled(), dtl::Diff< elem, sequence, comparator >::init(), and dtl::Diff< elem, sequence, comparator >::isHuge().
|
private |
Definition at line 60 of file Diff.hpp.
Referenced by dtl::Diff< elem, sequence, comparator >::getLcs(), dtl::Diff< elem, sequence, comparator >::getLcsVec(), and dtl::Diff< elem, sequence, comparator >::recordSequence().
|
private |
Definition at line 54 of file Diff.hpp.
Referenced by dtl::Diff< elem, sequence, comparator >::compose(), dtl::Diff< elem, sequence, comparator >::init(), dtl::Diff< elem, sequence, comparator >::recordSequence(), and dtl::Diff< elem, sequence, comparator >::snake().
|
private |
Definition at line 55 of file Diff.hpp.
Referenced by dtl::Diff< elem, sequence, comparator >::compose(), dtl::Diff< elem, sequence, comparator >::init(), dtl::Diff< elem, sequence, comparator >::recordSequence(), and dtl::Diff< elem, sequence, comparator >::snake().
|
private |
Definition at line 57 of file Diff.hpp.
Referenced by dtl::Diff< elem, sequence, comparator >::compose(), dtl::Diff< elem, sequence, comparator >::init(), dtl::Diff< elem, sequence, comparator >::recordSequence(), and dtl::Diff< elem, sequence, comparator >::snake().
|
private |
Definition at line 62 of file Diff.hpp.
Referenced by dtl::Diff< elem, sequence, comparator >::compose(), dtl::Diff< elem, sequence, comparator >::recordSequence(), and dtl::Diff< elem, sequence, comparator >::snake().
|
private |
Definition at line 63 of file Diff.hpp.
Referenced by dtl::Diff< elem, sequence, comparator >::compose(), and dtl::Diff< elem, sequence, comparator >::snake().
|
private |
Definition at line 61 of file Diff.hpp.
Referenced by dtl::Diff< elem, sequence, comparator >::composeUnifiedHunks(), dtl::Diff< elem, sequence, comparator >::getSes(), dtl::Diff< elem, sequence, comparator >::patch(), dtl::Diff< elem, sequence, comparator >::printSES(), dtl::Diff< elem, sequence, comparator >::recordOddSequence(), and dtl::Diff< elem, sequence, comparator >::recordSequence().
|
private |
Definition at line 64 of file Diff.hpp.
Referenced by dtl::Diff< elem, sequence, comparator >::init(), dtl::Diff< elem, sequence, comparator >::snake(), and dtl::Diff< elem, sequence, comparator >::wasSwapped().
|
private |
Definition at line 66 of file Diff.hpp.
Referenced by dtl::Diff< elem, sequence, comparator >::init(), dtl::Diff< elem, sequence, comparator >::isUnserious(), and dtl::Diff< elem, sequence, comparator >::trivialEnabled().
|
private |