org.khelekore.prtree
Class SimpleMBR

java.lang.Object
  extended by org.khelekore.prtree.SimpleMBR
All Implemented Interfaces:
MBR

public class SimpleMBR
extends Object
implements MBR

An implementation of MBRND that keeps a double array with the max and min values

Please note that you should not normally use this class when PRTree wants a MBR since this will actually use a lot of extra memory.


Constructor Summary
SimpleMBR(double... values)
          Create a new SimpleMBR using the given double values for max and min.
SimpleMBR(T t, MBRConverter<T> converter)
          Create a new SimpleMBR from a given object and a MBRConverter
 
Method Summary
 int getDimensions()
           
 double getMax(int axis)
          Get the maximum value for the given axis
 double getMin(int axis)
          Get the minimum value for the given axis
 boolean intersects(MBR other)
          Check if the other MBR intersects this one
<T> boolean
intersects(T t, MBRConverter<T> converter)
          Check if this MBR intersects the rectangle given by the object and the MBRConverter.
 String toString()
           
 MBR union(MBR mbr)
          Return a new MBR that is the union of this mbr and the other
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

SimpleMBR

public SimpleMBR(double... values)
Create a new SimpleMBR using the given double values for max and min. Note that the values should be stored as min, max, min, max.

Parameters:
values - the min and max values for each dimension.

SimpleMBR

public SimpleMBR(T t,
                 MBRConverter<T> converter)
Create a new SimpleMBR from a given object and a MBRConverter

Parameters:
t - the object to create the bounding box for
converter - the actual MBRConverter to use
Method Detail

getDimensions

public int getDimensions()
Specified by:
getDimensions in interface MBR
Returns:
the number of dimensions this bounding box has

getMin

public double getMin(int axis)
Description copied from interface: MBR
Get the minimum value for the given axis

Specified by:
getMin in interface MBR
Parameters:
axis - the axis to use
Returns:
the min value

getMax

public double getMax(int axis)
Description copied from interface: MBR
Get the maximum value for the given axis

Specified by:
getMax in interface MBR
Parameters:
axis - the axis to use
Returns:
the x max value

union

public MBR union(MBR mbr)
Description copied from interface: MBR
Return a new MBR that is the union of this mbr and the other

Specified by:
union in interface MBR
Parameters:
mbr - the MBR to create a union with
Returns:
the new MBR

intersects

public boolean intersects(MBR other)
Description copied from interface: MBR
Check if the other MBR intersects this one

Specified by:
intersects in interface MBR
Parameters:
other - the MBR to check against
Returns:
true if the given MBR intersects with this MBR

intersects

public <T> boolean intersects(T t,
                              MBRConverter<T> converter)
Description copied from interface: MBR
Check if this MBR intersects the rectangle given by the object and the MBRConverter.

Specified by:
intersects in interface MBR
Type Parameters:
T - the object type
Parameters:
t - a rectangular object
converter - the MBRConverter
Returns:
true if the given MBR intersects with the given object

toString

public String toString()
Overrides:
toString in class Object