30 lines
520 B
Plaintext
30 lines
520 B
Plaintext
|
class Obstacles{
|
||
|
ArrayList<Obstacle> obs;
|
||
|
|
||
|
//constructor
|
||
|
Obstacles(){
|
||
|
obs=new ArrayList<Obstacle>();
|
||
|
}
|
||
|
|
||
|
//add obstacle
|
||
|
void add(Obstacle o){
|
||
|
obs.add(o);
|
||
|
}
|
||
|
|
||
|
//check intersection
|
||
|
boolean isIntersecting(Dot dot){
|
||
|
for(int i=0; i<obs.size(); i++){
|
||
|
if(obs.get(i).isIntersecting(dot)){
|
||
|
return true;
|
||
|
}
|
||
|
}
|
||
|
return false;
|
||
|
}
|
||
|
|
||
|
//display all
|
||
|
void display(){
|
||
|
for(int i=0; i<obs.size(); i++){
|
||
|
obs.get(i).display();
|
||
|
}
|
||
|
}
|
||
|
}
|