gishur.core.geom
Interface Intersectable

All Known Subinterfaces:
Intersectable

public interface Intersectable

This interface should be implemented by all classes, that support intersections with other objects. Per supportIntersection(int, java.lang.Object) one should determine, if this object supports the intersection with the given object (under the specified mode). intersection(int, java.lang.Object) calculates the intersection and returns a single intersection object or an array / list of intersection objects.

Version:
1.0
Author:
Thomas Wolf

Field Summary
static int DEFAULT
          Default intersection mode
 
Method Summary
 java.lang.Object intersection(int mode, java.lang.Object o)
          Calculates the intersection between this object and the given object o.
 boolean supportIntersection(int mode, java.lang.Object o)
          Returns true, if this class (or object) provides intersection with the given object o.
 

Field Detail

DEFAULT

public static final int DEFAULT
Default intersection mode
Method Detail

supportIntersection

public boolean supportIntersection(int mode,
                                   java.lang.Object o)
Returns true, if this class (or object) provides intersection with the given object o. It should only return true, if this class provides an intersection metod itself.
Parameters:
mode - intersection mode
o - object for intersection
Returns:
true, if intersection is supported

intersection

public java.lang.Object intersection(int mode,
                                     java.lang.Object o)
Calculates the intersection between this object and the given object o. This method should not be called directly, rather construct an Intersection object (it will call this method). The returned Object is either a single intersection object or an array or a list (based upon BasicList) of intersection objects.

This method does not verify, if the intersection with o can be calculated (use supportIntersection(int, java.lang.Object) instead), but throws an IntersectionException, if an error occures. This means, it may be that supportIntersection(int, java.lang.Object) returns true and this method does not throw an exception and returns with a (propably wrong) result.

The resulted objects are always newly created and do not point to existing objects.

Parameters:
mode - intersection mode
o - object for intersection
Returns:
intersection object(s)
Throws:
IntersectionException - if an error occured