Rename ol.structs.RBush#all to getAll
This commit is contained in:
@@ -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 {ol.structs.RBushNode.<T>} node Node.
|
||||||
* @param {function(ol.structs.RBushNode.<T>, ol.structs.RBushNode.<T>): number}
|
* @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.
|
* @param {T} value Value.
|
||||||
* @private
|
* @private
|
||||||
|
|||||||
@@ -10,10 +10,10 @@ describe('ol.structs.RBush', function() {
|
|||||||
|
|
||||||
describe('when empty', function() {
|
describe('when empty', function() {
|
||||||
|
|
||||||
describe('#all', function() {
|
describe('#getAll', function() {
|
||||||
|
|
||||||
it('returns the expected number of objects', 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() {
|
it('can remove each object', function() {
|
||||||
var i, ii;
|
var i, ii;
|
||||||
for (i = 0, ii = objs.length; i < ii; ++i) {
|
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]);
|
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]);
|
rBush.remove(objs[i]);
|
||||||
expect(rBush.allInExtent(extents[i])).to.be.empty();
|
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() {
|
it('can remove objects in random order', function() {
|
||||||
@@ -182,7 +182,7 @@ describe('ol.structs.RBush', function() {
|
|||||||
rBush.remove(objs[index]);
|
rBush.remove(objs[index]);
|
||||||
expect(rBush.allInExtent(extents[index])).to.be.empty();
|
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() {
|
it('returns the expected number of objects', function() {
|
||||||
expect(rBush.all().length).to.be(1000);
|
expect(rBush.getAll().length).to.be(1000);
|
||||||
});
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user