private boolean limitReached ( Rectangular gp , Rectangular limit , short required ) { switch ( required ) { case REQ_HORIZONTAL : return gp . getX1 ( ) <= limit . getX1 ( ) && gp . getX2 ( ) >= limit . getX2 ( ) ; case REQ_VERTICAL : return gp . getY1 ( ) <= limit . getY1 ( ) && gp . getY2 ( ) >= limit . getY2 ( ) ; case REQ_BOTH : return gp . getX1 ( ) <= limit . getX1 ( ) && gp . getX2 ( ) >= limit . getX2 ( ) && gp . getY1 ( ) <= limit . getY1 ( ) && gp . getY2 ( ) >= limit . getY2 ( ) ; } return false ; }
Checks if the grid bounds have reached a specified limit in the specified direction .