Class A1Driver

java.lang.Object
  |
  +--A1Driver

public class A1Driver
extends java.lang.Object

A user interface to drive the Space and Point classes. This implementation does not include the full user interface as specified in the assignment handout. It includes the methods that were required to be implemented. A1Driver is used by A1Test to perform some tests on the program.


Constructor Summary
A1Driver()
           
 
Method Summary
 void get(int i)
          Print the point at position i in the collection ordered by the current view point.
 void initSpace()
          Create and initialize the space object
 void load(java.lang.String filename)
          Load the points defined from the file filename into the collection
static void main(java.lang.String[] args)
           
 void printSpace()
          Print the collection of points from the space in the order of a point's distance from the view point.
 void readPoint()
          Prompt for and read a point from the keyboard, and add it to the space.
 void readViewPoint()
          Prompt for and read a point from the keyboard.
 void samePlane(int k)
          Print the list of points that are in the same kth plane as the view point.
 void write(java.lang.String filename)
          Write the collection of points into a file in the same format as the input file.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

A1Driver

public A1Driver()
Method Detail

main

public static void main(java.lang.String[] args)
                 throws java.io.IOException
java.io.IOException

load

public void load(java.lang.String filename)
          throws java.io.IOException
Load the points defined from the file filename into the collection

Parameters:
filename - Name of the file containing the list of points. File format: One point per line in the order of the dimensions (x, y, z). Assumption: The file is correctly formatted.
java.io.IOException

write

public void write(java.lang.String filename)
           throws java.io.IOException
Write the collection of points into a file in the same format as the input file.

Parameters:
filename - Name of file to be written. The file will be overwritten if it already exists.
java.io.IOException

readPoint

public void readPoint()
               throws java.io.IOException
Prompt for and read a point from the keyboard, and add it to the space.

java.io.IOException

readViewPoint

public void readViewPoint()
                   throws java.io.IOException
Prompt for and read a point from the keyboard. This point will become the new view point.

java.io.IOException

get

public void get(int i)
Print the point at position i in the collection ordered by the current view point.

Parameters:
i - The position of the point to retrieve.

printSpace

public void printSpace()
Print the collection of points from the space in the order of a point's distance from the view point.


samePlane

public void samePlane(int k)
Print the list of points that are in the same kth plane as the view point. We assume that x is dimension 0, y is dimension 1, and z is dimension 2.

Parameters:
k - Index of the plane to report on

initSpace

public void initSpace()
Create and initialize the space object