All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class ibs.table.IbsTable

java.lang.Object
   |
   +----java.util.Dictionary
           |
           +----java.util.Hashtable
                   |
                   +----ibs.table.IbsTable

public class IbsTable
extends Hashtable
implements Serializable

Variable Index

 o BookMarkRecord

Constructor Index

 o IbsTable(String)
Constructor for IbsTable class.
 o IbsTable(String, int)
Constructor for IbsTable class.
 o IbsTable(String, int, int)
Constructor for IbsTable class.

Method Index

 o countRecords()
Returns record count for records in current table.
 o createNewRecord()
Creates a new IbsRecord object with an auto generated unique key as the record key and returns it.
 o createNewRecord(String)
Creates a new IbsRecord object with given key as the record key ( unique key ) and returns it.
 o createNewRecord(String, boolean)
Creates a new IbsRecord object with given key as the record key ( unique key ) and returns it.
 o createTableColumns(String)
Create table columns using given string.
 o createTableColumns(String[])
Create table columns using given string array.
 o exists(String)
Checks if current table contains the given key.
 o getKeys()
Returns an enumeration of all keys in the current table.
 o getNextUniqueKey()
Generates next unique key for the table and returns it.
 o getRecord(String)
Returns an IbsRecord for the given key.
 o getRecords()
Returns an enumeration of all records in the current table.
 o getTableColumns()
Returns an IbsTableColumns object for the current table.
 o getTableName()
Returns table name for the current IbsTable object.
 o insertRecord(IbsRecord)
This method allows you to insert a given IbsRecord in current IbsTable object.
 o printKeys(PrintWriter)
Print all record keys in the table to the given PrintWriter.
 o printRecords(PrintWriter)
Print all records in the table to the given PrintWriter.
 o printRecords(PrintWriter, int)
Print table records to the given PrintWriter and stop after printing specified number of records.
 o printRecords(PrintWriter, int, boolean)
Print table records to the given PrintWriter and stop after printing specified number of records.
 o removeRecord(String)
Removes IbsRecord (for the given key) from the table.
 o removeRecords()
WARNING: Removes all records from the table so that it contains no keys/records.
 o setPrintPreferences(String, String)
Set print preferences before starting printRecords.
 o setUniqueKeyColumn(int)
Identify the column that should be used as a Unique Key column.

Variables

 o BookMarkRecord
 public int BookMarkRecord

Constructors

 o IbsTable
 public IbsTable(String table_name)
Constructor for IbsTable class.

Parameters:
table_name - A name given to this IbsTable object.
 o IbsTable
 public IbsTable(String table_name,
                 int init_capacity)
Constructor for IbsTable class.

Parameters:
table_name - A name given to this IbsTable object.
init_capacity - If approximate record count is known at the time of creating IbsTable object, use this constructor and specify initial_capacity for this table.
 o IbsTable
 public IbsTable(String table_name,
                 int init_capacity,
                 int load_factor)
Constructor for IbsTable class.

Parameters:
table_name - A name given to this IbsTable object.
init_capacity - If approximate record count is known at the time of creating IbsTable object, use this constructor and specify initial_capacity for this table.
load_factor - A number between 0.0 and 1.0.

Methods

 o setUniqueKeyColumn
 public void setUniqueKeyColumn(int column_index) throws ColumnNotFoundException
Identify the column that should be used as a Unique Key column. Currently, IbsTable allows only one column as a unique key column. Param value 99 means IbsTable will generate a row_id for each record in the table.
If your data has more than one column that makes unique key, consider following:
* Let IbsTable generate a numeric unique key (ROW_ID) for you. Use 99 as a parameter to use an Autogenerated Key.
* Look at using some other resource that may be more in-line with your needs.

Parameters:
column_index - A column index for the column that you wish to use as a unique key. Value '99' means you are selecting an Autogenerated Key for this table.
Throws: ColumnNotFoundException
When the given column index was < 0;
 o createTableColumns
 public IbsTableColumns createTableColumns(String columns_list) throws InvalidArgumentException
Create table columns using given string. Column names in the given string must be seperated by semi-colon (;) If table columns already set into the table, it cannot be changed/set again.

Parameters:
columns_list - A String containing column names seperated by semi-colon (;)
Returns:
s An object of type IbsTableColumns.
Throws: InvalidArgumentException
If table columns are already set
 o createTableColumns
 public IbsTableColumns createTableColumns(String columns[]) throws InvalidArgumentException
Create table columns using given string array. If table columns already set into the table, it cannot be changed/set again.

Parameters:
columns - A String array containing column names
Returns:
s An object of type IbsTableColumns.
Throws: InvalidArgumentException
If table columns are already set
 o insertRecord
 public void insertRecord(IbsRecord record)
This method allows you to insert a given IbsRecord in current IbsTable object. This record overwrites any other record already existing with same unique key.

Parameters:
into_table - An IbsTable object into which a record should be inserted.
record - An IbsRecord record that should be inserted into the table.
Returns:
IbsTable Given into_table is returned with the 'record' inserted into it.
 o getTableName
 public String getTableName()
Returns table name for the current IbsTable object.

Returns:
Table Name property of the current object.
 o getTableColumns
 public IbsTableColumns getTableColumns()
Returns an IbsTableColumns object for the current table.

Returns:
An IbsTableColumns object containing names of table columns
 o createNewRecord
 public IbsRecord createNewRecord() throws KeyNotFoundException
Creates a new IbsRecord object with an auto generated unique key as the record key and returns it.

Returns:
An empty IbsRecord object with auto generated key (row_id);
Throws: KeyNotFoundException
If key was not set as Auto Generated ( = 99 ), call to this method throws exception because a key was not supplied for the new record.
 o createNewRecord
 public IbsRecord createNewRecord(String key) throws DuplicateKeyException
Creates a new IbsRecord object with given key as the record key ( unique key ) and returns it. If key was already defined in the table, throws an exception.

Parameters:
key - A key to make current record a unique record in the table.
Returns:
An empty IbsRecord object with given key as it's record key ( unique key ).
Throws: DuplicateKeyException
If given key was already defined in the current table.
 o createNewRecord
 public IbsRecord createNewRecord(String key,
                                  boolean replace_duplicate) throws DuplicateKeyException
Creates a new IbsRecord object with given key as the record key ( unique key ) and returns it. If 'replace_duplicate' is false, and key was already defined in the table, throws an exception.

Parameters:
key - A key to make current record a unique record in the table.
replace_duplicate - If true, replaces previously defined duplicate key with the current key and initializes the record.
Returns:
An empty IbsRecord object with given key as it's record key ( unique key ).
Throws: DuplicateKeyException
If given key was already defined in the current table and replace is set to false.
 o getKeys
 public Enumeration getKeys()
Returns an enumeration of all keys in the current table.

Returns:
An Enumeration of table keys ( String objects ).
 o getRecords
 public Enumeration getRecords()
Returns an enumeration of all records in the current table.

Returns:
An Enumeration of table records ( IbsRecord objects ).
 o getRecord
 public IbsRecord getRecord(String key) throws KeyNotFoundException
Returns an IbsRecord for the given key.

Parameters:
key - A key
Throws: KeyNotFoundException
If given key was not found in the table.
 o removeRecord
 public void removeRecord(String key) throws KeyNotFoundException
Removes IbsRecord (for the given key) from the table.

Parameters:
key - A key
Throws: KeyNotFoundException
If given key was not found in the table.
 o removeRecords
 public void removeRecords()
WARNING: Removes all records from the table so that it contains no keys/records.

 o getNextUniqueKey
 public int getNextUniqueKey()
Generates next unique key for the table and returns it.

Returns:
An integer unique key for the table.
 o exists
 public boolean exists(String key)
Checks if current table contains the given key. If not, returns false, otherwise returns true.

Parameters:
key - A key
Returns:
A boolean value. 'true' if key was found, 'false' otherwise.
 o countRecords
 public int countRecords()
Returns record count for records in current table.

Returns:
An integer value representating size of the current table.
 o setPrintPreferences
 public void setPrintPreferences(String field_seperator,
                                 String text_qualifier)
Set print preferences before starting printRecords. This is helpful if you would like to dump table records in a particular format (e.g. comma seperated)

Parameters:
field_seperator - specify the field seperator
text_qualifier - A text qualifier to enclose text field values within.
 o printRecords
 public void printRecords(PrintWriter pw)
Print all records in the table to the given PrintWriter.

To print records on your standard output, just instantiate a PrintWriter object as new PrintWriter(System.out) and pass it to this method.
NOTE: In some cases, you may have to construct a PrintWriter object with a 'true' argument to set it to auto flush.

Parameters:
pw - A PrintWriter object.
 o printRecords
 public void printRecords(PrintWriter pw,
                          int stop_after)
Print table records to the given PrintWriter and stop after printing specified number of records.

To print records on your standard output, just instantiate a PrintWriter object as new PrintWriter(System.out) and pass it to this method.
NOTE: In some cases, you may have to construct a PrintWriter object with a 'true' argument to set it to auto flush.

Parameters:
pw - A PrintWriter object.
 o printRecords
 public void printRecords(PrintWriter pw,
                          int stop_after,
                          boolean bookmark)
Print table records to the given PrintWriter and stop after printing specified number of records.

To print records on your standard output, just instantiate a PrintWriter object as new PrintWriter(System.out, true) and pass it to this method.
NOTE: In some cases, you may have to construct a PrintWriter object with a 'true' argument to set it to auto flush.

Parameters:
pw - A PrintWriter object.
bookmark - A boolean value
 o printKeys
 public void printKeys(PrintWriter pw)
Print all record keys in the table to the given PrintWriter.

To print keys on your standard output, just instantiate a PrintWriter object as new PrintWriter(System.out) and pass it to this method.
NOTE: In some cases, you may have to construct a PrintWriter object with a 'true' argument to set it to auto flush.

Parameters:
pw - A PrintWriter object.

All Packages  Class Hierarchy  This Package  Previous  Next  Index