|
|||||||||
| Home >> All >> com >> clra >> [ web overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
com.clra.web
Class BoatSet

java.lang.Objectcom.clra.web.BoatSet
- All Implemented Interfaces:
- java.util.Collection, java.lang.Iterable, java.util.Set, java.util.SortedSet
- public class BoatSet
- extends java.lang.Object
- implements java.util.SortedSet
- extends java.lang.Object
A collection of "finder" methods that return read-only, sorted sets of boats.
FIXME: when this class changes to a "Session-like" design, make sure it becomes Serializable.
- Version:
- $Id: BoatSet.java,v 1.4 2003/02/26 03:38:46 rphall Exp $
| Field Summary | |
private static java.lang.String |
base
|
private java.util.SortedSet |
data
The current implementations return data in an in-memory collections. |
private static org.apache.log4j.Category |
theLog
|
| Constructor Summary | |
private |
BoatSet()
BoatSet instances are created by static "finder" methods |
| Method Summary | |
boolean |
add(java.lang.Object o)
Adds the specified element to the set if it is not already present (optional operation). |
boolean |
addAll(java.util.Collection c)
Adds all of the elements of the given collection to this set (optional operation). |
void |
clear()
Removes all elements from this set (optional operation). |
java.util.Comparator |
comparator()
Returns the comparator associated with this sorted set, or null if it uses its elements' natural ordering. |
boolean |
contains(java.lang.Object o)
Returns true if this set contains the specified element. |
boolean |
containsAll(java.util.Collection c)
Returns true if this set contains all of the elements of the specified collection. |
boolean |
equals(java.lang.Object o)
Compares the specified object with this set for equality. |
static BoatSet |
findAllActiveBoats()
Finds all active boats of the CLRA. |
static com.clra.rowing.BoatView |
findBoatById(int id)
Finds the boat that has the given id. |
static com.clra.rowing.BoatView |
findBoatByName(java.lang.String name)
Finds the boat that has the given name. |
java.lang.Object |
first()
Returns the first (lowest) element currently in this sorted set. |
int |
hashCode()
Returns the hash code value for this set. |
java.util.SortedSet |
headSet(java.lang.Object toElement)
Returns a view of the portion of this sorted set whose elements are strictly less than toElement. |
boolean |
isEmpty()
Returns true if this set contains no elements. |
java.util.Iterator |
iterator()
Returns an iterator over the (sorted) elements in this set. |
java.lang.Object |
last()
Returns the last (highest) element currently in this sorted set. |
private static com.clra.rowing.BoatView |
loadBoat(java.sql.PreparedStatement stmt)
Loads an in-memory object from a database using the specified SQL |
private static void |
loadBoatSet(java.sql.PreparedStatement stmt,
java.util.SortedSet set)
Loads an in-memory set from a database using the specified SQL |
private static com.clra.rowing.BoatView |
mapRowToBoat(java.sql.ResultSet rs)
Maps a row of SQL ResultSet to a BoatView object |
boolean |
remove(java.lang.Object o)
Removes the specified element from this set (optional operation). |
boolean |
removeAll(java.util.Collection c)
Removes from this set all elements contained in the specified collection (optional operation). |
boolean |
retainAll(java.util.Collection c)
Retains only the elements in this set that are also in the specified collection (optional operation). |
int |
size()
Returns the number of elements in this set (its cardinality). |
java.util.SortedSet |
subSet(java.lang.Object fromElement,
java.lang.Object toElement)
Returns a view of the portion of this sorted set whose elements range from fromElement, inclusive, to toElement, exclusive. |
java.util.SortedSet |
tailSet(java.lang.Object fromElement)
Returns a view of the portion of this sorted set whose elements are greater than or equal to fromElement. |
java.lang.Object[] |
toArray()
Returns an array containing all of the elements in this set. |
java.lang.Object[] |
toArray(java.lang.Object[] a)
Returns an array containing all of the elements in this set whose runtime type is that of the specified array. |
| Methods inherited from class java.lang.Object |
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
base
private static final java.lang.String base
theLog
private static final org.apache.log4j.Category theLog
data
private final java.util.SortedSet data
- The current implementations return data in an in-memory collections.
Since the underlaying Boat database table may already be
cached in memory, this can lead to duplicate caching. Future
implementations should avoid in-memory duplicates by implementing
SortedSet and Iterator methods directly in SQL.
| Constructor Detail |
BoatSet
private BoatSet()
- BoatSet instances are created by static "finder" methods
| Method Detail |
findAllActiveBoats
public static BoatSet findAllActiveBoats() throws WebException
- Finds all active boats of the CLRA. Boats are sorted by name
(the natural comparator for boats).
findBoatById
public static com.clra.rowing.BoatView findBoatById(int id) throws WebException
- Finds the boat that has the given id. This "finder" returns at most
one boat.
findBoatByName
public static com.clra.rowing.BoatView findBoatByName(java.lang.String name) throws WebException
- Finds the boat that has the given name. Names
are unique, so this "finder" returns at most one boat.
comparator
public java.util.Comparator comparator()
- Returns the comparator associated with this sorted set, or
null if it uses its elements' natural ordering.
- Specified by:
comparatorin interfacejava.util.SortedSet
subSet
public java.util.SortedSet subSet(java.lang.Object fromElement, java.lang.Object toElement)
- Returns a view of the portion of this sorted set whose elements range
from fromElement, inclusive, to toElement, exclusive.
- Specified by:
subSetin interfacejava.util.SortedSet
headSet
public java.util.SortedSet headSet(java.lang.Object toElement)
- Returns a view of the portion of this sorted set whose elements are
strictly less than toElement.
- Specified by:
headSetin interfacejava.util.SortedSet
tailSet
public java.util.SortedSet tailSet(java.lang.Object fromElement)
- Returns a view of the portion of this sorted set whose elements are
greater than or equal to fromElement.
- Specified by:
tailSetin interfacejava.util.SortedSet
first
public java.lang.Object first()
- Returns the first (lowest) element currently in this sorted set.
- Specified by:
firstin interfacejava.util.SortedSet
last
public java.lang.Object last()
- Returns the last (highest) element currently in this sorted set.
- Specified by:
lastin interfacejava.util.SortedSet
size
public int size()
- Returns the number of elements in this set (its cardinality). If this
set contains more than Integer.MAX_VALUE elements, returns
Integer.MAX_VALUE.
- Specified by:
sizein interfacejava.util.Set
isEmpty
public boolean isEmpty()
- Returns true if this set contains no elements.
- Specified by:
isEmptyin interfacejava.util.Set
contains
public boolean contains(java.lang.Object o)
- Returns true if this set contains the specified element.
- Specified by:
containsin interfacejava.util.Set
iterator
public java.util.Iterator iterator()
- Returns an iterator over the (sorted) elements in this set.
- Specified by:
iteratorin interfacejava.util.Set
toArray
public java.lang.Object[] toArray()
- Returns an array containing all of the elements in this set.
- Specified by:
toArrayin interfacejava.util.Set
toArray
public java.lang.Object[] toArray(java.lang.Object[] a)
- Returns an array containing all of the elements in this set whose
runtime type is that of the specified array.
- Specified by:
toArrayin interfacejava.util.Set
containsAll
public boolean containsAll(java.util.Collection c)
- Returns true if this set contains all of the elements of the
specified collection.
- Specified by:
containsAllin interfacejava.util.Set
equals
public boolean equals(java.lang.Object o)
- Compares the specified object with this set for equality.
- Specified by:
equalsin interfacejava.util.Set
hashCode
public int hashCode()
- Returns the hash code value for this set. The hash code of a set is
defined to be the sum of the hash codes of the elements in the set.
- Specified by:
hashCodein interfacejava.util.Set
add
public boolean add(java.lang.Object o)
- Description copied from interface:
java.util.Set - Adds the specified element to the set if it is not already present
(optional operation). In particular, the comparison algorithm is
o == null ? e == null : o.equals(e). Sets need not permit all values, and may document what exceptions will be thrown if a value is not permitted.- Specified by:
addin interfacejava.util.Set
remove
public boolean remove(java.lang.Object o)
- Description copied from interface:
java.util.Set - Removes the specified element from this set (optional operation). If
an element e exists,
o == null ? e == null : o.equals(e), it is removed from the set.- Specified by:
removein interfacejava.util.Set
addAll
public boolean addAll(java.util.Collection c)
- Description copied from interface:
java.util.Set - Adds all of the elements of the given collection to this set (optional
operation). If the argument is also a Set, this returns the mathematical
union of the two. The behavior is unspecified if the set is
modified while this is taking place.
- Specified by:
addAllin interfacejava.util.Set
retainAll
public boolean retainAll(java.util.Collection c)
- Description copied from interface:
java.util.Set - Retains only the elements in this set that are also in the specified
collection (optional operation). If the argument is also a set, this
performs the intersection of the two sets.
- Specified by:
retainAllin interfacejava.util.Set
removeAll
public boolean removeAll(java.util.Collection c)
- Description copied from interface:
java.util.Set - Removes from this set all elements contained in the specified collection
(optional operation). If the argument is a set, this returns the
asymmetric set difference of the two sets.
- Specified by:
removeAllin interfacejava.util.Set
clear
public void clear()
- Description copied from interface:
java.util.Set - Removes all elements from this set (optional operation). This set will
be empty afterwords, unless an exception occurs.
- Specified by:
clearin interfacejava.util.Set
loadBoat
private static com.clra.rowing.BoatView loadBoat(java.sql.PreparedStatement stmt) throws java.sql.SQLException, WebException
- Loads an in-memory object from a database using the specified SQL
loadBoatSet
private static void loadBoatSet(java.sql.PreparedStatement stmt, java.util.SortedSet set) throws java.sql.SQLException, WebException
- Loads an in-memory set from a database using the specified SQL
mapRowToBoat
private static com.clra.rowing.BoatView mapRowToBoat(java.sql.ResultSet rs) throws java.sql.SQLException, WebException
- Maps a row of SQL ResultSet to a BoatView object
|
|||||||||
| Home >> All >> com >> clra >> [ web overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
JAVADOC
com.clra.web.BoatSet