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
-
BookMarkRecord
-
-
IbsTable(String)
- Constructor for IbsTable class.
-
IbsTable(String, int)
- Constructor for IbsTable class.
-
IbsTable(String, int, int)
- Constructor for IbsTable class.
-
countRecords()
- Returns record count for records in current table.
-
createNewRecord()
- Creates a new IbsRecord object with an auto generated unique key as the record key
and returns it.
-
createNewRecord(String)
- Creates a new IbsRecord object with given key as the record key ( unique key )
and returns it.
-
createNewRecord(String, boolean)
- Creates a new IbsRecord object with given key as the record key ( unique key )
and returns it.
-
createTableColumns(String)
- Create table columns using given string.
-
createTableColumns(String[])
- Create table columns using given string array.
-
exists(String)
- Checks if current table contains the given key.
-
getKeys()
- Returns an enumeration of all keys in the current table.
-
getNextUniqueKey()
- Generates next unique key for the table and returns it.
-
getRecord(String)
- Returns an IbsRecord for the given key.
-
getRecords()
- Returns an enumeration of all records in the current table.
-
getTableColumns()
- Returns an IbsTableColumns object for the current table.
-
getTableName()
- Returns table name for the current IbsTable object.
-
insertRecord(IbsRecord)
- This method allows you to insert a given IbsRecord in current IbsTable object.
-
printKeys(PrintWriter)
- Print all record keys in the table to the given PrintWriter.
-
printRecords(PrintWriter)
- Print all records in the table to the given PrintWriter.
-
printRecords(PrintWriter, int)
- Print table records to the given PrintWriter and stop after printing specified
number of records.
-
printRecords(PrintWriter, int, boolean)
- Print table records to the given PrintWriter and stop after printing specified
number of records.
-
removeRecord(String)
- Removes IbsRecord (for the given key) from the table.
-
removeRecords()
- WARNING: Removes all records from the table so that it contains no keys/records.
-
setPrintPreferences(String, String)
- Set print preferences before starting printRecords.
-
setUniqueKeyColumn(int)
- Identify the column that should be used as a Unique Key column.
BookMarkRecord
public int BookMarkRecord
IbsTable
public IbsTable(String table_name)
- Constructor for IbsTable class.
- Parameters:
- table_name - A name given to this IbsTable object.
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.
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.
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;
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
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
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.
getTableName
public String getTableName()
- Returns table name for the current IbsTable object.
- Returns:
- Table Name property of the current object.
getTableColumns
public IbsTableColumns getTableColumns()
- Returns an IbsTableColumns object for the current table.
- Returns:
- An IbsTableColumns object containing names of table columns
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.
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.
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.
getKeys
public Enumeration getKeys()
- Returns an enumeration of all keys in the current table.
- Returns:
- An Enumeration of table keys ( String objects ).
getRecords
public Enumeration getRecords()
- Returns an enumeration of all records in the current table.
- Returns:
- An Enumeration of table records ( IbsRecord objects ).
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.
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.
removeRecords
public void removeRecords()
- WARNING: Removes all records from the table so that it contains no keys/records.
getNextUniqueKey
public int getNextUniqueKey()
- Generates next unique key for the table and returns it.
- Returns:
- An integer unique key for the table.
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.
countRecords
public int countRecords()
- Returns record count for records in current table.
- Returns:
- An integer value representating size of the current table.
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.
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.
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.
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
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