public boolean contains ( int left , int top , int right , int bottom ) { // check for empty first return this . left < this . right && this . top < this . bottom // now check for containment && this . left <= left && this . top <= top && this . right >= right && this . bottom >= bottom ; }
Returns true iff the 4 specified sides of a rectangle are inside or equal to this rectangle . i . e . is this rectangle a superset of the specified rectangle . An empty rectangle never contains another rectangle .