home *** CD-ROM | disk | FTP | other *** search
-
- package sub_arctic.lib;
-
- import java.awt.Rectangle;
-
- /**
- * An interface_pred predicate class that tests whether an object's bound
- * overlaps a given Rectangle (expressed in the object's coordinates).
- * The "parameters" object passed to the test() method must be a Rectangle.
- * This is designed for use with the traversal mechanism of
- * base_interactor.traverse_and_collect().
- *
- * @see sub_arctic.lib.base_interactor#traverse_and_collect
- * @author Scott Hudson
- */
- public class rect_bound_overlap implements interactor_pred {
-
- /** Perform the predicate test.
- *
- * @param obj the interactor the predicate is testing.
- * @param parameters a Rectangle object containing the rectangle we are
- * testing against in the local coordinates of the object.
- * @return predicate result.
- */
- public boolean test(interactor obj, Object parameters)
- {
- /* type check the parameters */
- if (!(parameters instanceof Rectangle))
- throw new sub_arctic_error("Non-Rectangle object passed a parameter");
-
- /* do the test */
- Rectangle r = (Rectangle)parameters;
- return r.intersects(new Rectangle(0,0, obj.w(),obj.h()));
- }
-
- //had:
- //* @exception sub_arctic.exception.bad_value thrown if the parameters
- //* parameter is not a Rectangle.
-
- }
- /*=========================== COPYRIGHT NOTICE ===========================
-
- This file is part of the subArctic user interface toolkit.
-
- Copyright (c) 1996 Scott Hudson and Ian Smith
- All rights reserved.
-
- The subArctic system is freely available for most uses under the terms
- and conditions described in
- http://www.cc.gatech.edu/gvu/ui/sub_arctic/sub_arctic/doc/usage.html
- and appearing in full in the lib/interactor.java source file.
-
- The current release and additional information about this software can be
- found starting at: http://www.cc.gatech.edu/gvu/ui/sub_arctic/
-
- ========================================================================*/
-