de.unidu.is.util
Class DBSet

java.lang.Object
  extended byde.unidu.is.util.DBSet
All Implemented Interfaces:
java.util.Collection, java.util.Set

public class DBSet
extends java.lang.Object
implements java.util.Set

A set which is backed by a RDBMS table.

This class uses a table wich one column (the default name is "value", but this can be changed) with the SQL type "text" for storing the set. This means that this set can only be used with strings, or with objects for which the string representation is sufficient.

Since:
2003-06-22
Version:
$Revision: 1.5 $, $Date: 2005/02/21 17:29:29 $
Author:
Henrik Nottelmann

Field Summary
protected  java.lang.String col
          The column name used for this set.
protected  DB db
          The DB which is used for backing this set.
protected  java.lang.String tableName
          The table used for backing this set.
 
Constructor Summary
DBSet(DB db, java.lang.String tableName)
          Creates a new instance (and the corresponding table, if it does not exists), and sets the column to "value".
DBSet(DB db, java.lang.String tableName, java.lang.String col)
          Creates a new instance (and the corresponding table, if it does not exists), and sets the column name.
 
Method Summary
 boolean add(java.lang.Object o)
           
 boolean addAll(java.util.Collection c)
           
 void clear()
           
 boolean contains(java.lang.Object o)
           
 boolean containsAll(java.util.Collection c)
           
 void delete()
          Deletes the corresponding table.
 boolean equals(java.lang.Object obj)
           
 int hashCode()
           
 boolean isEmpty()
           
 java.util.Iterator iterator()
           
 boolean remove(java.lang.Object o)
           
 boolean removeAll(java.util.Collection c)
           
 boolean retainAll(java.util.Collection c)
           
 int size()
           
 java.lang.Object[] toArray()
           
 java.lang.Object[] toArray(java.lang.Object[] a)
           
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

db

protected DB db
The DB which is used for backing this set.


tableName

protected java.lang.String tableName
The table used for backing this set.


col

protected java.lang.String col
The column name used for this set.

Constructor Detail

DBSet

public DBSet(DB db,
             java.lang.String tableName)
Creates a new instance (and the corresponding table, if it does not exists), and sets the column to "value".

Parameters:
db - DB used by this set
tableName - name of the table used by this set

DBSet

public DBSet(DB db,
             java.lang.String tableName,
             java.lang.String col)
Creates a new instance (and the corresponding table, if it does not exists), and sets the column name.

Parameters:
db - DB used by this set
tableName - name of the table used by this set
col - column name
Method Detail

delete

public void delete()
Deletes the corresponding table.


size

public int size()
Specified by:
size in interface java.util.Set

isEmpty

public boolean isEmpty()
Specified by:
isEmpty in interface java.util.Set

contains

public boolean contains(java.lang.Object o)
Specified by:
contains in interface java.util.Set

iterator

public java.util.Iterator iterator()
Specified by:
iterator in interface java.util.Set

toArray

public java.lang.Object[] toArray()
Specified by:
toArray in interface java.util.Set

toArray

public java.lang.Object[] toArray(java.lang.Object[] a)
Specified by:
toArray in interface java.util.Set

add

public boolean add(java.lang.Object o)
Specified by:
add in interface java.util.Set

remove

public boolean remove(java.lang.Object o)
Specified by:
remove in interface java.util.Set

containsAll

public boolean containsAll(java.util.Collection c)
Specified by:
containsAll in interface java.util.Set

addAll

public boolean addAll(java.util.Collection c)
Specified by:
addAll in interface java.util.Set

retainAll

public boolean retainAll(java.util.Collection c)
Specified by:
retainAll in interface java.util.Set

removeAll

public boolean removeAll(java.util.Collection c)
Specified by:
removeAll in interface java.util.Set

clear

public void clear()
Specified by:
clear in interface java.util.Set

equals

public boolean equals(java.lang.Object obj)
Specified by:
equals in interface java.util.Set

hashCode

public int hashCode()
Specified by:
hashCode in interface java.util.Set

toString

public java.lang.String toString()