com.exponto.jstock.db
Class JstockDB

java.lang.Object
  extended bycom.exponto.jstock.db.JstockDB

public class JstockDB
extends java.lang.Object

Creates and ecexute all sql statements. In order to reduce queries to the db, a cople of the smaller key tables are kept in memmory

Author:
kaare

Method Summary
 int createTicker(java.lang.String ticker, java.lang.String exchange)
           
static JstockDB getInstance()
           
 java.util.ArrayList loadIndicatorParameters(TickerID tId, java.lang.String panelName)
          Finds all ticker spesific indicator parameter for a TickerID
 java.util.ArrayList loadLines(TickerID tId, java.lang.String panelName, java.lang.String indicatorName, int hashCode)
          Loads lines from the database
 java.lang.String loadNotes(TickerID tId)
           
 java.util.ArrayList loadWatchList()
           
 void saveIndicatorParameters(java.util.ArrayList parameterList, TickerID tId, java.lang.String panelName)
          Updates the database with the content from the ArrayList.
 java.util.ArrayList saveLines(TickerID tId, java.lang.String panelName, java.lang.String indicatorName, int hashCode, java.util.ArrayList linesArray)
          Saves any modification to the lines in the database.
 java.lang.String saveNotes(TickerID tId, java.lang.String text)
           
 java.lang.String toggleWatchList(TickerID tId)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getInstance

public static JstockDB getInstance()
Returns:
the only instance of JstockDB

loadIndicatorParameters

public java.util.ArrayList loadIndicatorParameters(TickerID tId,
                                                   java.lang.String panelName)
Finds all ticker spesific indicator parameter for a TickerID

Parameters:
tId - the tickerId which to look for
panelName -
Returns:
an ArrayList with String[2]'s containg parametername and a parameter

saveIndicatorParameters

public void saveIndicatorParameters(java.util.ArrayList parameterList,
                                    TickerID tId,
                                    java.lang.String panelName)
Updates the database with the content from the ArrayList. All DBIndicatorParameters marked as deleted will be deleted from the db, new ones will be inserted and existing ones will be updated, even if unchanged.

Parameters:
tId - - the TickerID
panelName - - The panelName

loadWatchList

public java.util.ArrayList loadWatchList()

toggleWatchList

public java.lang.String toggleWatchList(TickerID tId)

loadNotes

public java.lang.String loadNotes(TickerID tId)

saveNotes

public java.lang.String saveNotes(TickerID tId,
                                  java.lang.String text)

loadLines

public java.util.ArrayList loadLines(TickerID tId,
                                     java.lang.String panelName,
                                     java.lang.String indicatorName,
                                     int hashCode)
Loads lines from the database

Parameters:
tId - the tickerId
indicatorName - - the IndicatorName
hashCode - - hashcode of the indicator parameters used to calculate the indicator
Returns:
An arraylist with all lines for a spesific ticker, panel and indicator.

saveLines

public java.util.ArrayList saveLines(TickerID tId,
                                     java.lang.String panelName,
                                     java.lang.String indicatorName,
                                     int hashCode,
                                     java.util.ArrayList linesArray)
Saves any modification to the lines in the database. If there are any new lines, the lines will be (re)read from the database.

Parameters:
tId - the tickerId
linesArray - - the lines to save
Returns:
The lines as they would be if loaded from database

createTicker

public int createTicker(java.lang.String ticker,
                        java.lang.String exchange)


Copyright © 2004 Kaare Ranum