⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 boidslist.java

📁 java3D game engine design of the source [three-dimensionalvirtualrealitynetworkprogram] - "virtual
💻 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 + -