SDDS.java.SDDS
Class SDDSColumn

java.lang.Object
  |
  +--SDDS.java.SDDS.SDDSColumn

public class SDDSColumn
extends java.lang.Object

The SDDS Column object is used by the SDDS File object. It was not the intention of the author to use this object directly but it is still supported. After initializing the SDDS Column the setupColumn method must be used to give the column a name and a valid data type (long, short, float, double, string, character). The setValues method is used next to give the column values for different pages. The writeValues method or the writeElement method can be used to print the column values for a particular page.

Since:
JDK 1.2
Version:
1.0 (November 1, 1999)
Author:
Robert Soliday soliday@aps.anl.gov

Constructor Summary
SDDSColumn()
          Create a new SDDS column that can be used to store column information for SDDS files.
 
Method Summary
 boolean deletePage(int page)
          Delete a page at the specified index
 void deleteRow(int page, int row)
          Deletes the value of the column at a chosen page and at a chosen row
 java.lang.String getDescription()
          Returns the description of the column
 int getField_Length()
          Returns the field length of the column
 java.lang.String getFormat_String()
          Returns the format string of the column
 java.lang.String getName()
          Returns the name of the column
 int getPageCount()
          Returns the number of pages that the column contains
 int getRowCount(int page)
          Returns the number of rows a page contains
 java.lang.String getSymbol()
          Returns the symbol of the column
 int getType()
          Returns the type of the column
 java.lang.String getUnits()
          Returns the units of the column
 java.lang.Object[] getValues(int page, boolean string_quotes)
          Get the values of the column for a chosen page
 boolean insertPage(int page)
          Inserts a blank page at the specified index
 void makeBlankPages(int lastpage)
          Create blank pages up to the last page specified
 void setDescription(java.lang.String description)
          Set the description of the column
 void setField_Length(int field_length)
          Set the field length of the column
 void setFormat_String(java.lang.String format_string)
          Set the format string of the column
 void setName(java.lang.String name)
          Set the name of the column
 void setSymbol(java.lang.String symbol)
          Set the symbol of the column
 void setUnits(java.lang.String units)
          Set the units of the column
 void setupColumn(java.lang.String name, java.lang.String symbol, java.lang.String units, java.lang.String description, java.lang.String format_string, int type, int field_length)
          Set up the column information.
 void setValues(double[] v, int page, int startRow)
          Set the values of the column at a chosen page starting at the chosen row
 void setValues(long[] v, int page, int startRow)
          Set the values of the column at a chosen page starting at the chosen row
 void setValues(java.lang.String[] v, int page, int startRow)
          Set the values of the column at a chosen page starting at the chosen row
 boolean writeColumn(java.io.DataOutputStream dos, int page)
          Write the values of the column for a chosen page
 boolean writeElement(java.io.DataOutputStream dos, int page, int row, boolean ascii)
          Write the value of the column for a chosen page and row
 boolean writeElement(SDDS.java.SDDS.LEDataOutputStream ledos, int page, int row)
          Write the little endian binary value of the column for a chosen page and row
 boolean writeHeader(java.io.DataOutputStream dos)
          Write the header to a file.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SDDSColumn

public SDDSColumn()
Create a new SDDS column that can be used to store column information for SDDS files.
Method Detail

setupColumn

public void setupColumn(java.lang.String name,
                        java.lang.String symbol,
                        java.lang.String units,
                        java.lang.String description,
                        java.lang.String format_string,
                        int type,
                        int field_length)
Set up the column information.
Parameters:
name - should be a valid name as defined by SDDSUtil.isValidName
symbol - may be null
units - may be null
description - may be null
format_string - may be null
type - valid values are:
  • 1 for double
  • 2 for float
  • 3 for long
  • 4 for short
  • 5 for string
  • 6 for character
field_length - has no effect currently

getName

public java.lang.String getName()
Returns the name of the column
Returns:
The String value of the column name.

setName

public void setName(java.lang.String name)
Set the name of the column
Parameters:
name - name of the column

getSymbol

public java.lang.String getSymbol()
Returns the symbol of the column
Returns:
The String value of the column symbol.

setSymbol

public void setSymbol(java.lang.String symbol)
Set the symbol of the column
Parameters:
symbol - symbol of the column

getUnits

public java.lang.String getUnits()
Returns the units of the column
Returns:
The String value of the column units.

setUnits

public void setUnits(java.lang.String units)
Set the units of the column
Parameters:
units - units of the column

getDescription

public java.lang.String getDescription()
Returns the description of the column
Returns:
The String value of the column description.

setDescription

public void setDescription(java.lang.String description)
Set the description of the column
Parameters:
description - description of the column

getFormat_String

public java.lang.String getFormat_String()
Returns the format string of the column
Returns:
The String value of the column format string.

setFormat_String

public void setFormat_String(java.lang.String format_string)
Set the format string of the column
Parameters:
format_string - format string of the column

getType

public int getType()
Returns the type of the column
Returns:
The int value of the column type.

getField_Length

public int getField_Length()
Returns the field length of the column
Returns:
The int value of the column field length.

setField_Length

public void setField_Length(int field_length)
Set the field length of the column
Parameters:
field_length - field length of the column

getPageCount

public int getPageCount()
Returns the number of pages that the column contains
Returns:
The int value of the number of pages the column contains.

getRowCount

public int getRowCount(int page)
Returns the number of rows a page contains
Returns:
The int value of the number of pages the column contains.
-1 if the page value is invalid.

insertPage

public boolean insertPage(int page)
Inserts a blank page at the specified index
Parameters:
page - index of page to create insert
Returns:
true on success
false on error.

deletePage

public boolean deletePage(int page)
Delete a page at the specified index
Parameters:
page - index of page to delete
Returns:
true on success
false on error.

makeBlankPages

public void makeBlankPages(int lastpage)
Create blank pages up to the last page specified
Parameters:
lastpage - last page to create blank page

deleteRow

public void deleteRow(int page,
                      int row)
Deletes the value of the column at a chosen page and at a chosen row
Parameters:
page - the page of the column, must be greater then 0
row - the row of the column, must be greater then 0

setValues

public void setValues(long[] v,
                      int page,
                      int startRow)
Set the values of the column at a chosen page starting at the chosen row
Parameters:
value - a long precision number array
page - the page of the column, must be greater then 0
startRow - the row of the column, must be greater then 0

setValues

public void setValues(double[] v,
                      int page,
                      int startRow)
Set the values of the column at a chosen page starting at the chosen row
Parameters:
value - a double precision floating-point number array
page - the page of the column, must be greater then 0
startRow - the row of the column, must be greater then 0

setValues

public void setValues(java.lang.String[] v,
                      int page,
                      int startRow)
Set the values of the column at a chosen page starting at the chosen row
Parameters:
value - a string value array
page - the page of the column, must be greater then 0
startRow - the row of the column, must be greater then 0

writeHeader

public boolean writeHeader(java.io.DataOutputStream dos)
Write the header to a file.
Parameters:
dos - a valid DataOutputStream
Returns:
true if the header was successfully written
false if an error occured

writeElement

public boolean writeElement(java.io.DataOutputStream dos,
                            int page,
                            int row,
                            boolean ascii)
Write the value of the column for a chosen page and row
Parameters:
dos - a valid DataOutputStream
page - the page of the column, must be greater then 0
row - the row of the column, must be greater then 0
ascii - set true to write ascii column data, false to write big endian binary column data
Returns:
true if the value was successfully written
false if an invalid page or row was encountered or if the column type is undefined.

writeElement

public boolean writeElement(SDDS.java.SDDS.LEDataOutputStream ledos,
                            int page,
                            int row)
Write the little endian binary value of the column for a chosen page and row
Parameters:
ledos - a valid LEDataOutputStream
page - the page of the column, must be greater then 0
row - the row of the column, must be greater then 0
Returns:
true if the value was successfully written
false if an invalid page or row was encountered or if the column type is undefined.

writeColumn

public boolean writeColumn(java.io.DataOutputStream dos,
                           int page)
Write the values of the column for a chosen page
Parameters:
dos - a valid DataOutputStream
page - the page of the column, must be greater then 0
Returns:
true if the values were successfully written
false if an invalid page was encountered or if the column type is undefined.

getValues

public java.lang.Object[] getValues(int page,
                                    boolean string_quotes)
Get the values of the column for a chosen page
Parameters:
page - the page of the column, must be greater then 0
string_quotes - true if quotes are to be added around strings
false if raw strings are to be outputed.
Returns:
Object array of data