public void rotateCCW ( GridInfo grid ) { cornerList . clear ( ) ; for ( int col = 0 ; col < grid . cols ; col ++ ) { for ( int row = 0 ; row < grid . rows ; row ++ ) { cornerList . add ( grid . get ( row , grid . cols - col - 1 ) ) ; } } int tmp = grid . rows ; grid . rows = grid . cols ; grid . cols = tmp ; grid . nodes . clear ( ) ; grid . nodes . addAll ( cornerList ) ; }
Rotates the grid in the CCW direction