example.stock
Class AlertDatabase

java.lang.Object
  extended by example.stock.Database
      extended by example.stock.AlertDatabase

public class AlertDatabase
extends Database

This class provides an implementation of the Database class specific to alert records.


Field Summary
 
Fields inherited from class example.stock.Database
database, lastID, rc, recordIDs
 
Constructor Summary
AlertDatabase()
          Default Constructor
 
Method Summary
 javax.microedition.rms.RecordEnumeration enumerateRecords(java.lang.String tkrSymbol, int price)
          Get a RecordEnumeration of records in the database who match the AlertFilter conditions
 void removeUselessAlerts(java.lang.String tkrSymbol)
          This methods cleans out the database of all alerts that match the tkrSymbol passed in.
 
Methods inherited from class example.stock.Database
add, cleanUp, close, delete, getNumRecords, open, search, update
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AlertDatabase

public AlertDatabase()
Default Constructor

Method Detail

removeUselessAlerts

public void removeUselessAlerts(java.lang.String tkrSymbol)

This methods cleans out the database of all alerts that match the tkrSymbol passed in. An appropriate use would be when removing a stock from the database, all alerts for that stock are no longer valid, so call this method then.

Parameters:
tkrSymbol - The name of the stock to match with alerts

enumerateRecords

public javax.microedition.rms.RecordEnumeration enumerateRecords(java.lang.String tkrSymbol,
                                                                 int price)
                                                          throws javax.microedition.rms.RecordStoreNotOpenException

Get a RecordEnumeration of records in the database who match the AlertFilter conditions

Parameters:
tkrSymbol - The name of the stock to retrieve alerts for
price - The price of the stock to retrieve alerts for
Returns:
RecordEnumeration of all stock records that match the RecordFilter
Throws:
RecordStoreNotOpenException - is thrown when trying to close a RecordStore that is not open
javax.microedition.rms.RecordStoreNotOpenException