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
-
data
-
-
done
-
-
fileName
-
-
progressBar
-
-
FileIO(String)
-
The constructor FileIO requires a string of a fileName containing the
data file.
-
extractData()
-
This method, extractData, performs the extraction of the data into a Data
object.
-
getFileName()
-
This method, getFileName, returns the string value of fileName.
-
run()
-
The run method is the one that is called when a new thread is started with
this class.
-
setFileName(String)
-
This method, setFileName, sets the protected String variable fileName.
-
setProgressBar(JProgressBar)
-
This function takes a JProgressBar as an argument.
fileName
protected String fileName
progressBar
protected JProgressBar progressBar
data
protected Data data
done
protected boolean done
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.
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
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.
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.
getFileName
public String getFileName()
- This method, getFileName, returns the string value of fileName.
- Returns:
- fileName name of the file accessed by extractData
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