Add ol.structs.IntegerSet.toString

This commit is contained in:
Tom Payne
2013-03-19 07:30:51 +01:00
parent 9047e98889
commit 6ab5cfae8c
2 changed files with 43 additions and 0 deletions

View File

@@ -293,3 +293,23 @@ ol.structs.IntegerSet.prototype.removeRange =
}
this.compactRanges_();
};
if (goog.DEBUG) {
/**
* @return {string} String.
*/
ol.structs.IntegerSet.prototype.toString = function() {
var arr = this.arr_;
var n = arr.length;
var result = new Array(n / 2);
var resultIndex = 0;
var i;
for (i = 0; i < n; i += 2) {
result[resultIndex++] = arr[i] + '-' + arr[i + 1];
}
return result.join(', ');
};
}