本文整理汇总了Java中com.artemis.utils.IntBag.clear方法的典型用法代码示例。如果您正苦于以下问题:Java IntBag.clear方法的具体用法?Java IntBag.clear怎么用?Java IntBag.clear使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.artemis.utils.IntBag
的用法示例。
在下文中一共展示了IntBag.clear方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: complex_get_test
import com.artemis.utils.IntBag; //导入方法依赖的package包/类
@Test
public void complex_get_test() {
IntBag fill = new IntBag();
QuadTree.MAX_IN_BUCKET = 1;
QuadTree tree = new QuadTree(-8, -8, 8, 8);
fill.clear();
tree.get(fill, -3, -3, 6, 6);
Assert.assertEquals(fill.size(), 0);
// all outside
tree.insert(1, -6, -6, 2, 2);
tree.insert(2, 4, -6, 2, 2);
tree.insert(3, -6, 4, 2, 2);
tree.insert(4, 4, 4, 2, 2);
tree.insert(5, -1, -1, 2, 2); // cemter
tree.insert(6, -4, -4, 2, 2); // fully inside
tree.insert(7, 2, 2, 2, 2); // fully inside
tree.insert(8, -4, -4, 2, 2); // fully inside
}
示例2: findPoint
import com.artemis.utils.IntBag; //导入方法依赖的package包/类
static IntBag findPoint (TestData data, IntBag fill, Bag<TestData> testData) {
for (int i = 0; i < testData.size(); i++) {
TestData test = testData.get(i);
if (test.contains(data.x, data.y)) {
fill.add(test.id);
}
}
fill.clear();
return fill;
}
示例3: find
import com.artemis.utils.IntBag; //导入方法依赖的package包/类
static IntBag find (TestData data, IntBag fill, Bag<TestData> testData) {
for (int i = 0; i < testData.size(); i++) {
TestData test = testData.get(i);
if (test.overlaps(data.x, data.y, data.width, data.height)) {
fill.add(test.id);
}
}
fill.clear();
return fill;
}
示例4: getPoint
import com.artemis.utils.IntBag; //导入方法依赖的package包/类
static QuadTree getPoint(QuadTree tree, TestData data, IntBag fill) {
tree.get(fill, data.x, data.y);
fill.clear();
return tree;
}
示例5: getPointExact
import com.artemis.utils.IntBag; //导入方法依赖的package包/类
static QuadTree getPointExact(QuadTree tree, TestData data, IntBag fill) {
tree.getExact(fill, data.x, data.y);
fill.clear();
return tree;
}
示例6: get
import com.artemis.utils.IntBag; //导入方法依赖的package包/类
static QuadTree get(QuadTree tree, TestData data, IntBag fill) {
tree.get(fill, data.x, data.y, data.width, data.height);
fill.clear();
return tree;
}
示例7: getExact
import com.artemis.utils.IntBag; //导入方法依赖的package包/类
static QuadTree getExact(QuadTree tree, TestData data, IntBag fill) {
tree.getExact(fill, data.x, data.y, data.width, data.height);
fill.clear();
return tree;
}
示例8: get_inexact_test
import com.artemis.utils.IntBag; //导入方法依赖的package包/类
@Test
public void get_inexact_test() {
IntBag fill = new IntBag();
QuadTree.MAX_IN_BUCKET = 1;
QuadTree tree = new QuadTree(-8, -8, 8, 8);
fill.clear();
tree.get(fill, -2.5f, -2.5f, 5, 5);
Assert.assertEquals(fill.size(), 0);
tree.insert(1, -6, -6, 2, 2); // fully outside test region
fill.clear();
tree.get(fill, -2.5f, -2.5f, 5, 5);
Assert.assertEquals(fill.size(), 1);
tree.insert(2, 6, -6, 2, 2); // fully outside test region
tree.insert(3, -2, 2, 2, 2); // fully inside test region
tree.insert(4, 2, 2, 2, 2); // overlaps test region
tree.get(fill, -2.5f, -2.5f, 5, 5);
fill.clear();
tree.get(fill, -2.5f, -2.5f, 5, 5);
Assert.assertEquals(fill.size(), 4);
// move inside test region
tree.update(1, -2, -2, 2, 2);
fill.clear();
tree.get(fill, -2.5f, -2.5f, 5, 5);
Assert.assertEquals(fill.size(), 4);
// move outside test region
tree.update(1, -6, -6, 2, 2);
fill.clear();
tree.get(fill, -2.5f, -2.5f, 5, 5);
Assert.assertEquals(fill.size(), 4);
// remove from outside
tree.remove(1);
fill.clear();
tree.get(fill, -2.5f, -2.5f, 5, 5);
Assert.assertEquals(fill.size(), 3);
// remove overlapping
tree.remove(3);
fill.clear();
tree.get(fill, -2.5f, -2.5f, 5, 5);
Assert.assertEquals(fill.size(), 2);
// remove inside
tree.remove(4);
fill.clear();
tree.get(fill, -2.5f, -2.5f, 5, 5);
Assert.assertEquals(fill.size(), 1);
tree.remove(2);
fill.clear();
tree.get(fill, -2.5f, -2.5f, 5, 5);
Assert.assertEquals(fill.size(), 0);
}
示例9: get_exact_test
import com.artemis.utils.IntBag; //导入方法依赖的package包/类
@Test
public void get_exact_test() {
IntBag fill = new IntBag();
QuadTree.MAX_IN_BUCKET = 1;
QuadTree tree = new QuadTree(-8, -8, 8, 8);
fill.clear();
tree.getExact(fill, -2.5f, -2.5f, 5, 5);
Assert.assertEquals(fill.size(), 0);
tree.insert(1, -6, -6, 2, 2); // fully outside test region
fill.clear();
tree.getExact(fill, -2.5f, -2.5f, 5, 5);
Assert.assertEquals(fill.size(), 0);
tree.insert(2, 6, -6, 2, 2); // fully outside test region
tree.insert(3, -2, 2, 2, 2); // fully inside test region
tree.insert(4, 2, 2, 2, 2); // overlaps test region
tree.get(fill, -2.5f, -2.5f, 5, 5);
fill.clear();
tree.getExact(fill, -2.5f, -2.5f, 5, 5);
Assert.assertEquals(fill.size(), 2);
// move inside test region
tree.update(1, -2, -2, 2, 2);
fill.clear();
tree.getExact(fill, -2.5f, -2.5f, 5, 5);
Assert.assertEquals(fill.size(), 3);
// move outside test region
tree.update(1, -6, -6, 2, 2);
fill.clear();
tree.getExact(fill, -2.5f, -2.5f, 5, 5);
Assert.assertEquals(fill.size(), 2);
// remove from outside
tree.remove(1);
fill.clear();
tree.getExact(fill, -2.5f, -2.5f, 5, 5);
Assert.assertEquals(fill.size(), 2);
// remove overlapping
tree.remove(3);
fill.clear();
tree.getExact(fill, -2.5f, -2.5f, 5, 5);
Assert.assertEquals(fill.size(), 1);
// remove inside
tree.remove(4);
fill.clear();
tree.getExact(fill, -2.5f, -2.5f, 5, 5);
Assert.assertEquals(fill.size(), 0);
tree.remove(2);
fill.clear();
tree.getExact(fill, -2.5f, -2.5f, 5, 5);
Assert.assertEquals(fill.size(), 0);
}