in database-jones/Adapter/common/IndexBounds.js [263:296]
Endpoint.prototype.compare = function(that) {
var cmp;
assert(that.isEndpoint);
if(this.value !== null && this.value.isNonSimple) {
cmp = this.value.compare(that.value);
}
else {
cmp = compareValues(this.value, that.value);
}
if(cmp === 0) { // Values are equal.
if((this.isLow && that.isLow) && // both low bounds
(this.inclusive !== that.inclusive))
{
cmp = (this.inclusive ? -1 : 1);
}
else if((this.isLow === that.isLow) && // both high bounds
(this.inclusive !== that.inclusive))
{
cmp = (this.inclusive ? 1 : -1);
}
else if(this.inclusive && that.inclusive) // both inclusive
{
cmp = (this.isLow ? -1 : 1);
}
else
{
cmp = (this.isLow ? 1 : -1);
}
}
return cmp;
};