Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

jplot
Class DataFile  view DataFile download DataFile.java

java.lang.Object
  extended byjplot.DataFile

public class DataFile
extends java.lang.Object

This class contains all the info specific for one datafile. The PlotPanel provides the columns to-be-plotted for a specific file, with a line-style class for each column. This class keeps track of this information.


Field Summary
private  java.lang.String abbreviatedFilename
           
private  java.util.Vector columns
           
private  java.io.File file
           
private  java.lang.String filenameWithoutPath
           
private  GraphPars gp
           
private  int graphType
           
private  int index
           
private  java.util.Vector items
           
private  int maxLen
           
private  java.util.Vector styles
           
private  int xColumn
           
 
Constructor Summary
(package private) DataFile(java.io.File file, int index, GraphPars gp)
          Builds the class from a filename.
 
Method Summary
 void addColumn(int columnIndex, LinePars lp)
          adds a column to the vector of columns.
 void addItem(java.lang.String item)
          Adds an item to the vector.
private  void addLabel(GraphLabel gl, java.util.Vector newLabels)
           
private  void delCol(java.lang.Integer index)
           
 java.lang.String getAbbreviatedFilename()
          Return the abbreviated filename.
 java.lang.String getColumnName(int i)
          Returns the name of one of the columns present here.
 boolean getDataArrays(java.util.Vector dataArrays, int type)
          Reads the current file and returns the data arrays.
 java.io.File getFile()
          Return the file
 java.lang.String getFilenameWithoutPath()
          Return the filename with the preceeding path stripped off.
 int getGraphType()
           
 java.lang.String getItem(int i)
           
private  java.lang.String getLabel(java.util.StringTokenizer st)
           
 java.lang.String getLegend(int index)
           
 LinePars getLinePars(int index)
          returns the linestyle of one of the vector items.
 java.lang.String getName()
          Return the filename as such.
 int getNumberOfColumns()
          Return the number of columns (selected items)
 int getNumberOfItems()
           
 int getXColumn()
          returns the index of the column used for the X-axis
 int getYColumn(int i)
          returns the index of the column used for the Y-axis
 int isSelected(int index)
          Checks whether the argument is a column selected for output.
 boolean loadColumnNames(java.util.Vector labels)
          Reads the datafile for data.
 void removeColumn(int columnIndex)
          remove a column from the vector of columns.
 void setIndex(int i)
          Sets the current datafile index to another value.
 void setLinePars(int index, LinePars lp)
          sets the linestyle of one of the vector items.
 void setLinePars(LinePars lp)
          sets the linestyle of all the vector items.
 void setXColumn(int columnIndex)
          sets the index of the column used for the X-axis
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

file

private java.io.File file

items

private java.util.Vector items

columns

private java.util.Vector columns

xColumn

private int xColumn

styles

private java.util.Vector styles

abbreviatedFilename

private java.lang.String abbreviatedFilename

filenameWithoutPath

private java.lang.String filenameWithoutPath

maxLen

private final int maxLen
See Also:
Constant Field Values

index

private int index

graphType

private int graphType

gp

private GraphPars gp
Constructor Detail

DataFile

DataFile(java.io.File file,
         int index,
         GraphPars gp)
Builds the class from a filename. As soon as the datafile is build, read the header of the file and make a list of all the available columns.

Method Detail

loadColumnNames

public boolean loadColumnNames(java.util.Vector labels)
Reads the datafile for data. The data is put in a specific purpose DataArray object, which contains x- and y values. Note that all blank lines or lines starting with '#' are skipped. One exception: lines starting with '# column 1:' etc. are supposed to provide the name of the column, hence '# column 1: nodes' means that column 1 has the name 'nodes', which will be used by this program in order to easily select columns. If the list of column names existed already, and if the new list of names is identical, return true. Else delete the current selection and return false.


getLabel

private java.lang.String getLabel(java.util.StringTokenizer st)

addLabel

private void addLabel(GraphLabel gl,
                      java.util.Vector newLabels)

getNumberOfItems

public int getNumberOfItems()

getItem

public java.lang.String getItem(int i)

addItem

public void addItem(java.lang.String item)
Adds an item to the vector.


delCol

private void delCol(java.lang.Integer index)

addColumn

public void addColumn(int columnIndex,
                      LinePars lp)
adds a column to the vector of columns. The column is added even if the column index is already selected (hence selecting several times the same column is allowed). This is useful if the user wants to plot the same data several times but in a different way. (histogram + lines, for example).


setXColumn

public void setXColumn(int columnIndex)
sets the index of the column used for the X-axis


getXColumn

public int getXColumn()
returns the index of the column used for the X-axis


getYColumn

public int getYColumn(int i)
returns the index of the column used for the Y-axis


getLinePars

public LinePars getLinePars(int index)
returns the linestyle of one of the vector items.


setLinePars

public void setLinePars(int index,
                        LinePars lp)
sets the linestyle of one of the vector items.


setLinePars

public void setLinePars(LinePars lp)
sets the linestyle of all the vector items.


getLegend

public java.lang.String getLegend(int index)

removeColumn

public void removeColumn(int columnIndex)
remove a column from the vector of columns.


getNumberOfColumns

public int getNumberOfColumns()
Return the number of columns (selected items)


getFile

public java.io.File getFile()
Return the file


getAbbreviatedFilename

public java.lang.String getAbbreviatedFilename()
Return the abbreviated filename. This name is different from the file itselves if it exceeds a a certain number of characters (about 45). Otherwise, the name is too long to fit in decent textboxes...


getFilenameWithoutPath

public java.lang.String getFilenameWithoutPath()
Return the filename with the preceeding path stripped off.


getName

public java.lang.String getName()
Return the filename as such.


isSelected

public int isSelected(int index)
Checks whether the argument is a column selected for output.


getColumnName

public java.lang.String getColumnName(int i)
Returns the name of one of the columns present here.


setIndex

public void setIndex(int i)
Sets the current datafile index to another value.


getGraphType

public int getGraphType()

getDataArrays

public boolean getDataArrays(java.util.Vector dataArrays,
                             int type)
Reads the current file and returns the data arrays.