uk.ac.ebi.adfconverter.common.data.tabulardata
Class DataTable

java.lang.Object
  extended byuk.ac.ebi.adfconverter.common.data.tabulardata.DataTable
Direct Known Subclasses:
CorrectableDataTable

public class DataTable
extends java.lang.Object

Object representing collection of dataRow

Version:
$Revision: 1 $ ADF MAGE-TOOL - MicroArray Informatics Team / European Bioinformatics Institute (EBI) ArrayExpress License: ============================================================================== Copyright (c) 2002 The European Bioinformatics Institute. All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 3. The name ArrayExpress must not be used to endorse or promote products derived from this software without prior written permission. For written permission, please contact arrayexpress@ebi.ac.uk 4. Products derived from this software may not be called "ArrayExpress" nor may "ArrayExpress" appear in their names without prior written permission of the ArrayExpress developers. 5. Redistributions of any form whatsoever must retain the following acknowledgment: "This product includes software developed by ArrayExpress (http://www.ebi.ac.uk/arrayexpress)" THIS SOFTWARE IS PROVIDED BY THE ARRAYEXPRESS GROUP ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE ARRAYEXPRESS GROUP OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. The European Bioinformatics Institute may publish revised and/or new versions of this license with new releases of ArrayExpress software. ==============================================================================
Author:
Pierre MARGUERITE

Field Summary
static int HORIZONTALTABLE
          Horizontal table orientation
static int TEXTFILE
          TEXT file type
static int UNKNOWNFILE
          UNKNOWN File type
static int VERTICALTABLE
          Vertical table orientation
static int WORKBOOKFILE
          WORKBOOK File type
 
Constructor Summary
DataTable()
          Creates a new DataTable instance.
DataTable(java.io.File file)
          Creates a new DataTable instance.
DataTable(java.lang.String enc, java.io.File file)
          Creates a new DataTable instance.
 
Method Summary
 boolean addRow(DataRow row)
          Adds a datarow in the table
 void clear()
          cleans memory used when the header is not needed anymore
 boolean contains(DataRow _row)
          retrieves if a row is already contained in the table
 boolean containsHeader()
          Checks if header indicator has been turned on using containsHeader(boolean). .
 void containsHeader(boolean _header)
          Sets the indicator for header row.
 java.lang.String getEnc()
          Retrieves characters encoding
 java.io.File getFile()
          Gets the data file.
static int getFileFormat(java.lang.String formatName)
          retrieves file format from strong
 java.lang.String getFileName()
          Gets the fileName.
 java.lang.String getFilePath()
          Gets the filepath.
 int getFileType()
          Retrieves the file type but DataTable is correct. do not depend of this orientation For convience
 TextLineConverter getFormat()
          Gets the file format.
 DataTableHeader getHeader()
          Retrieves table header
static int getHorizontalOrientation()
          retrieves Horizontal table orientation format
 int getOrientation()
          Retrieves the orientation of data in file but DataTable is correct. do not depend of this orientation For convience
 DataRow getRow(int index)
          gets a datarow in the table
 java.util.Enumeration getRows()
          Retrieves the list of rows found in the data file.
static int getTableOrientationFormat(java.lang.String OrientationName)
          retrieves file format from string
static int getTextFile()
          retrieves text file format
static int getUnknownFileFormat()
          retrieves unknown file format
static int getVerticalOrientation()
          retrieves vertical table orientation format
static int getWorkBookFile()
          retrieves workbook file format
 boolean hasNext()
          retrieves if there a next row after the current one
 void InitNextRow()
          initialised the parsing of row list Starts at the begin of the list
 boolean isEmpty()
          Retrieves if the table is empty
 DataRow nextRow()
          Retrieves the next Row in the list
 void removeRow(DataRow row)
          removes a datarow in the table at a given position
 void removeRow(int index)
          removes a datarow in the table at a given position
 void setFile(java.io.File file)
          Sets file attribut
 void setFileName(java.lang.String pathname)
          Sets the file name.
 void setFileType(int type)
          set the type of the file where was the data use when saving dataTable for convenience
 void setFormat(TextLineConverter format)
          Sets the file format.
 void setHeader(DataTableHeader header)
          sets the header of the table
 void setOrientation(int orient)
          Indicates the orientation of data but DataTable is correct. do not depend of this orientation For convience
 int size()
          Retrieves the table size
 java.lang.String toString()
          represents the table as String
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

HORIZONTALTABLE

public static final int HORIZONTALTABLE
Horizontal table orientation

See Also:
Constant Field Values

TEXTFILE

public static final int TEXTFILE
TEXT file type

See Also:
Constant Field Values

UNKNOWNFILE

public static final int UNKNOWNFILE
UNKNOWN File type

See Also:
Constant Field Values

VERTICALTABLE

public static final int VERTICALTABLE
Vertical table orientation

See Also:
Constant Field Values

WORKBOOKFILE

public static final int WORKBOOKFILE
WORKBOOK File type

See Also:
Constant Field Values
Constructor Detail

DataTable

public DataTable()
Creates a new DataTable instance. with a default character encoding, without associated file. Must be associated by setFile method (mandattory)


DataTable

public DataTable(java.io.File file)
Creates a new DataTable instance. with a default character encoding

Parameters:
file - an File value: the file containing this data

DataTable

public DataTable(java.lang.String enc,
                 java.io.File file)
Creates a new DataTable instance.

Parameters:
enc - a String value: Java character encoding in which the data strings are written.
file - an File value: the file containing this data
Method Detail

addRow

public boolean addRow(DataRow row)
Adds a datarow in the table

Parameters:
row - a datarow to add
Returns:
boolean, if the row has been added.

clear

public void clear()
cleans memory used when the header is not needed anymore


contains

public boolean contains(DataRow _row)
retrieves if a row is already contained in the table

Parameters:
_row - the row search in the talbe
Returns:
true, if the row is in the table. false otherwise

containsHeader

public boolean containsHeader()
Checks if header indicator has been turned on using containsHeader(boolean). .

Returns:
True, if table header indicator has been set to true. False, otherwise.

containsHeader

public void containsHeader(boolean _header)
Sets the indicator for header row.

Parameters:
_header - True if the table contains a header row. False, otherwise.

getEnc

public java.lang.String getEnc()
Retrieves characters encoding

Returns:
the character encoding

getFile

public java.io.File getFile()
Gets the data file.

Returns:
the file where were stored data

getFileFormat

public static final int getFileFormat(java.lang.String formatName)
retrieves file format from strong

Parameters:
formatName - a string representing the file format
Returns:
the corresponding file format

getFileName

public java.lang.String getFileName()
Gets the fileName.

Returns:
the name of the file where was the data when loaded

getFilePath

public java.lang.String getFilePath()
Gets the filepath.

Returns:
the path of the data file

getFileType

public int getFileType()
Retrieves the file type but DataTable is correct. do not depend of this orientation For convience

Returns:
the file type

getFormat

public TextLineConverter getFormat()
Gets the file format.

Returns:
an instance of a class that implements TextLineConverter interface.
See Also:
TextLineConverter

getHeader

public DataTableHeader getHeader()
Retrieves table header

Returns:
the header table

getHorizontalOrientation

public static final int getHorizontalOrientation()
retrieves Horizontal table orientation format

Returns:
the horizontal orientation format

getOrientation

public int getOrientation()
Retrieves the orientation of data in file but DataTable is correct. do not depend of this orientation For convience

Returns:
the table orientation

getRow

public DataRow getRow(int index)
gets a datarow in the table

Parameters:
index - the position of the wanted row
Returns:
the data row

getRows

public java.util.Enumeration getRows()
Retrieves the list of rows found in the data file.

Returns:
row iterator Iterator can be used by boolean hasNext() method object next() method

getTableOrientationFormat

public static final int getTableOrientationFormat(java.lang.String OrientationName)
retrieves file format from string

Parameters:
OrientationName - the name of the the table orientation
Returns:
the corresponding file format

getTextFile

public static final int getTextFile()
retrieves text file format

Returns:
the text file format

getUnknownFileFormat

public static final int getUnknownFileFormat()
retrieves unknown file format

Returns:
the unknown file format

getVerticalOrientation

public static final int getVerticalOrientation()
retrieves vertical table orientation format

Returns:
the vertical orientation format

getWorkBookFile

public static final int getWorkBookFile()
retrieves workbook file format

Returns:
the workbook file format

hasNext

public boolean hasNext()
retrieves if there a next row after the current one

Returns:
true if there a row after. false otherwise

InitNextRow

public void InitNextRow()
initialised the parsing of row list Starts at the begin of the list


isEmpty

public boolean isEmpty()
Retrieves if the table is empty

Returns:
yes if table is empty. false otherwise

nextRow

public DataRow nextRow()
Retrieves the next Row in the list

Returns:
the next row

removeRow

public void removeRow(DataRow row)
removes a datarow in the table at a given position


removeRow

public void removeRow(int index)
removes a datarow in the table at a given position

Parameters:
index - the position of the row

setFile

public void setFile(java.io.File file)
Sets file attribut

Parameters:
file - The file to set.

setFileName

public void setFileName(java.lang.String pathname)
                 throws java.io.IOException
Sets the file name.

Parameters:
pathname - the path and the name of the file which contains the data
Throws:
java.io.IOException - exception, if the table associated file has already been set

setFileType

public void setFileType(int type)
set the type of the file where was the data use when saving dataTable for convenience

Parameters:
type - the file type WORKBOOK or TEXT (can be retrieve with getFileFormat method with a String representing the type)

setFormat

public void setFormat(TextLineConverter format)
Sets the file format.

Parameters:
format - an instance of a class that implements TextLineConverter interface.
See Also:
TextLineConverter

setHeader

public void setHeader(DataTableHeader header)
sets the header of the table

Parameters:
header - the header table

setOrientation

public void setOrientation(int orient)
Indicates the orientation of data but DataTable is correct. do not depend of this orientation For convience

Parameters:
orient - the orientation of the table:

size

public int size()
Retrieves the table size

Returns:
the size of the table

toString

public java.lang.String toString()
represents the table as String

Returns:
a String representation of the table


European Bioinformatics InstituteMicroarray Informatics Team