MDi JLib
1.7.4

com.microdeveloper.data
Class ArrayResultSet

java.lang.Object
  extended by com.microdeveloper.data.ArrayResultSet

public class ArrayResultSet
extends Object

An arbitrary class for simulating a simple String resultset as a two dimensional array which can be transcribed into a series suitable for most charting applets and other similar usages. Most methods have more than one form for convenience but are otherwise identical (e.g., getColCount <-> getWidth are the same).

Series are always represented as comma delimited records with each row representing a full comma delimited record. Changes to the result set are automatically reflected in the series.

Since:
1.0
Version:
1.0
Author:
MicroDeveloper, Inc.

Constructor Summary
ArrayResultSet()
          Constructor ChartData
ArrayResultSet(int row, int col)
          Creates a new blank ArrayResultSet
ArrayResultSet(Object[][] objArray)
          Creates a new ArrayResultSet and initializes it
 
Method Summary
 String[][] getArrayResultSet()
          Returns the entire resultset
 int getColCount()
          Returns the current width of the ResultSet (number of columns).
 String getField(int row, int col)
          Returns the current value of a given column in a given row
 String[] getRecord(int row)
          Gets a single record that is n columns wide
 String[] getRow(int row)
          Gets a single record that is n columns wide
 int getRowCount()
          Length [size] of the resultset (number of rows)
 String[] getSeries()
          Returns the result set as a series with each row representing a complete record which is comma delimited
 String getSeriesRow(int row)
          Returns a single series row that is represented as a single comma delimited String
 int length()
          Length [size] of the resultset (number of rows)
 void reset()
          Resets the contents of the resultset to null and forces garbage collection
 void resizeArrayRecordSet(int rows, int cols)
          Trims the resultset to the given size in rows and columns
 void setField(int row, int col, String val)
          Sets the value of a specific column in a specific record
 int width()
          Returns the current width of the ResultSet (number of columns)
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ArrayResultSet

public ArrayResultSet()
Constructor ChartData


ArrayResultSet

public ArrayResultSet(int row,
                      int col)
Creates a new blank ArrayResultSet

Parameters:
row - initial number of rows
col - initial number of columns

ArrayResultSet

public ArrayResultSet(Object[][] objArray)
Creates a new ArrayResultSet and initializes it

Parameters:
objArray - content to initialize the object with
Method Detail

getField

public String getField(int row,
                       int col)
Returns the current value of a given column in a given row

Parameters:
row - index of the record to retrieve
col - index of the column to retrieve
Returns:
value of the current record/column

setField

public void setField(int row,
                     int col,
                     String val)
Sets the value of a specific column in a specific record

Parameters:
row - index of the record to change
col - index of the column to change
val - value to assign to the column/record

getArrayResultSet

public String[][] getArrayResultSet()
Returns the entire resultset

Returns:
current resultset

getRow

public String[] getRow(int row)
Gets a single record that is n columns wide

Parameters:
row - index of the row to return
Returns:
a single array representing the complete row
See Also:
getRecord(int)

getRecord

public String[] getRecord(int row)
Gets a single record that is n columns wide

Parameters:
row - index of the row to return
Returns:
a single array representing the complete row
See Also:
getRow(int)

resizeArrayRecordSet

public void resizeArrayRecordSet(int rows,
                                 int cols)
Trims the resultset to the given size in rows and columns

Parameters:
rows - rows to trim to
cols - columns to trim to

getSeriesRow

public String getSeriesRow(int row)
Returns a single series row that is represented as a single comma delimited String

Parameters:
row - index of the row to return
Returns:
comma delimited record

getSeries

public String[] getSeries()
Returns the result set as a series with each row representing a complete record which is comma delimited

Returns:
the resultset as an array of comma delimited records

getRowCount

public int getRowCount()
Length [size] of the resultset (number of rows)

Returns:
number of records in the current resultset
See Also:
length()

length

public int length()
Length [size] of the resultset (number of rows)

Returns:
number of records in the current resultset
See Also:
getRowCount()

width

public int width()
Returns the current width of the ResultSet (number of columns)

Returns:
count of columns
See Also:
getColCount()

getColCount

public int getColCount()
Returns the current width of the ResultSet (number of columns).

Returns:
count of columns
See Also:
width()

reset

public void reset()
Resets the contents of the resultset to null and forces garbage collection


MDi JLib
1.7.4

Copyright©2001-2007 MicroDeveloper, Inc. All Rights Reserved.