RangeQueryTest - /* * TITLE: COMP202 PA4 * *...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
/* * TITLE: COMP202 PA4 * * @(#)RangeQueryTest 2009/04/10 * @author Attila Gursoy * * Copyright (c) 2009 Attila Gursoy * All Rights Reserved. */ package pa4; import java.io.FileReader; import java.io.BufferedReader; import java.io.IOException; import java.util.StringTokenizer; import java.util.List; public class RangeQueryTest { public static void main( String [ ] args ) { FileReader theFile; BufferedReader fileIn; RangeSearch2D<Double,Double> twoDdata; String oneLine; StringTokenizer str; int nPoints=0; double x; double y; twoDdata = new TwoDRangeSearchList<Double,Double>(); RangeSearch2D.Pair<Double,Double> p; try { theFile = new FileReader("p8K.dat"); fileIn = new BufferedReader(theFile); oneLine = fileIn.readLine(); while ( oneLine != null) { str = new StringTokenizer(oneLine); x = Double.parseDouble(str.nextToken()); y = Double.parseDouble(str.nextToken()); p = twoDdata.makePair(x, y); if ( twoDdata.insert(p) ) nPoints++; oneLine = fileIn.readLine(); } } catch (IOException e) { System.out.println(e);}
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 2

RangeQueryTest - /* * TITLE: COMP202 PA4 * *...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online