SDDS.java.SDDS
Class SDDSArray

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

public class SDDSArray
extends java.lang.Object

Title: SDDSArray Description: Provide support for storing array data. Copyright: Copyright (c) 2001 Company: Collider Accelerator Department, Brookhaven National Laboratory

Version:
1.0 (October, 2001)
Author:
Seth Nemesure seth@bnl.gov

Constructor Summary
SDDSArray()
          Create a new SDDS array that can be used to store array information for SDDS files
 
Method Summary
 boolean deletePage(int page)
          Delete a page at the specified index
 java.lang.String getDescription()
          Returns the description of the array
 int[] getDim()
          Returns the number of elements in each dimension of the array
 int getDimensions()
          Returns the number of dimensions in the array
 int getField_Length()
          Returns the field length of the array
 java.lang.String getFormat_String()
          Returns the format string of the array
 java.lang.String getGroup_Name()
          Returns the group name of the array
 java.lang.String getName()
          Returns the name of the array
 int getPageCount()
          Returns the number of pages that the array contains
 int getRowCount(int page)
          Returns the number of rows a page contains
 java.lang.String getSymbol()
          Returns the symbol of the array
 int getType()
          Returns the type of the array
 java.lang.String getUnits()
          Returns the units of the array
 java.lang.Object[] getValues(int page, boolean string_quotes)
          Get the values of the array 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 array
 void setDim(int[] dim)
          Set the number of elements in each dimension of the array
 void setField_Length(int field_length)
          Set the field length of the array
 void setFormat_String(java.lang.String format_string)
          Set the format string of the array
 void setGroup_Name(java.lang.String group_name)
          Set the group name of the array
 void setName(java.lang.String name)
          Set the name of the array
 void setSymbol(java.lang.String symbol)
          Set the symbol of the array
 void setUnits(java.lang.String units)
          Set the units of the array
 void setupArray(java.lang.String name, java.lang.String symbol, java.lang.String units, java.lang.String description, java.lang.String format_string, java.lang.String group_name, int type, int field_length, int dimensions)
          Set up the array information
 void setValues(double[] v, int page)
          Set the values of the array at a chosen page
 void setValues(long[] v, int page)
          Set the values of the array at a chosen page
 void setValues(java.lang.String[] v, int page)
          Set the values of the array at a chosen page
 boolean writeElement(SDDS.java.SDDS.LEDataOutputStream ledos, int page)
          Write the little endian binary value of the array for a chosen page
 boolean writeHeader(java.io.DataOutputStream dos)
          Write the header to a file.
 boolean writeValues(java.io.DataOutputStream dos, int page, boolean ascii)
          Write the values of the array for a chosen page
 boolean writeValues(SDDS.java.SDDS.LEDataOutputStream ledos, int page)
          Write the values of the array for a chosen page
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SDDSArray

public SDDSArray()
Create a new SDDS array that can be used to store array information for SDDS files
Method Detail

setupArray

public void setupArray(java.lang.String name,
                       java.lang.String symbol,
                       java.lang.String units,
                       java.lang.String description,
                       java.lang.String format_string,
                       java.lang.String group_name,
                       int type,
                       int field_length,
                       int dimensions)
Set up the array information
Parameters:
field_length - has no effect currently
dimensions - integer

getName

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

setName

public void setName(java.lang.String name)
Set the name of the array

getSymbol

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

setSymbol

public void setSymbol(java.lang.String symbol)
Set the symbol of the array

getUnits

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

setUnits

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

getDescription

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

setDescription

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

getFormat_String

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

setFormat_String

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

getGroup_Name

public java.lang.String getGroup_Name()
Returns the group name of the array
Returns:
The String value of the array group name.

setGroup_Name

public void setGroup_Name(java.lang.String group_name)
Set the group name of the array
Parameters:
group_name - format string of the array

getType

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

getField_Length

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

setField_Length

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

getDimensions

public int getDimensions()
Returns the number of dimensions in the array
Returns:
The int value of the dimensions.

getDim

public int[] getDim()
Returns the number of elements in each dimension of the array
Returns:
The int array values.

setDim

public void setDim(int[] dim)
Set the number of elements in each dimension of the array
Parameters:
dim - format string of the array

getPageCount

public int getPageCount()
Returns the number of pages that the array contains
Returns:
The int value of the number of pages the array 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 array 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

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

setValues

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

setValues

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

setValues

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

writeValues

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

writeValues

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

writeElement

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

getValues

public java.lang.Object[] getValues(int page,
                                    boolean string_quotes)
Get the values of the array for a chosen page
Parameters:
page - the page of the array, 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