Rename ol.structs.RBush#all to getAll

This commit is contained in:
Tom Payne
2013-11-27 14:59:24 +01:00
parent 978041b68c
commit 828456d18e
2 changed files with 24 additions and 24 deletions

View File

@@ -200,22 +200,6 @@ ol.structs.RBush = function(opt_maxEntries) {
};
/**
* @return {Array.<T>} All.
*/
ol.structs.RBush.prototype.all = function() {
var values = [];
this.forEach(
/**
* @param {T} value Value.
*/
function(value) {
values.push(value);
});
return values;
};
/**
* @param {ol.structs.RBushNode.<T>} node Node.
* @param {function(ol.structs.RBushNode.<T>, ol.structs.RBushNode.<T>): number}
@@ -520,6 +504,22 @@ ol.structs.RBush.prototype.forEachNode = function(callback, opt_obj) {
};
/**
* @return {Array.<T>} All.
*/
ol.structs.RBush.prototype.getAll = function() {
var values = [];
this.forEach(
/**
* @param {T} value Value.
*/
function(value) {
values.push(value);
});
return values;
};
/**
* @param {T} value Value.
* @private

View File

@@ -10,10 +10,10 @@ describe('ol.structs.RBush', function() {
describe('when empty', function() {
describe('#all', function() {
describe('#getAll', function() {
it('returns the expected number of objects', function() {
expect(rBush.all()).to.be.empty();
expect(rBush.getAll()).to.be.empty();
});
});
@@ -81,9 +81,9 @@ describe('ol.structs.RBush', function() {
it('can remove each object', function() {
var i, ii;
for (i = 0, ii = objs.length; i < ii; ++i) {
expect(rBush.all()).to.contain(objs[i]);
expect(rBush.getAll()).to.contain(objs[i]);
rBush.remove(objs[i]);
expect(rBush.all()).not.to.contain(objs[i]);
expect(rBush.getAll()).not.to.contain(objs[i]);
}
});
@@ -164,7 +164,7 @@ describe('ol.structs.RBush', function() {
rBush.remove(objs[i]);
expect(rBush.allInExtent(extents[i])).to.be.empty();
}
expect(rBush.all()).to.be.empty();
expect(rBush.getAll()).to.be.empty();
});
it('can remove objects in random order', function() {
@@ -182,7 +182,7 @@ describe('ol.structs.RBush', function() {
rBush.remove(objs[index]);
expect(rBush.allInExtent(extents[index])).to.be.empty();
}
expect(rBush.all()).to.be.empty();
expect(rBush.getAll()).to.be.empty();
});
});
@@ -201,10 +201,10 @@ describe('ol.structs.RBush', function() {
}
});
describe('#all', function() {
describe('#getAll', function() {
it('returns the expected number of objects', function() {
expect(rBush.all().length).to.be(1000);
expect(rBush.getAll().length).to.be(1000);
});
});