com.exponto.jstock
Class LogDataSeries

java.lang.Object
  extended bycom.exponto.jstock.Series
      extended bycom.exponto.jstock.LogDataSeries

public class LogDataSeries
extends Series


Field Summary
 java.util.ArrayList logStock
           
 
Constructor Summary
LogDataSeries()
          Creates new empty daily LogDataseries
LogDataSeries(boolean b)
          Creates new LogDataseries with the isWeekly paramter set to b.
LogDataSeries(double[] closingPrices)
          FOR TEST PURPOSES ONLY!!! Used to easily create a logDataSeries for testing other functions
 
Method Summary
 java.lang.String debugInfo()
           
 int findNumberInPeriode(Date d)
          Finds the position in the current periode to the LogTradingData with a date that is equl to the date d.
 void findYScaleLimits(int height)
          Should be possible to indicate what range the limits shall be calculated from Calculates values used to scale the y-axis of the graph.
 int getEndOfPeriode()
           
 java.lang.String getExchange()
           
 long getMaxVol()
           
 LogTradingData getNextLTD()
          Finds the next logTradingData in a series.
 int getNextWeekNumber()
          Searches for the next week number related to the currentPosistion in the in a dataseries.
 LogTradingData getResult(int index)
          Retrieves data for a day.
 int getStartOfPeriode()
           
 java.lang.String getTicker()
           
 TickerID getTickerId()
           
 double getYMax()
           
 double getYMin()
           
 boolean hasNextLTD()
          Returns true if there is more elements in a series (window) false if the currentPosistion is at the last element.
 boolean isWeekly()
           
 void moveToStartInCurrentPeriode()
           
 int numberOfDaysInFirstWeek()
          Finds the number of days of the first week present in this dataseries
 void resetCurrentPeriode()
           
 void rotate()
          Rotates the elements in this ArrayList so that the first becomes the last an vice versa.
 void setCurrentPeriode()
          Sets the current periode to the whole series
 void setCurrentPeriode(int numberOfDays)
          Sets the current periode to the latest date and numberOfDays back
 void setCurrentPeriode(int start, int stop)
          Sets the current periode
 void setExchange(java.lang.String string)
           
 void setTicker(java.lang.String string)
           
 void setTickerId(TickerID id)
           
 void storeResult(LogTradingData lTD)
          Stores data for a single day at the end of an arraylist.
 void storeResultWeekly(LogTradingData lTD)
           
 
Methods inherited from class com.exponto.jstock.Series
base, findSignificant, roundToStepSize, stepSize
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

logStock

public java.util.ArrayList logStock
Constructor Detail

LogDataSeries

public LogDataSeries()
Creates new empty daily LogDataseries


LogDataSeries

public LogDataSeries(boolean b)
Creates new LogDataseries with the isWeekly paramter set to b.


LogDataSeries

public LogDataSeries(double[] closingPrices)
FOR TEST PURPOSES ONLY!!! Used to easily create a logDataSeries for testing other functions

Parameters:
closingPrices -
Method Detail

storeResult

public void storeResult(LogTradingData lTD)
Stores data for a single day at the end of an arraylist. Also insert dummy data (not NULL) if data for some days between currentDate and lTD.day is missing

Parameters:
lTD - Trading data to store

storeResultWeekly

public void storeResultWeekly(LogTradingData lTD)

setCurrentPeriode

public void setCurrentPeriode()
Sets the current periode to the whole series


setCurrentPeriode

public void setCurrentPeriode(int numberOfDays)
Sets the current periode to the latest date and numberOfDays back


setCurrentPeriode

public void setCurrentPeriode(int start,
                              int stop)
Sets the current periode


resetCurrentPeriode

public void resetCurrentPeriode()

moveToStartInCurrentPeriode

public void moveToStartInCurrentPeriode()

getNextLTD

public LogTradingData getNextLTD()
Finds the next logTradingData in a series. Returns null if somehow the currentPoistion is larger then the endOfPeriode Does not increment currentPositionInPeriode if it returns null, otherwise it does.

Returns:
the next LogTradingData

hasNextLTD

public boolean hasNextLTD()
Returns true if there is more elements in a series (window) false if the currentPosistion is at the last element. Does not increment currentPositionInPeriode

Returns:
true if there is more elements, false otherwise.

getEndOfPeriode

public int getEndOfPeriode()

getStartOfPeriode

public int getStartOfPeriode()

isWeekly

public boolean isWeekly()
Returns:
true if the current series is a weekly series

findYScaleLimits

public void findYScaleLimits(int height)
Should be possible to indicate what range the limits shall be calculated from Calculates values used to scale the y-axis of the graph. Uses methods from the super class.


getResult

public LogTradingData getResult(int index)
Retrieves data for a day. Aviod using this if possible.

Parameters:
index - Index in the arraylist of the wanted day
Returns:
LogTradingData for the day.

findNumberInPeriode

public int findNumberInPeriode(Date d)
Finds the position in the current periode to the LogTradingData with a date that is equl to the date d.

Parameters:
d - Date to look for
Returns:
position in current periode

getMaxVol

public long getMaxVol()

rotate

public void rotate()
Rotates the elements in this ArrayList so that the first becomes the last an vice versa.


numberOfDaysInFirstWeek

public int numberOfDaysInFirstWeek()
Finds the number of days of the first week present in this dataseries

Returns:
integer between 1 and 7 (monday to sunday)

getNextWeekNumber

public int getNextWeekNumber()
Searches for the next week number related to the currentPosistion in the in a dataseries. This may seem like an akward way to increment the weeknumber, but it also searches for new highs and lows in the periode. Also handles if there are 52 or 53 weeks in a year.

Returns:
integer The next weeknumber

getExchange

public java.lang.String getExchange()
Returns:
The exchange name

getTicker

public java.lang.String getTicker()
Returns:
The ticker name

getTickerId

public TickerID getTickerId()
Returns:
The TickerId class

setExchange

public void setExchange(java.lang.String string)
Parameters:
string - The exchange name

setTicker

public void setTicker(java.lang.String string)
Parameters:
string - ticker name

setTickerId

public void setTickerId(TickerID id)

debugInfo

public java.lang.String debugInfo()

getYMin

public double getYMin()
Returns:
the logaritmic value of the lowest y value used in the displayed area.

getYMax

public double getYMax()
Returns:
the logaritmic value of the highest y value used in the displayed area.


Copyright © 2004 Kaare Ranum