edu.swri.swiftvis.sources
Class GeneralData

java.lang.Object
  extended by edu.swri.swiftvis.sources.AbstractSource
      extended by edu.swri.swiftvis.sources.GeneralData
All Implemented Interfaces:
DataSource, GraphElement, java.io.Serializable

public class GeneralData
extends AbstractSource

This class is a data source that can be used to load in almost any type of data file, whether it is text or binary in format.

Author:
Mark Lewis
See Also:
Serialized Form

Field Summary
private  boolean binary
           
private  java.awt.Rectangle bounds
           
private  java.io.BufferedReader br
           
private  java.io.File dataFile
           
private  java.lang.String format
           
private  int maxAllowed
           
private  int numParameters
           
private  int numValues
           
private  int offset
           
private  java.util.Vector<java.lang.String> parameterDescription
           
private  int readType
           
private static long serialVersionUID
           
private  SpecialFormatReader sfr
           
private static int SPECIAL_TYPE
           
private static int TEXT_TYPE
           
private  int totalElements
           
private  java.util.Vector<java.lang.String> valueDescription
           
 
Fields inherited from class edu.swri.swiftvis.sources.AbstractSource
dataVect, propPanel, sinkVector
 
Constructor Summary
  GeneralData()
           
private GeneralData(GeneralData c, java.util.List<GraphElement> l)
           
 
Method Summary
 GeneralData copy(java.util.List<GraphElement> l)
           
 java.lang.String getDescription()
           
 DataElement getElement(int i)
          Returns the specified data element for this source.
 int getNumElements()
          Returns the number of data elements that this source has in it.
 int getNumParameters()
           
 int getNumValues()
           
 java.lang.String getParameterDescription(int which)
          Tells you what a particular parameter is used for.
 java.lang.String getParameterName(int which, int paramVal)
          Tells you the text that should be used to describe a particular value of a given parameter.
static java.lang.String getTypeDescription()
           
 java.lang.String getValueDescription(int which)
          Tells you what a particular value is used for.
private  void readFile()
           
private  void readSpecial()
           
private  void readText()
           
private  DataElement readTextLine()
           
protected  void redoAllElements()
           
private  void redoBufferSpecial(int elemNum)
           
private  void redoBufferText(int elemNum)
           
private  void selectFile()
           
 void setParameterDescription(int which, java.lang.String desc)
           
protected  void setupSpecificPanelProperties()
           
 void setValueDescription(int which, java.lang.String desc)
           
 void specialFormatReset()
          This method is called by the SpecialFormatReader if it tries to read something when the stream it is pulling from is null.
 java.lang.String toString()
           
 boolean useParameterNameString(int which)
          If this returns true then the value of a parameter for this type should be listed as the strong value returned by getParameterName.
 
Methods inherited from class edu.swri.swiftvis.sources.AbstractSource
abstractRedoAllElements, addOutput, clearData, getBounds, getNumOutputs, getOutput, getOutputInfoPanel, getPaint, getPropertiesPanel, notifySinks, relink, removeOutput, setBounds
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

dataFile

private java.io.File dataFile

bounds

private java.awt.Rectangle bounds

numParameters

private int numParameters

numValues

private int numValues

parameterDescription

private java.util.Vector<java.lang.String> parameterDescription

valueDescription

private java.util.Vector<java.lang.String> valueDescription

sfr

private transient SpecialFormatReader sfr

readType

private int readType

format

private java.lang.String format

binary

private boolean binary

maxAllowed

private int maxAllowed

offset

private int offset

br

private transient java.io.BufferedReader br

totalElements

private int totalElements

TEXT_TYPE

private static final int TEXT_TYPE
See Also:
Constant Field Values

SPECIAL_TYPE

private static final int SPECIAL_TYPE
See Also:
Constant Field Values

serialVersionUID

private static final long serialVersionUID
See Also:
Constant Field Values
Constructor Detail

GeneralData

public GeneralData()

GeneralData

private GeneralData(GeneralData c,
                    java.util.List<GraphElement> l)
Method Detail

getDescription

public java.lang.String getDescription()

getTypeDescription

public static java.lang.String getTypeDescription()

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

setupSpecificPanelProperties

protected void setupSpecificPanelProperties()
Specified by:
setupSpecificPanelProperties in class AbstractSource

getParameterDescription

public java.lang.String getParameterDescription(int which)
Tells you what a particular parameter is used for.


setParameterDescription

public void setParameterDescription(int which,
                                    java.lang.String desc)

useParameterNameString

public boolean useParameterNameString(int which)
If this returns true then the value of a parameter for this type should be listed as the strong value returned by getParameterName. Otherwise just the number should be displayed.


getParameterName

public java.lang.String getParameterName(int which,
                                         int paramVal)
Tells you the text that should be used to describe a particular value of a given parameter.


getValueDescription

public java.lang.String getValueDescription(int which)
Tells you what a particular value is used for.


setValueDescription

public void setValueDescription(int which,
                                java.lang.String desc)

getNumParameters

public int getNumParameters()

getNumValues

public int getNumValues()

getElement

public DataElement getElement(int i)
Description copied from interface: DataSource
Returns the specified data element for this source. I'm using this instead of an iterator because direct access is much more efficient when trying to make tables of data.

Specified by:
getElement in interface DataSource
Overrides:
getElement in class AbstractSource
Parameters:
i - Which data element to return. Should be between 0 and getNumElements()-1.
Returns:
The selected element.

getNumElements

public int getNumElements()
Returns the number of data elements that this source has in it. I'm using this instead of an iterator because direct access is much more efficient when trying to make tables of data.

Specified by:
getNumElements in interface DataSource
Overrides:
getNumElements in class AbstractSource
Returns:
The number of data elements in this source.

copy

public GeneralData copy(java.util.List<GraphElement> l)

specialFormatReset

public void specialFormatReset()
This method is called by the SpecialFormatReader if it tries to read something when the stream it is pulling from is null. This behavior is expected when the object has been nuserialized from disk.


redoAllElements

protected void redoAllElements()
Specified by:
redoAllElements in class AbstractSource

selectFile

private void selectFile()

readFile

private void readFile()

readText

private void readText()

readSpecial

private void readSpecial()

redoBufferSpecial

private void redoBufferSpecial(int elemNum)

redoBufferText

private void redoBufferText(int elemNum)

readTextLine

private DataElement readTextLine()
                          throws java.io.IOException
Throws:
java.io.IOException