gov.lbl.fastbit
Class FastBit

java.lang.Object
  extended by gov.lbl.fastbit.FastBit

public class FastBit
extends java.lang.Object

A facade for accessing some FastBit functions from java. This class exports some functions from @c ibis::part and @c ibis::query classes to java. A very small example is available in java/milky.java.


Nested Class Summary
 class FastBit.QueryHandle
          An auxiliary class to hold handles to query objects.
 
Constructor Summary
FastBit(java.lang.String rcfile)
          Constructor.
 
Method Summary
 int add_bytes(java.lang.String colname, byte[] arr)
          Add values to a values to a byte-valued column.
 int add_doubles(java.lang.String colname, double[] arr)
          Add the name column containing double values.
 int add_floats(java.lang.String colname, float[] arr)
          Add values to a values to a float-valued column.
 int add_ints(java.lang.String colname, int[] arr)
          Add values to a values to a int-valued column.
 int add_longs(java.lang.String colname, long[] arr)
          Add values to a values to a long-valued column.
 int add_shorts(java.lang.String colname, short[] arr)
          Add values to a values to a short-valued column.
 int build_index(java.lang.String dir, java.lang.String col, java.lang.String opt)
          Build an index for the named column.
 int build_indexes(java.lang.String dir, java.lang.String opt)
          Build indexes for all columns in the specified directory.
 FastBit.QueryHandle build_query(java.lang.String select, java.lang.String from, java.lang.String where)
          Build a new query object.
protected  void cleanup()
          Cleanup resources hold by FastBit services.
 int destroy_query(FastBit.QueryHandle handle)
          Destroy a query object.
protected  void finalize()
          Perform the final clean up job.
 java.lang.String get_logfile()
          Retrieve the name of the log file.
 int get_message_level()
          Return the current message level used by FastBit.
 byte[] get_qualified_bytes(FastBit.QueryHandle handle, java.lang.String col)
          Retrieve the values of the named column from the rows satisfying the query conditions.
 double[] get_qualified_doubles(FastBit.QueryHandle handle, java.lang.String col)
          Retrieve values as doubles.
 float[] get_qualified_floats(FastBit.QueryHandle handle, java.lang.String col)
          Retrieve values as floats.
 int[] get_qualified_ints(FastBit.QueryHandle handle, java.lang.String col)
          Retrieve values as ints.
 long[] get_qualified_longs(FastBit.QueryHandle handle, java.lang.String col)
          Retrieve values as longs.
 short[] get_qualified_shorts(FastBit.QueryHandle handle, java.lang.String col)
          Retrieve values as shorts.
 int get_result_size(FastBit.QueryHandle handle)
          Return the number of records/rows satisfying the query conditions.
protected  void init(java.lang.String rcfile)
          Function to initialize required data structure on C++ side.
 int number_of_columns(java.lang.String dir)
          Compute the number of columns in the specified directory.
 int number_of_rows(java.lang.String dir)
          Compute the number of rows in the specified directory.
 int purge_index(java.lang.String dir, java.lang.String col)
          Remove the index files associated with the specified column
 int purge_indexes(java.lang.String dir)
          Remove all existing index files.
 int set_logfile(java.lang.String filename)
          Change the name of the log file.
 int set_message_level(int level)
          Change the message level to the specified value.
 int write_buffer(java.lang.String dir)
          Write the buffer to the named directory.
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FastBit

public FastBit(java.lang.String rcfile)
Constructor. The argument to the constructor can be an empty string.

Method Detail

build_indexes

public int build_indexes(java.lang.String dir,
                         java.lang.String opt)
Build indexes for all columns in the specified directory.


purge_indexes

public int purge_indexes(java.lang.String dir)
Remove all existing index files.


build_index

public int build_index(java.lang.String dir,
                       java.lang.String col,
                       java.lang.String opt)
Build an index for the named column.


purge_index

public int purge_index(java.lang.String dir,
                       java.lang.String col)
Remove the index files associated with the specified column


build_query

public FastBit.QueryHandle build_query(java.lang.String select,
                                       java.lang.String from,
                                       java.lang.String where)
Build a new query object. The three arguments mirros the three clauses of a simple SQL select statement.


destroy_query

public int destroy_query(FastBit.QueryHandle handle)
Destroy a query object. Reclaims all resources associated with the query object.


get_result_size

public int get_result_size(FastBit.QueryHandle handle)
Return the number of records/rows satisfying the query conditions.


get_qualified_bytes

public byte[] get_qualified_bytes(FastBit.QueryHandle handle,
                                  java.lang.String col)
Retrieve the values of the named column from the rows satisfying the query conditions. If the column has appeared in the select clause in @c build_query, then the values are guarateed to not contain any null values. If there is no null values to consider, then there is no need to specify anything in the select clause when building the query.


get_qualified_shorts

public short[] get_qualified_shorts(FastBit.QueryHandle handle,
                                    java.lang.String col)
Retrieve values as shorts. @sa get_qualified_bytes.


get_qualified_ints

public int[] get_qualified_ints(FastBit.QueryHandle handle,
                                java.lang.String col)
Retrieve values as ints. @sa get_qualified_bytes.


get_qualified_longs

public long[] get_qualified_longs(FastBit.QueryHandle handle,
                                  java.lang.String col)
Retrieve values as longs.


get_qualified_floats

public float[] get_qualified_floats(FastBit.QueryHandle handle,
                                    java.lang.String col)
Retrieve values as floats. @sa get_qualified_bytes.


get_qualified_doubles

public double[] get_qualified_doubles(FastBit.QueryHandle handle,
                                      java.lang.String col)
Retrieve values as doubles. @sa get_qualified_bytes.


write_buffer

public int write_buffer(java.lang.String dir)
Write the buffer to the named directory. It also flushes the current buffer. All functions calls to various add functions are assumed to be adding to a single FastBit data partition. This set of functions are intended for adding rows to a data partition. Considerable overhead is involved in creating the files when the function write_buffer is invoked, therefore it is not recommended for writing a single row. Additionally, since all data values are stored in a memory buffer, one can not write a large number of records in one shot.


add_doubles

public int add_doubles(java.lang.String colname,
                       double[] arr)
Add the name column containing double values. Note that if the target directory contains values already, the type specified here must match exactly.


add_floats

public int add_floats(java.lang.String colname,
                      float[] arr)
Add values to a values to a float-valued column.


add_longs

public int add_longs(java.lang.String colname,
                     long[] arr)
Add values to a values to a long-valued column.


add_ints

public int add_ints(java.lang.String colname,
                    int[] arr)
Add values to a values to a int-valued column.


add_shorts

public int add_shorts(java.lang.String colname,
                      short[] arr)
Add values to a values to a short-valued column.


add_bytes

public int add_bytes(java.lang.String colname,
                     byte[] arr)
Add values to a values to a byte-valued column.


number_of_rows

public int number_of_rows(java.lang.String dir)
Compute the number of rows in the specified directory.


number_of_columns

public int number_of_columns(java.lang.String dir)
Compute the number of columns in the specified directory.


get_message_level

public int get_message_level()
Return the current message level used by FastBit.


set_message_level

public int set_message_level(int level)
Change the message level to the specified value. The default value is 0. As the message level increases, more message will be printed. Returns the current message level before the change is to take place.


set_logfile

public int set_logfile(java.lang.String filename)
Change the name of the log file.


get_logfile

public java.lang.String get_logfile()
Retrieve the name of the log file.


init

protected void init(java.lang.String rcfile)
Function to initialize required data structure on C++ side.


cleanup

protected void cleanup()
Cleanup resources hold by FastBit services.


finalize

protected void finalize()
Perform the final clean up job.

Overrides:
finalize in class java.lang.Object