47 template <
typename elem,
typename sequence = vector< elem >,
typename comparator = Compare< elem > >
66 const sequence& c) : A(a),
B(b),
C(c),
84 if (
diff_ba.getEditDistance() == 0) {
85 if (
diff_bc.getEditDistance() == 0) {
92 if (
diff_bc.getEditDistance() == 0) {
123 sesElemVec_iter ba_it = ses_ba_v.begin();
124 sesElemVec_iter bc_it = ses_bc_v.begin();
125 sesElemVec_iter ba_end = ses_ba_v.end();
126 sesElemVec_iter bc_end = ses_bc_v.end();
128 while (!
isEnd(ba_end, ba_it) || !
isEnd(bc_end, bc_it)) {
130 if (!
isEnd(ba_end, ba_it) &&
131 !
isEnd(bc_end, bc_it) &&
132 ba_it->first == bc_it->first &&
139 if (!
isEnd(ba_end, ba_it)) seq.push_back(ba_it->first);
140 else if (!
isEnd(bc_end, bc_it)) seq.push_back(bc_it->first);
144 if (
isEnd(ba_end, ba_it) ||
isEnd(bc_end, bc_it))
break;
149 }
else if (ba_it->second.type ==
SES_COMMON &&
150 bc_it->second.type ==
SES_ADD) {
151 seq.push_back(bc_it->first);
153 }
else if (ba_it->second.type ==
SES_DELETE &&
157 }
else if (ba_it->second.type ==
SES_DELETE &&
159 if (ba_it->first == bc_it->first) {
167 }
else if (ba_it->second.type ==
SES_DELETE &&
168 bc_it->second.type ==
SES_ADD) {
172 }
else if (ba_it->second.type ==
SES_ADD &&
174 seq.push_back(ba_it->first);
176 }
else if (ba_it->second.type ==
SES_ADD &&
181 }
else if (ba_it->second.type ==
SES_ADD &&
182 bc_it->second.type ==
SES_ADD) {
183 if (ba_it->first == bc_it->first) {
184 seq.push_back(ba_it->first);
195 if (
isEnd(ba_end, ba_it)) {
197 }
else if (
isEnd(bc_end, bc_it)) {
201 sequence mergedSeq(seq.begin(), seq.end());
210 for (elemVec_iter vit=s2.begin();vit!=s2.end();++vit) {
219 template <
typename T_iter>
220 bool inline isEnd (
const T_iter& end,
const T_iter& it)
const {
221 return it == end ? true :
false;
227 template <
typename T_iter>
229 if (!
isEnd(end, it)) ++it;
235 void inline addDecentSequence (
const sesElemVec_iter& end, sesElemVec_iter& it, elemVec& seq)
const {
236 while (!
isEnd(end, it)) {
237 if (it->second.type ==
SES_ADD) seq.push_back(it->first);
sequence getMergedSequence() const
dtl_typedefs(elem, sequence) sequence A
Diff3(const sequence &a, const sequence &b, const sequence &c)
bool isEnd(const T_iter &end, const T_iter &it) const
Diff< elem, sequence, comparator > diff_bc
void forwardUntilEnd(const T_iter &end, T_iter &it) const
void addDecentSequence(const sesElemVec_iter &end, sesElemVec_iter &it, elemVec &seq) const
Diff< elem, sequence, comparator > diff_ba
void joinElemVec(elemVec &s1, elemVec &s2) const
sesElemVec getSequence() const