boidslist.java
来自「java3D game engine design of the source 」· Java 代码 · 共 39 行
JAVA
39 行
// BoidsList.java
// Andrew Davison, April 2005, ad@fivedots.coe.psu.ac.th
// Sirinart Sakarin, March 2003, s4210315@calvin.coe.psu.ac.th
/* An ArrayList for boids.
The methods are synchronized so that boid removal cannot
affect the retrieval of a reference to a boid.
*/
import java.util.*;
public class BoidsList extends ArrayList
{
public BoidsList(int num)
{ super(num); }
synchronized public Boid getBoid(int i)
// return the boid if it is visible; null otherwise
{
if (i < super.size())
return (Boid)get(i);
return null;
}
synchronized public boolean removeBoid(int i)
// attempt to remove the i'th boid
{ if (i < super.size()) {
super.remove(i);
return true;
}
return false;
}
} // end of BoidsList class
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?