pl/mbogusz3/invaders/model/Enemy.java
/**
	 * Check whether border (i.e. first or last) column is empty and if so modify indices accordingly.
	 * @param column index of column to check.
	 */
Check whether border  column is empty and if so modify indices accordingly.
@param column index of column to check.
Check whether border column is empty and if so modify indices accordingly . @param column index of column to check .
private void checkBorderColumn(int column) {
		if(column != this.firstColumn && column != this.lastColumn) {
			return;
		}
		boolean anyLeft = false;
		for(int i = 0; i <= this.firstRow; i++) {
			if(this.state[i][column]) {
				anyLeft = true;
				break;
			}
		}
		if(!anyLeft) {
			if(column == this.firstColumn) {
				this.firstColumn++;
				this.positionLeft += this.unitWidth;
				if(this.firstColumn <= this.lastColumn) {
					this.checkBorderColumn(column + 1);
				}
			} else {
				this.lastColumn--;
				this.positionLeft -= this.unitWidth;
				if(this.firstColumn <= this.lastColumn) {
					this.checkBorderColumn(column - 1);
				}
			}
		}
	}
private void checkBorderColumn ( int column ) { if ( column != this . firstColumn && column != this . lastColumn ) { return ; } boolean anyLeft = false ; for ( int i = 0 ; i <= this . firstRow ; i ++ ) { if ( this . state [ i ] [ column ] ) { anyLeft = true ; break ; } } if ( ! anyLeft ) { if ( column == this . firstColumn ) { this . firstColumn ++ ; this . positionLeft += this . unitWidth ; if ( this . firstColumn <= this . lastColumn ) { this . checkBorderColumn ( column + 1 ) ; } } else { this . lastColumn -- ; this . positionLeft -= this . unitWidth ; if ( this . firstColumn <= this . lastColumn ) { this . checkBorderColumn ( column - 1 ) ; } } } }
Check whether border (i.e.
Check whether border ( i . e .