edu.psu.geovista.app.parvis.file
Class STFFile

java.lang.Object
  extended byedu.psu.geovista.app.parvis.model.SimpleParallelSpaceModel
      extended byedu.psu.geovista.app.parvis.file.STFFile
All Implemented Interfaces:
ParallelSpaceModel

public class STFFile
extends SimpleParallelSpaceModel

A Simple file parser for reading STF (Simple Table Fomrat) files from URLs. The STF File format is defined as follows:

# test.stf
# Comments have # in the first column.
# Type the number of fields, on a line by itself.
3
# Then type field names and types. Field names must not contain
# spaces.
#
PersonName     String
Age            Integer
HourlyWage     Real
#
# Data type is case-insensitive.
# Default data delimiters are tabs and spaces.
# Here's the data, tab-delimited. Notice that the data columns are
# in the order they are listed above.
#
Joe            23      5.75
Mary           18      4.75
Fred           54      100.00
Ginger         48      100.00
#
# Nothing special is required to end the file.

Once the file is read and parsed, the data can be accessed with the methods defined in the ParallelSpaceModel interface.

Version:
0.1
Author:
Flo Ledermann flo@subnet.at

Field Summary
 
Fields inherited from class edu.psu.geovista.app.parvis.model.SimpleParallelSpaceModel
axisLabels, listeners, numDimensions, recordLabels, valueLabels, values
 
Constructor Summary
STFFile(java.net.URL url)
          Creates a new STFFile with the given url.
 
Method Summary
 void addProgressListener(ProgressListener l)
           
 void fireProgressEvent(ProgressEvent e)
           
static void main(java.lang.String[] args)
          Main method for testing purposes.
 void readContents()
          Reads the contents of the file and exposes them vis the ParallelSpaceModel interface of the class.
protected  void readData(java.io.Reader in)
          Reads the data lines.
protected  void readFirstLine(java.io.Reader in)
          Reads the first data line of the file and sets up the number of dimensions.
protected  void readHeaderLines(java.io.Reader in)
          Reads the header lines and sets up the variable types.
protected  java.lang.String readLine(java.io.Reader in)
          Reads on line, skipping comments and empty lines.
 void removeProgressListener(ProgressListener l)
           
 
Methods inherited from class edu.psu.geovista.app.parvis.model.SimpleParallelSpaceModel
addChangeListener, addRecord, addRecord, getAxisLabel, getMaxValue, getMinValue, getNumDimensions, getNumRecords, getRecordLabel, getValue, getValueLabel, getValueLabels, getValues, initNumDimensions, removeChangeListener, setAxisLabel, setAxisLabels, setValueLabel, setValueLabels
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

STFFile

public STFFile(java.net.URL url)
Creates a new STFFile with the given url. The content is not read until readContents() is called.

Parameters:
url - The url of the file to read.
Method Detail

readContents

public void readContents()
                  throws java.io.IOException
Reads the contents of the file and exposes them vis the ParallelSpaceModel interface of the class. String values are stripped out of the model and set as record labels.

Throws:
java.io.IOException

readFirstLine

protected void readFirstLine(java.io.Reader in)
                      throws java.io.IOException
Reads the first data line of the file and sets up the number of dimensions.

Throws:
java.io.IOException

readHeaderLines

protected void readHeaderLines(java.io.Reader in)
                        throws java.io.IOException
Reads the header lines and sets up the variable types.

Throws:
java.io.IOException

readData

protected void readData(java.io.Reader in)
                 throws java.io.IOException
Reads the data lines.

Throws:
java.io.IOException

readLine

protected java.lang.String readLine(java.io.Reader in)
                             throws java.io.IOException
Reads on line, skipping comments and empty lines.

Throws:
java.io.IOException

addProgressListener

public void addProgressListener(ProgressListener l)

removeProgressListener

public void removeProgressListener(ProgressListener l)

fireProgressEvent

public void fireProgressEvent(ProgressEvent e)

main

public static void main(java.lang.String[] args)
Main method for testing purposes.



Copyright © 1996-2003 GeoVista Center. All Rights Reserved.