public abstract class Schiff { public int laenge; public char repr = '?'; public Schiff(int schiffLaenge) { laenge = schiffLaenge; } public char repr() { return this.repr; } public boolean insertToMap(int x, int y, Feld map, char orientation) { if (orientation == '>') { for (int i = 0; i < this.laenge; i++){ if (!map.insertShip(this, x+i, y)) { return false; } } return true; } else if (orientation == '<') { for (int i = 0; i < this.laenge; i++){ if (!map.insertShip(this, x-i, y)) { return false; } } return true; } else if (orientation == 'v') { for (int i = 0; i < this.laenge; i++){ if (!map.insertShip(this, x, y+i)) { return false; } } return true; } else if (orientation == '|') { for (int i = 0; i < this.laenge; i++){ if (!map.insertShip(this, x, y-i)) { return false; } } return true; } return false; } public Schiff() { } }