net.sourceforge.eclipsetrader.core.db
Class Bar

java.lang.Object
  extended byjava.util.Observable
      extended bynet.sourceforge.eclipsetrader.core.db.PersistentObject
          extended bynet.sourceforge.eclipsetrader.core.db.Bar

public class Bar
extends PersistentObject

Price bar data.

Since:
1.0
Author:
Marco Maccaferri

Constructor Summary
Bar()
          Constructs an empty bar object.
Bar(Bar bar)
          Constructs a bar object with the data from the specified object.
Bar(java.util.Date date, double open, double high, double low, double close, long volume)
          Constructs a bar object with the specified data.
Bar(double open, double high, double low, double close)
          Constructs a bar object with the specified data.
Bar(double open, double high, double low, double close, long volume)
          Constructs a bar object with the specified data.
Bar(java.lang.Integer id)
          Constructs an empty bar object with the specified id.
 
Method Summary
 double getClose()
          Returns the price at bar's close.
 java.util.Date getDate()
          Returns the bar's date and time.
 double getHigh()
          Returns the highest price.
 double getLow()
          Returns the lowest price.
 double getOpen()
           
 long getVolume()
           
 void setClose(double close)
           
 void setDate(java.util.Date date)
           
 void setHigh(double high)
           
 void setLow(double low)
           
 void setOpen(double open)
           
 void setVolume(long volume)
           
 void update(Bar bar)
          Updates this object with the data from the specified object.
 void update(double open, double high, double low, double close, long volume)
          Updates this object with the specified data.
 
Methods inherited from class net.sourceforge.eclipsetrader.core.db.PersistentObject
clearChanged, equals, getData, getId, getRepository, setChanged, setData, setId, setRepository
 
Methods inherited from class java.util.Observable
addObserver, countObservers, deleteObserver, deleteObservers, hasChanged, notifyObservers, notifyObservers
 
Methods inherited from class java.lang.Object
getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Bar

public Bar()
Constructs an empty bar object.


Bar

public Bar(java.lang.Integer id)
Constructs an empty bar object with the specified id.

Parameters:
id - the unique id

Bar

public Bar(Bar bar)
Constructs a bar object with the data from the specified object.

Parameters:
bar - the object to copy the data from.

Bar

public Bar(double open,
           double high,
           double low,
           double close)
Constructs a bar object with the specified data.

Parameters:
open - the price at open.
high - the highest price.
low - the lowest price.
close - the price at close.

Bar

public Bar(double open,
           double high,
           double low,
           double close,
           long volume)
Constructs a bar object with the specified data.

Parameters:
open - the price at open.
high - the highest price.
low - the lowest price.
close - the price at close.
volume - the exchange volume.

Bar

public Bar(java.util.Date date,
           double open,
           double high,
           double low,
           double close,
           long volume)
Constructs a bar object with the specified data.

Parameters:
date - the date that this object is referring to.
open - the price at open.
high - the highest price.
low - the lowest price.
close - the price at close.
volume - the exchange volume.
Method Detail

getClose

public double getClose()
Returns the price at bar's close.

Returns:
the close price.

setClose

public void setClose(double close)

getDate

public java.util.Date getDate()
Returns the bar's date and time.

Returns:
the date and time.

setDate

public void setDate(java.util.Date date)

getHigh

public double getHigh()
Returns the highest price.

Returns:
the highest price.

setHigh

public void setHigh(double high)

getLow

public double getLow()
Returns the lowest price.

Returns:
the lowest price.

setLow

public void setLow(double low)

getOpen

public double getOpen()

setOpen

public void setOpen(double open)

getVolume

public long getVolume()

setVolume

public void setVolume(long volume)

update

public void update(double open,
                   double high,
                   double low,
                   double close,
                   long volume)
Updates this object with the specified data.

Parameters:
open - the price at open.
high - the highest price.
low - the lowest price.
close - the price at close.
volume - the exchange volume.

update

public void update(Bar bar)
Updates this object with the data from the specified object.

Parameters:
bar - the object to update the data from.