src/PredFinder/elf/ElfIndividual.cpp
/**
 * Compares two sets lexicographically, stepping through the items in
 * sort order until finding a mismatch (lower key qualifies as "less-than") or the end of a
 * collection (shorter collection wins). Returns -1 if t0 < t1, 0 if t0 == t1,
 * +1 if t0 > t1.
 *
 * @param set0 First set.
 * @param set1 Second set.
 *
 * @author afrankel@bbn.com
 * @date 2011.05.10
 **/
Compares two sets lexicographically, stepping through the items in
sort order until finding a mismatch (lower key qualifies as "less-than") or the end of a
collection (shorter collection wins).

@param set0 First set.
@param set1 Second set.


Compares two sets lexicographically stepping through the items in sort order until finding a mismatch ( lower key qualifies as " less - than " ) or the end of a collection ( shorter collection wins ) . @param set0 First set . @param set1 Second set .
int ElfIndividual::lexicographicallyCompareTypeSets(const ElfIndividual & other) const {
	ElfTypeSet::const_iterator iter0 = _types.begin();
	ElfTypeSet::const_iterator iter1 = other._types.begin();
	static ElfString_less_than cmp;
	while (true) {
		if (iter0 == _types.end()) {
			if (iter1 == other._types.end()) {
				return 0; 
			} else {
				return -1; 
			} 
		} else if (iter1 == other._types.end()) {
			return 1; 
		} else if (cmp(*iter0, *iter1)) {
			return -1;
		} else if (cmp(*iter1, *iter0)) {
			return 1;
		} else {
			++iter0;
			++iter1;
		}
	}
}
int ElfIndividual :: lexicographicallyCompareTypeSets ( const ElfIndividual & other ) const { ElfTypeSet :: const_iterator iter0 = _types . begin ( ) ; ElfTypeSet :: const_iterator iter1 = other . _types . begin ( ) ; static ElfString_less_than cmp ; while ( true ) { if ( iter0 == _types . end ( ) ) { if ( iter1 == other . _types . end ( ) ) { return 0 ; } else { return -1 ; } } else if ( iter1 == other . _types . end ( ) ) { return 1 ; } else if ( cmp ( * iter0 , * iter1 ) ) { return -1 ; } else if ( cmp ( * iter1 , * iter0 ) ) { return 1 ; } else { ++ iter0 ; ++ iter1 ; } } }
Compares two sets lexicographically, stepping through the items in
 sort order until finding a mismatch (lower key qualifies as "less-than") or the end of a
 collection (shorter collection wins).
Compares two sets lexicographically stepping through the items in sort order until finding a mismatch ( lower key qualifies as " less - than " ) or the end of a collection ( shorter collection wins ) .
// The algorithm std::lexicographical_compare() almost gives us what we want,
 // but (despite its name) it returns a bool rather than an int, so we'd have to call 
 // it twice to get a {-1, 0, 1} return value.
 // the sets have the same content and the same length
 // first set is shorter
 // second set is shorter
