|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.ObjectdbStat.StatDriver
Responsible for the logic to compute the aggregate statistics for each stock and to send updates to the database to load those statistics into the table.
| Field Summary | |
private java.util.HashMap |
statHash
a hash to hold the statistics being computed with keys as 'statKeys' |
private static java.lang.String[] |
statKeys
the list of keys to a hashmap to hold statistics as they are computed |
private java.util.ArrayList |
tickerData
Collection to hold the data returned by a query. |
private java.util.ArrayList |
tickerList
collection to hold all the tickers for which data is to be queried from the database (to use to compute statistics on) |
private java.util.ArrayList |
updateQueries
collection of array lists where each array list will contain a set number of batch update statemetns that can be fired off to the database to perform in batch mode. |
| Constructor Summary | |
StatDriver()
|
|
| Method Summary | |
private void |
computeStatistics()
Computes the statistics for each stock, which has its data from the database stored in the class variable tickerData. |
private void |
initializeStorage()
Initialize the hashmap containing the statistics to be computed. |
private boolean |
loadTickerList()
Gets the list of tickers and load them in the class variable tickerList for which can be iterated through to compute statistics |
private void |
loadTickerQueryResults(java.lang.String stockTicker)
Runs a query for the stock passed and loads the rows into the class variable tickerData with each object encapsulating a single row from the results set. |
private void |
printHash(java.util.HashMap h)
Debug feature to print out the hash in an orderly manner |
void |
runStatDriver(WaitMessage wm)
main function to run the statistics driver functions. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
private static java.lang.String[] statKeys
private java.util.HashMap statHash
private java.util.ArrayList tickerList
private java.util.ArrayList tickerData
Used so that the result set handle can be returned to the database.
private java.util.ArrayList updateQueries
| Constructor Detail |
public StatDriver()
| Method Detail |
public void runStatDriver(WaitMessage wm)
Gets a list of tickers, iteratively queries for the relevant data pertaining to each stock, computes statistics on each ticker, and loads these values back in to the database.
private boolean loadTickerList()
private void loadTickerQueryResults(java.lang.String stockTicker)
stockTicker - the name of the ticker for which to compute statistics onprivate void computeStatistics()
The computed statistics are stored the hash map class variable statHash for later insert into the database.
private void initializeStorage()
Call to clear the hash map each time a new stock is about to be analyzed.
private void printHash(java.util.HashMap h)
h - the hashmap which to print
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||