package gui.simulator;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.Iterator;

public class WalkingPathArrayList extends ArrayList<WalkingPath> implements Serializable{
	public WalkingPathArrayList getWalkingPadType(SimulatorPane.Objects type){
		WalkingPathArrayList returnlist = new WalkingPathArrayList();
		for(WalkingPath wp:this){
			if(wp.getObject1().type == type || wp.getObject2().type == type){
				returnlist.add(wp);
			}
		}
		return returnlist;
	}
	public WalkingPathArrayList getWalkingPadObject(DrawEngine object){
		WalkingPathArrayList returnlist = new WalkingPathArrayList();
		for(WalkingPath wp:this){
			if(wp.getObject1() == object|| wp.getObject2() == object){
				returnlist.add(wp);
			}
		}
		return returnlist;
	}
	public void removeType(DrawEngine object, SimulatorPane.Objects type){
		Iterator<WalkingPath> i = this.iterator();
		while(i.hasNext()){
			WalkingPath path = i.next();
			if(path.getObject1() == object){
				if(path.getObject2().type == type){
					i.remove();
				}
			}else{
				if(path.getObject1().type == type){
					i.remove();
				}
			}
		}
	}
}
