/* $Id: ImageSearchFilterTypeAImpl.java 775 2013-10-08 06:14:38Z shayashi $ */
package smart_gs.dictionary.image;

import java.awt.Rectangle;

public class ImageSearchFilterTypeAImpl extends ImageSearchFilterImpl{

	/**
	 * 判定処理
	 * 
	 */
	@Override
	public boolean contains(Rectangle a,Rectangle b){
		int w = a.width;
		int h = a.height;
		int W = b.width;
		int H = b.height;
		
		if ((w | h | W | H) < 0) {
		    return false;
		}
		
		int x  = 0;
		int x2 = 0; 
		int X  = 0;
		int X2 = 0;
		int y  = 0;
		int y2 = 0; 
		int Y  = 0;
		int Y2 = 0;
		
		if(a.x < b.x){
			x  = a.x;
			x2 = a.x + a.width;
			X  = b.x;
			X2 = b.x + b.width; 

			y  = a.y;
			y2 = a.y + a.height;
			Y  = b.y;
			Y2 = b.y + b.height; 
		}else{
			X  = a.x;
			X2 = a.x + a.width;
			x  = b.x;
			x2 = b.x + b.width; 

			Y  = a.y;
			Y2 = a.y + a.height;
			y  = b.y;
			y2 = b.y + b.height; 
		}

		if(X < x2 && x < X){
			if(Y < y2 && y < Y){
				return true;
			}
		}
		return false;
	}

}
