All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class edu.wpi.mqp.graphics.jviz.FileIO

java.lang.Object
   |
   +----edu.wpi.mqp.graphics.jviz.FileIO

public class FileIO
extends Object
implements Runnable
The FileIO class takes a filename as an argument. The class controls how the data in the file gets placed into a data object. If a new file format was needed, a new class would have to be defined with the same methods implementeded in this class, but with a modified extractData method which would extract the data needed in the Data class.

Version:
1.0, created 21 OCT 1997
Author:
Matthew C. Jucius

Variable Index

 o data
 o done
 o fileName
 o progressBar

Constructor Index

 o FileIO(String)
The constructor FileIO requires a string of a fileName containing the data file.

Method Index

 o extractData()
This method, extractData, performs the extraction of the data into a Data object.
 o getFileName()
This method, getFileName, returns the string value of fileName.
 o run()
The run method is the one that is called when a new thread is started with this class.
 o setFileName(String)
This method, setFileName, sets the protected String variable fileName.
 o setProgressBar(JProgressBar)
This function takes a JProgressBar as an argument.

Variables

 o fileName
 protected String fileName
 o progressBar
 protected JProgressBar progressBar
 o data
 protected Data data
 o done
 protected boolean done

Constructors

 o FileIO
 public FileIO(String newFilename)
The constructor FileIO requires a string of a fileName containing the data file.

Parameters:
newFileName - name of the file containing the data.

Methods

 o extractData
 public Data extractData()
This method, extractData, performs the extraction of the data into a Data object. It returns that data object. Currently this method starts the extraction in a new thread, then waits for the thread to finish, and then returns. It essentially calls the run method the way it is currently implemented. There may be a better way to utilize threading in the object Threading currently does not provide any benefits.

Returns:
NULL if data in the file is corrupt in any way; Otherwise return a Data object
 o run
 public void run()
The run method is the one that is called when a new thread is started with this class. Its presence is required since this method implements the Runnable interface.

 o setFileName
 public boolean setFileName(String newFileName)
This method, setFileName, sets the protected String variable fileName.

Parameters:
newFileName - the name of the new file to read from
Returns:
true name was set successfully; false error encountered wile setting name.
 o getFileName
 public String getFileName()
This method, getFileName, returns the string value of fileName.

Returns:
fileName name of the file accessed by extractData
 o setProgressBar
 public boolean setProgressBar(JProgressBar newProgressBar)
This function takes a JProgressBar as an argument. It will display the status using that bar. This will make things more "entertaining" while the user has to wait.

Parameters:
newProgressBar - progress bar component to use
Returns:
true if progressBar set correctly; false error setting progressBar

All Packages  Class Hierarchy  This Package  Previous  Next  Index