import java.util.ArrayList;

public class Gridlist {
	
	protected ArrayList<Position> poso = new ArrayList<Position>();
	
	public Gridlist(){
		poso = new ArrayList<Position>();
	}
	
	public ArrayList<Position> getList(){
		return poso;
	}
	
	public void add(Position e){
		poso.add(e);
	}
	
	public boolean contains(Position e){
		if(poso.contains(e)){
			return true;
		} else{
			return false;
		}	
	}
	
	public Position get(int i){
		return poso.get(i);
	}
		
	public void remove(Position e){
		poso.remove(e);
	}
	
	public void remove(int e){
		poso.remove(e);
	}
	
	public int length(){
		return this.getList().size();
	}

	public int count(Position pos) {
		int zahler=0;
		ArrayList<Position> poso = this.getList();
		for(int i=0;i<this.length();i++){
			if(poso.get(i).equal(pos)==true){
				zahler++;
			}
		}
		return zahler;
	}

	public int count(Position[] poslist) {
		int zahler=0;
		ArrayList<Position> poso = this.getList();
		for(int i=0;i<this.length();i++){
			for(int j=0;j<poslist.length ;j++){
				if(poso.get(i).equal(poslist[j])==true){
					zahler++;
				}
			}
		}
		return zahler;
	}
	
}
