rangesearch.test
Class BruteForceTest

java.lang.Object
  extended byjunit.framework.Assert
      extended byjunit.framework.TestCase
          extended byrangesearch.test.RangeSearch2DUtil
              extended byrangesearch.test.BruteForceTest
All Implemented Interfaces:
junit.framework.Test

public class BruteForceTest
extends rangesearch.test.RangeSearch2DUtil

A class for testing BruteForceRangeSearchImpl with several hand built examples.


Constructor Summary
BruteForceTest(java.lang.String name)
           
 
Method Summary
protected  Point2DIterator buildPointSequence(int[] coords)
          Converts a sequence of points and returns them in the iterator used within the Range* classes
protected  jdsl.geomobj.api.Rectangle2D buildRect(int x1, int y1, int x2, int y2)
          A method to create a rectangle (for a query, ie.)
protected  void checkQuery(RangeSearch2D rs, jdsl.geomobj.api.Rectangle2D r, java.lang.String s)
          A method to compare the output of a range search with the expected.
 void testSquare()
          Initializes an instance of BruteForceRangeSearch2D with some hand picked points and tests these over several hand built query rectangles.
 
Methods inherited from class junit.framework.TestCase
countTestCases, createResult, getName, name, run, run, runBare, runTest, setName, setUp, tearDown, toString
 
Methods inherited from class junit.framework.Assert
assert, assert, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertNotNull, assertNotNull, assertNull, assertNull, assertSame, assertSame, assertTrue, assertTrue, fail, fail
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

BruteForceTest

public BruteForceTest(java.lang.String name)
Method Detail

testSquare

public void testSquare()
Initializes an instance of BruteForceRangeSearch2D with some hand picked points and tests these over several hand built query rectangles.


checkQuery

protected void checkQuery(RangeSearch2D rs,
                          jdsl.geomobj.api.Rectangle2D r,
                          java.lang.String s)
A method to compare the output of a range search with the expected.

Parameters:
rs - an instance of the rangesearch
r - a query rectangle
s - a string containing the properly formatted result that is expeceted.

buildPointSequence

protected Point2DIterator buildPointSequence(int[] coords)
Converts a sequence of points and returns them in the iterator used within the Range* classes

Parameters:
coords - an array with twice the entries as the number of points of the form [x1,y1,x2,y2,...]

buildRect

protected jdsl.geomobj.api.Rectangle2D buildRect(int x1,
                                                 int y1,
                                                 int x2,
                                                 int y2)
A method to create a rectangle (for a query, ie.)

Parameters:
x1 - the x coordinate of the lower lefthand corner of the query rectangle
y1 - the y coordinate of the lower lefthand corner of the query rectangle
x2 - the x coordinate of the upper righthand corner of the query rectangle
y2 - the y coordinate of the upper righthand corner of the query rectangle