edu.swri.swiftvis.sources
Class BinaryPositionData

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

public class BinaryPositionData
extends AbstractSource

This class represents a data file for the binary data output. Currently this uses the format for the old SWIFT and not for SWIFTER. That should probably be left as an option.

See Also:
Serialized Form

Nested Class Summary
private static class BinaryPositionData.PositionElementPair
           
 
Field Summary
private  BinaryInput bis
           
private  int coordinates
           
private static int ELEMENT_SIZE
           
private  EditableDouble endRange
           
private  java.util.List<BinaryPositionData.PositionElementPair> filePositions
           
private  java.io.File fileToRead
           
private  int maxAllowed
          The number of elements to hold in memory at one time.
private  int offset
           
private  EditableInt oneIn
           
private  int program
           
private  java.io.RandomAccessFile raf
           
private  int saveFormat
           
private static long serialVersionUID
           
private  EditableDouble startRange
           
private static int SWIFT
           
private static int SWIFTER
           
private  int totalElements
           
private  EditableBoolean useRange
           
 
Fields inherited from class edu.swri.swiftvis.sources.AbstractSource
dataVect, propPanel, sinkVector
 
Constructor Summary
BinaryPositionData()
           
BinaryPositionData(BinaryPositionData c, java.util.List<GraphElement> l)
           
 
Method Summary
 BinaryPositionData 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  float readReal()
           
private  int readTimestep(int[] paramArray, float[] valueArray, boolean store)
          This reads in a single timestep.
protected  void redoAllElements()
           
private  void redoBuffer(int elemNum)
           
private  void selectFile()
           
protected  void setupSpecificPanelProperties()
           
 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

program

private int program

coordinates

private int coordinates

saveFormat

private int saveFormat

oneIn

private EditableInt oneIn

useRange

private EditableBoolean useRange

startRange

private EditableDouble startRange

endRange

private EditableDouble endRange

maxAllowed

private int maxAllowed
The number of elements to hold in memory at one time. Will round up to get a full timestep.


offset

private int offset

fileToRead

private java.io.File fileToRead

totalElements

private int totalElements

ELEMENT_SIZE

private static final int ELEMENT_SIZE
See Also:
Constant Field Values

bis

private transient BinaryInput bis

raf

private transient java.io.RandomAccessFile raf

filePositions

private transient java.util.List<BinaryPositionData.PositionElementPair> filePositions

SWIFT

private static final int SWIFT
See Also:
Constant Field Values

SWIFTER

private static final int SWIFTER
See Also:
Constant Field Values

serialVersionUID

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

BinaryPositionData

public BinaryPositionData()

BinaryPositionData

public BinaryPositionData(BinaryPositionData 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.


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.


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 BinaryPositionData copy(java.util.List<GraphElement> l)

redoAllElements

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

selectFile

private void selectFile()

readFile

private void readFile()

readReal

private float readReal()
                throws java.io.IOException
Throws:
java.io.IOException

readTimestep

private int readTimestep(int[] paramArray,
                         float[] valueArray,
                         boolean store)
                  throws java.io.IOException
This reads in a single timestep.

Parameters:
paramArray - An array of two ints. Passed for speed.
valueArray - An array of 7 floats. Passed for speed.
Returns:
The number of elements read.
Throws:
java.io.IOException - This signals that the end of the file has been reached.

redoBuffer

private void redoBuffer(int elemNum)