Package com.fdsapi.arrays

This package contains the classes and interfaces used in the ArraySQL, ArrayFilter, ArrayComparator, and ArrayConverter classes.

See:
          Description

Interface Summary
Column Interface for columns that occur in a select statement.
Conditional Interface for conditional logic.
ConditionalComposite This interface is the starting point for the implementation of the Composite design pattern.
 

Class Summary
ArrayComparator This class allows you to sort Object[][] arrays by multiple columns.
ArrayConverter Mention either can overwrite data in input array with converted data or copy the output into another array.
ArrayConverterFactory This class returns an array of Converter objects to be used in Converting an array based on the rules speicied below.
ArrayFilter This class does for arrays what a SQL select statement for a database table.
ArrayHeaderLocator This class is used internal to the ArrayFilter, and ArrayComparator classes to allow them to locate array entries by a column lable as opposed to an index.
ArraySQL This class does for arrays what a SQL select statement for a database table.
ColumnData An implementation of the Column interface that displays a particular column from the array as part of the select clause.
ColumnDate An implementation of the Column interface that displays the current date as part of the select clause.
ColumnFunctionFactory A factory that is in charge of creating Column objects.
ColumnRowNum An implementation of the Column interface that displays the current rownumber as part of the select clause.
ColumnString An implementation of the Column interface that displays a string constant as part of the select clause.
ConditionalBase Abstract base class for other Conditional objects.
ConditionalBaseComparator This is the base class for any Conditional that implements the Comparator interface.
ConditionalCompositeContainer This class is used to build the ArrayFilter and ArraySQL classes (ArraySQL is simply backed by ArrayFilter).
ConditionalCompositeImp Used for grouping conditionals in the ArraySQL and ArrayFilter classes.
ConditionalEquals Conditional object that tests equality of objects.
ConditionalFactory A Factory design pattern that creates the various Conditional classes that test for =,<,>, != and more.
ConditionalGreaterThan Conditional used to test to see if a column value is greater than value to compare it against.
ConditionalIn Similar to the 'in clause' within a SQL select statement.
ConditionalLessThan Conditional used to test to see if a column value is less than value to compare it against.
ConditionalParser This class parses individual where clauses within the where clauses such as 'where col0='steve' && lname in ('souza').
ConditionalRE Conditional that compares a column value against a RegularExpression and returns true if they match.
DataTypeParser Class used to determine the type of a passed in Object.
NegateConditional Used in a decorator chain to Negate any other conditional.
NullConditional This class implements the null object design pattern for Conditionals.
OrderByParser Class that parses the Order by clause passed to ArraySQL and translates the String to calls to the ArrayComparator.
SelectColsParser Class that parses the select columns passed to ArraySQL and translates the String to calls to the ArrayFilter.
WhereClauseParser Class that parses an entire where clause passed to ArraySQL and translates the String to calls to the ArrayFilter.
WhereClauseToken Class that represents each token in a where clause.
WhereClauseTokens Class that validates and gives a rules table for building both ArrayFilter and ArraySQL classes.
 

Exception Summary
FDSArraysRuntimeException RuntimeException used for coding errors in this package.
 

Package com.fdsapi.arrays Description

This package contains the classes and interfaces used in the ArraySQL, ArrayFilter, ArrayComparator, and ArrayConverter classes. These classes are useful in themselves without using the rest of the FormattedDataSet API. ArraySQL is the primary class to used and is constructed by parsing a select statement and on the fly determining which ArrayFilter and ArrayComparator methods to call. ArrayFilter, and ArrayCompartor can also be used on their own to manipulate arrays.

ArraySQL does for two dimensional arrays (Object[][]) what SQL select statements do for a database table. However, using ArrayConverter as a service it can also format the returned array (for example comma delimitting numbers), in a simple declaritive way. A sample ArraySQL query follows: select fname,lname,ssn,salary from array where salary>=50000 order by salary desc, lname asc

ArraySQL controls which cols should be displayed, and the where clause(s), and order by clause(s) that should be applied against the array. The returned array is a copy of the original array (with original object references as the cells) with columns and rows filtered.

These classes are monitored with JAMon. Sample code can be found by viewing the main methods in ArraySQL.java, ArrayFilter.java, ArrayCompartor.java ArrayConverter.java

Sample Code:

// Although the example only uses Strings, other data types are supported
String[]header={"fname","lname"};
Object[][]
data={{"steve","souza"},{"steve","smith"},{"jeff","beck"},{"sam","souza"},};
ArraySQL asql=new ArraySQL(header, "select rowNum(), date(), col0, fname, lname,
* from array where lname in ('souza', 'beck') and fname!='sam' order by lname
desc, col0");
data=asql.execute(data);  // returns 2 rows and orders the results

// The same object can be used on data multiple times
data=asql.execute(data2);
data=asql.convert(data2);  // format the array based on the backing
ArrayConverter

// There is an alternative constructor that does not need the header
asql=new ArraySQL("select * from array");
     
     

Steve Souza - admin@fdsapi.com - Certified Programmer for the Java 2 Platform, Sun Certified Web Component Developer for the J2EE, Sybase Certified DBA, Sybase Certified PowerBuilder Developer