public abstract class AndmeYksus{ String nimetus; int x, y; final int d=10; public AndmeYksus leiaYksus(int hx, int hy){ if(kasIseAsukohal(hx, hy)){return this;} for(AndmeYksus ay: kysiAlanejad()){ if(ay.leiaYksus(hx, hy)!=null){ return ay.leiaYksus(hx, hy); } } return null; } public java.util.List kysiAlanejad(){ return new java.util.ArrayList(); } public boolean kasIseAsukohal(int hx, int hy){ return (hx>x && hxy && hy