Package org.khelekore.prtree
Class SimpleMBR
- java.lang.Object
-
- org.khelekore.prtree.SimpleMBR
-
- All Implemented Interfaces:
Serializable,MBR
public class SimpleMBR extends Object implements MBR
An implementation of MBRND that keeps a double array with the max and min valuesPlease note that you should not normally use this class when PRTree wants a MBR since this will actually use a lot of extra memory.
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description 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
All Methods Instance Methods Concrete Methods Modifier and Type Method Description intgetDimensions()doublegetMax(int axis)Get the maximum value for the given axisdoublegetMin(int axis)Get the minimum value for the given axisbooleanintersects(MBR other)Check if the other MBR intersects this one<T> booleanintersects(T t, MBRConverter<T> converter)Check if this MBR intersects the rectangle given by the object and the MBRConverter.StringtoString()MBRunion(MBR mbr)Return a new MBR that is the union of this mbr and the other
-
-
-
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- Type Parameters:
T- The type of object being indexed- Parameters:
t- the object to create the bounding box forconverter- the actual MBRConverter to use
-
-
Method Detail
-
getDimensions
public int getDimensions()
- Specified by:
getDimensionsin interfaceMBR- Returns:
- the number of dimensions this bounding box has
-
getMin
public double getMin(int axis)
Description copied from interface:MBRGet the minimum value for the given axis
-
getMax
public double getMax(int axis)
Description copied from interface:MBRGet the maximum value for the given axis
-
union
public MBR union(MBR mbr)
Description copied from interface:MBRReturn a new MBR that is the union of this mbr and the other
-
intersects
public boolean intersects(MBR other)
Description copied from interface:MBRCheck if the other MBR intersects this one- Specified by:
intersectsin interfaceMBR- 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:MBRCheck if this MBR intersects the rectangle given by the object and the MBRConverter.- Specified by:
intersectsin interfaceMBR- Type Parameters:
T- the object type- Parameters:
t- a rectangular objectconverter- the MBRConverter- Returns:
- true if the given MBR intersects with the given object
-
-