jga: Generic Algorithms for Java

jga is a functors library: the intent is to explore and exploit functors as a design and implementation tool to reduce boilerplate coding.

See:
          Description

Packages
net.sf.jga.algorithms Provides common algorithm implementations over arrays, collections and other iterable resources, and iterators.
net.sf.jga.fn Provides base definitions for Functors, Predicates, Visitors.
net.sf.jga.fn.adaptor Provides Functors that allow assembly of primitive functors into compound structures.
net.sf.jga.fn.algorithm Provides utilities that apply Functors and Predicates to common situations.
net.sf.jga.fn.arithmetic Provides simple arithmetic Functors for Number classes.
net.sf.jga.fn.comparison  
net.sf.jga.fn.logical Provides Functors and Predicates that implement boolean logic.
net.sf.jga.fn.property Provides Functors and Predicates that operate on Java Objects that observe the bean standard naming convention.
net.sf.jga.fn.string Provides Functors and Predicates that operate on Strings.
net.sf.jga.parser Parser that allows expressions of an as-yet unnamed Java-like language to be parsed to create functors.
net.sf.jga.scripting  
net.sf.jga.swing Provides implementations of standard Swing models, editors, and renderers that use Functors as a means of varying behaviour.
net.sf.jga.swing.spreadsheet Provides Spreadsheet Widget based on a sparse matrix of jga functors, and several application level classes designed to present the widget in various guises.
net.sf.jga.util Provides Facade objects for working with the algorithm functors, and a variety of utility iterators for various purposes.

 

jga is a functors library: the intent is to explore and exploit functors as a design and implementation tool to reduce boilerplate coding. A functor is an object that encapsulates a function or expression: it can take arguments and produce results, as can any method, expression, or function (in other languages that support functions). Unlike an expression, as an object it can be passed as an argument without being executed; it can be persisted to a database or file; it can be serialized and passed from client to server (and back); and it can be instantiated at runtime based on information unavailable at compile-time.

How many times have you...

Functors provide a mechanism that can reduce all of the design problems: they allow you to (in effect) pass a line of code as an argument to a constructor or method, giving you a way to parameterize objects on simple behavour.

jga borrows the functors from C++ STL library, and extends them with functors that are natural for java programmers. jga also borrows the notion that basic functors implementing common operations can be profitably combined into compound structures to implement more useful logic.

Compound functors of the type that jga promotes fall naturally into a tree structure. Taking advantage of this yields a use of functors that may be relatively new to many: as a form of executable metadata that can be interpreted for the information embodied in the structure. To facilitate this, all jga functors provide support for a Visitor implementation.

The most natural application of a functor library is in the implementation of common algorithms, such as those defined in STL. jga provides a set of such algorithms that have been adapted to java conventions and idioms, as opposed to being a direct port of STL.

An area that is rife with one line interfaces is event driven programming of the sort that is typified by Swing. jga includes the beginnings of a set of tools for use in GUI coding that addresses the common problems described above: the continual reinvention of the same set of small wheels in the set of listeners, editors, renderers, and models that accompany a typical Swing program.

System Requirements

jga supports both Java 1.4 and 1.5 with two different versions of the main jga jarfile. The 1.4 compatability jar has a -retro suffix. The capabilities of the package are essentially the same: to work with 1.4, simply omit the generic parameters.



Copyright © 2002-2006 David A. Hall. All Rights Reserved.