NetCharts Pro

netcharts.pro.datamodel
Class NFDataModelStock

java.lang.Object
  extended by netcharts.pro.datamodel.NFDataModelStock
All Implemented Interfaces:
NFDataModel

public abstract class NFDataModelStock
extends java.lang.Object
implements NFDataModel

This abstract class should be used to provide an interface for stock data sets (open, low, high, close) from an underlying data object. The underlying data object is passed into the constructor, and then is accessible directly in order to support get[price] and getNumPoints() method calls. An example is shown here:


 Object datao[][] = makeData();

 NFDataModelStock foodata = new NFDataModelStock(datao) {

     public Object getOpen(int row) {
         Object o[][] = (Object[][])dataObject;
         return o[row][0];
     }
     public Object getLow(int row) {
         Object o[][] = (Object[][])dataObject;
         return o[row][2];
     }
     public Object getHigh(int row) {
         Object o[][] = (Object[][])dataObject;
         return o[row][3];
     }
     public Object getClose(int row) {
         Object o[][] = (Object[][])dataObject;
         return o[row][4];
     }
     public int getNumPoints() {
         return ((Object[])dataObject).length;
     }
 };
 
In the example above, the underlying data object is a multidimensional object array, but it could be a JDBC result set, DOM object, or other data object. This data may be passed to any instance of NFVector via the loadDataModel call.


Field Summary
 java.lang.Object dataObject
          Constructor provided data object.
 boolean hasMoreData
          Whether or not the model has more data.
 java.lang.Object userData
          Allows for information to be stored within the data model.
 
Constructor Summary
NFDataModelStock()
          NFDataModelStock constructor that does not set the underlying data object.
NFDataModelStock(java.lang.Object dataObject)
          NFDataModelStock constructor that sets the underlying data object.
 
Method Summary
 java.lang.Object elementAt(int rowIndex)
          Used internally
 java.lang.Object elementAt(int row, int col)
          Used internally
abstract  java.lang.Object getClose(int row)
          Return the Close price value corresponding to this row.
 int getDataDimensions()
          Return the number of data dimensions
abstract  java.lang.Object getHigh(int row)
          Return the High price value corresponding to this row.
abstract  java.lang.Object getLow(int row)
          Return the Low price value corresponding to this row.
 int getNRows()
          Used internally
abstract  int getNumPoints()
          Return the total number of points available in the data object
abstract  java.lang.Object getOpen(int row)
          Return the Open price value corresponding to this row.
 boolean hasMoreData()
          Returns whether or not there is more data.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

dataObject

public java.lang.Object dataObject
Constructor provided data object.


hasMoreData

public boolean hasMoreData
Whether or not the model has more data.


userData

public java.lang.Object userData
Allows for information to be stored within the data model.

Constructor Detail

NFDataModelStock

public NFDataModelStock()
NFDataModelStock constructor that does not set the underlying data object. Used when the implementing class will not rely on the underlying data object after initialization.


NFDataModelStock

public NFDataModelStock(java.lang.Object dataObject)
NFDataModelStock constructor that sets the underlying data object. Used when the implementing class will rely on the underlying data object after initialization to retrieve the values.

Parameters:
dataObject -
Method Detail

getOpen

public abstract java.lang.Object getOpen(int row)
Return the Open price value corresponding to this row.


getClose

public abstract java.lang.Object getClose(int row)
Return the Close price value corresponding to this row.


getHigh

public abstract java.lang.Object getHigh(int row)
Return the High price value corresponding to this row.


getLow

public abstract java.lang.Object getLow(int row)
Return the Low price value corresponding to this row.


getNumPoints

public abstract int getNumPoints()
Return the total number of points available in the data object


getDataDimensions

public int getDataDimensions()
Return the number of data dimensions

Specified by:
getDataDimensions in interface NFDataModel

hasMoreData

public boolean hasMoreData()
Returns whether or not there is more data. This is necessary where the number of rows being returned does not correspond to the underlying data set.

Specified by:
hasMoreData in interface NFDataModel

elementAt

public final java.lang.Object elementAt(int rowIndex)
Used internally

Specified by:
elementAt in interface NFDataModel

elementAt

public final java.lang.Object elementAt(int row,
                                        int col)
Used internally

Specified by:
elementAt in interface NFDataModel

getNRows

public final int getNRows()
Used internally

Specified by:
getNRows in interface NFDataModel

NetCharts Pro


Visual Mining, Inc.
2099 Gaither Rd.
Suite 220
Rockville, MD 20850
800.308.0731
301.947.8293 FAX

Copyright © Visual Mining, Inc. 1996 - 2011
All Rights Reserved.

NetCharts Pro TM is a registered trademark of Visual Mining, Inc. Other brands and their products are trademarks of their respective holders.

Last Modified: Jun 28, 2011