gishur.core.geom
Class Intersection

java.lang.Object
  |
  +--gishur.core.geom.Intersection
Direct Known Subclasses:
Intersection

public class Intersection
extends java.lang.Object

Basic intersection class. By constructing this class with two objects the intersection of these objects will be calculated, if one of them implements intersectable. The constucted object represents the intersection set. This could be empty, a single object or a list of objects. A set of methods allow access to all intersection objects.

No support for arrays or lists or otherwise intersection of more than two objects is supported at this level.

Version:
1.0
Author:
Thomas Wolf

Constructor Summary
Intersection()
          Constructs an empty Intersection.
Intersection(int mode, java.lang.Object o1, java.lang.Object o2)
          Constructs an Intersection object through calculating the intersection of the two given objects.
Intersection(java.lang.Object o1, java.lang.Object o2)
          Constructs an Intersection object through calculating the intersection of the two given objects.
 
Method Summary
 boolean empty()
          Tests, if the intersection set is empty.
 java.lang.Object[] getObjectArray()
          Returns all intersection objects stored in an array.
 SimpleList getObjectList()
          Returns all intersection objects stored in a gishur.core.SimpleList
 int length()
          Returns the quantity of the intersection objects.
 java.lang.Object object()
          Returns the (first) intersection object.
 java.lang.Object object(int i)
          Returns the i-th object in the intersection set. if no such objects exits, null will be returned.
 boolean single()
          Tests, if the intersection consists of one single object.
 java.lang.String toString()
          Returns a string representation of the object.
 java.lang.Class type()
          Returns the Class object representing the class of the (first) intersection object.
 java.lang.Class type(int i)
          Returns the Class-object representing the class of the i-th intersection object.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Intersection

public Intersection()
Constructs an empty Intersection.

Intersection

public Intersection(int mode,
                    java.lang.Object o1,
                    java.lang.Object o2)
Constructs an Intersection object through calculating the intersection of the two given objects. The calculation is only possible, if at least one of the objects implements Intersectable and if that object supports the intersection with the other object. In all other cases an IntersectionException will be thrown.
Parameters:
mode - used intersection mode
o1,o2 - intersecting Objects
Throws:
IntersectionException -  

Intersection

public Intersection(java.lang.Object o1,
                    java.lang.Object o2)
Constructs an Intersection object through calculating the intersection of the two given objects. The calculation is only possible, if at least one of the objects implements Intersectable and if that object supports the intersection with the other object. In all other cases an IntersectionException will be thrown.
Parameters:
o1,o2 - intersecting Objects
Throws:
IntersectionException -  
Method Detail

length

public int length()
Returns the quantity of the intersection objects.
Returns:
number of intersection objects

empty

public boolean empty()
Tests, if the intersection set is empty.
Returns:
true, if length()==0.

single

public boolean single()
Tests, if the intersection consists of one single object.
Returns:
true, if length()==1.

object

public java.lang.Object object(int i)
Returns the i-th object in the intersection set. if no such objects exits, null will be returned.
Parameters:
i - index of the requested intersection object
Returns:
i-th intersection object or null

object

public java.lang.Object object()
Returns the (first) intersection object.
Returns:
first intersection object
See Also:
object(int)

type

public java.lang.Class type(int i)
Returns the Class-object representing the class of the i-th intersection object.
Parameters:
i - index of the requested intersection object
Returns:
Class-object of the i-th intersection object

type

public java.lang.Class type()
Returns the Class object representing the class of the (first) intersection object.
Returns:
Class-object of the (first) intersection object

getObjectArray

public java.lang.Object[] getObjectArray()
Returns all intersection objects stored in an array.
Returns:
array of intersection objects

getObjectList

public SimpleList getObjectList()
Returns all intersection objects stored in a gishur.core.SimpleList
Returns:
list of all intersection objects

toString

public java.lang.String toString()
Returns a string representation of the object.
Overrides:
toString in class java.lang.Object
Returns:
a string representation of the object.