📄 boidslist.java
字号:
// 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 + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -