|
|
bool toNextPotenialExactAtom(string::const_iterator& p, const string::const_iterator& end, bool ignoreMissingPrefix); | bool toNextPotenialExactAtom(string::const_iterator& p, const string::const_iterator& end, bool ignoreMissingPrefix); |
bool sequenceAdvance(const string& sequence, string::const_iterator& p, const string::const_iterator& end); | bool sequenceAdvance(const string& sequence, string::const_iterator& p, const string::const_iterator& end); |
int versionNumberCompare(const string& ls, const string& rs); | int versionNumberCompare(const string& ls, const string& rs); |
|
int toCannocalValue(int arg); |
| |
class PVSuffixToken | class PVSuffixToken |
{ | { |
|
|
} | } |
| |
} | } |
return lls.compare(rrs); |
|
|
//we want this function to return -1, 0 or 1! |
|
return toCannocalValue(lls.compare(rrs)); |
|
} |
|
|
|
inline int toCannocalValue(int arg) |
|
{ |
|
if(arg != 0) |
|
return (arg < 0 ? -1 : 1); |
|
return 0; |
} | } |
| |
PVSuffixToken::PVSuffixToken(const string& str) | PVSuffixToken::PVSuffixToken(const string& str) |
|
|
{ | { |
string opMe(getCategory() + getPN()); | string opMe(getCategory() + getPN()); |
string opOther(other.getCategory() + other.getPN()); | string opOther(other.getCategory() + other.getPN()); |
return opMe.compare(opOther); |
return local::toCannocalValue(opMe.compare(opOther)); |
} | } |
| |
int Atom::comparePV(const ExactAtom& other) const | int Atom::comparePV(const ExactAtom& other) const |
|
|
string ov(other._pv); | string ov(other._pv); |
if(ov.size() > mv.size()) | if(ov.size() > mv.size()) |
ov.erase(mv.size()); | ov.erase(mv.size()); |
return mv.compare(ov); |
return local::toCannocalValue(mv.compare(ov)); |
} | } |
| |
if(_pv.empty() || other._pv.empty()) | if(_pv.empty() || other._pv.empty()) |
|
|
{ | { |
hlp = mTok[i].compare(oTok[i]); | hlp = mTok[i].compare(oTok[i]); |
if(hlp != 0) | if(hlp != 0) |
return hlp; |
return local::toCannocalValue(hlp); |
++i; | ++i; |
} | } |
else if(isPVOptionalLetterComponentIndex(i)) | else if(isPVOptionalLetterComponentIndex(i)) |
|
|
local::PVSuffixToken tokO(oTok[i]); | local::PVSuffixToken tokO(oTok[i]); |
int hlp = tokL.compare(tokO); | int hlp = tokL.compare(tokO); |
if(hlp != 0) | if(hlp != 0) |
return hlp; |
return local::toCannocalValue(hlp); |
} | } |
return trailingPVPartIncoperate(other); | return trailingPVPartIncoperate(other); |
} | } |
|
|
| |
bool ExactAtom::operator<(const ExactAtom& other) const | bool ExactAtom::operator<(const ExactAtom& other) const |
{ | { |
return compare(other) == -1; |
return compare(other) < 0; |
} | } |
| |
int ExactAtom::compare(const ExactAtom& other) const | int ExactAtom::compare(const ExactAtom& other) const |