org.erowid.sperowider.hsqldb
Class SetTable

java.lang.Object
  extended byorg.erowid.sperowider.hsqldb.BasicTable
      extended byorg.erowid.sperowider.hsqldb.SetTable

public class SetTable
extends BasicTable

This class presents some Set-like functionality wrapped around an HSQLDB table.

Version:
: $Header: /cvsroot/sperowider/SPEROWIDER_MODULE/javasource/org/erowid/sperowider/hsqldb/SetTable.java,v 1.7 2005/05/16 01:20:33 gurustu Exp $
Author:
: $Author: gurustu $

Field Summary
 
Fields inherited from class org.erowid.sperowider.hsqldb.BasicTable
CACHED, MEMORY
 
Constructor Summary
SetTable(String name, Connection connection, int mode)
          Constructor, gets everything ready for usage.
 
Method Summary
 void add(String value)
          Adds a value to this set.
 boolean contains(String value)
          Returns true if the set contains this key.
 void create()
          Creates a new table in the backing database corresponding to this object.
 Collection getData()
          Returns a copy of the data in this table, as a List of String.
 int getRowCount()
          Returns the number of rows in this table, or -1 if the table has not been created.
 String remove()
          Chooses an arbitrary value in this list, removes it from the list, and returns it.
 void remove(String value)
          Removes a value from this set.
 
Methods inherited from class org.erowid.sperowider.hsqldb.BasicTable
execSQL, getConnection, getMode, getName, getTableCreatePrefix, prepareStatement, tableExists
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SetTable

public SetTable(String name,
                Connection connection,
                int mode)
         throws SQLException
Constructor, gets everything ready for usage.

Method Detail

getRowCount

public int getRowCount()
Returns the number of rows in this table, or -1 if the table has not been created.


create

public void create()
            throws SQLException
Creates a new table in the backing database corresponding to this object.

Throws:
SQLException

contains

public boolean contains(String value)
Returns true if the set contains this key.


add

public void add(String value)
Adds a value to this set.


remove

public void remove(String value)
Removes a value from this set.


getData

public Collection getData()
Returns a copy of the data in this table, as a List of String.


remove

public String remove()
Chooses an arbitrary value in this list, removes it from the list, and returns it.


spero logo small Sperowider is
© 2005 Erowid.org