-
jga: Generic Algorithms for Java, release 0.8
Generic Algorithms for Java (JGA) v0.8 is now available at
http://jga.sf.net/
The major focus of this release is incorporating feedback from users. There are two major changes in this release based on such feedback.
First, to make it a lot easier for new users to find and use the algorithmic functionality, there is now a new package that exposes the various supported algorithms (find, filter/remove, merge/append, unique, transform, summarize, and sort) in static classes based on what they each do. Second, a popular suggestion is to make the functors available via static methods in leiu of calling their individual constructors.
There are also updates in the swing package, extensions to the Hacker's worksheet, and additional functionality in JFXG.
2006-12-20 03:41:36 UTC by davidahall
-
jga: Generic Algorithms for Java, release 0.7
jga: Generic Algorithms for Java, release 0.7 is now available at
http://jga.sf.net
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.
The hilights of this release are;
- Support for the Java 1.5.0_02
- The new FunctorParser (and it's typesafe extension GenericParser)
allow functors to be described using java-like syntax: the parser
creates the functor that implements the logic described in the
expression.
- Hacker's Worksheet is the next phase in the evolution of the
Spreadsheet engine included in the prior release. This application
uses the FunctorParser to implement a spreadsheet whose expression
langauge looks like java in most respects.
This release is compatable with either Java 1.4 or Java 1.5.
http://jga.sf.net/
2005-04-10 15:04:42 UTC by davidahall
-
A Java Hacker's Worksheet (preview)
The Spreadsheet widget in the net.sf.jga.swing package grew out of a couple of design goals behind the jga library. The first was that a spreadsheet could be thought of as a sparse matrix of function objects. The second was that to really use a spreadsheet would require some language that the user could enter into the cells. A 'scripting' capability that would allow a much easier method for creating compound functors has always been on the list of goals for this project.
The parser and spreadsheet have both advanced in development now to the point where it's time to get some feedback. Neither is in its final state, yet, but both are somewhat usable. To that end, I've published an applet version of the "Java Hacker's Worksheet" at http://jga.sf.net/docs/Hacksheet/HacksheetDemo.shtml. I'm very interested in getting some feedback on this, particularly in cases where it doesn't work in some unexpected way.
There's a javadoc extract for the expression langauge and the FunctorParser class at the following links:
http://jga.sf.net/docs/Hacksheet/parserdoc.html
http://jga.sf.net/docs/Hacksheet/FunctorParser.html
You can use the parser programatically. There's an example of building a reasonably compound formula in the "jga & the java 1.5 forloop" (http://jga.sf.net/docs/AddingAlgorithms.shtml)
where the goal is to generate random coin flip. To build the functor programatically, you would use the following declaration.
Generator<Double> coinflip =
new LessEqual<Double>().bind2nd(0.5d).generate(new Random());
Using the FunctorParser (or in this case, the generified derivitive GenericParser), you would use the following declaration:
GenericParser parser = GenericParser.getInstance();
...
BinaryFunctor<Fruit,Fruit,Boolean> shuffle =
parser.parseBinary("Math.random() <= 0.5d", Fruit.class, Fruit.class, Boolean.class);
There are three main methods in the FunctorParser: one that returns a Generator, one that returns a UnaryFunctor, and one that returns a BinaryFunctor. The GenericParser contains similar methods, but each takes an extra class reference in order to check the return type of the resulting functor.
- - - - - - - - - - - -
/**
* Parses the string to create a Generator.
*/
public Generator parseGenerator(String str) throws ParseException;
/**
* Parses the string to create a UnaryFunctor that takes an argument of the
* given type.
*/
public UnaryFunctor parseUnary(String str, Class argType)
throws ParseException;
/**
* Parses the string to create a BinaryFunctor that takes arguments of the
* given types.
*/
public BinaryFunctor parseBinary(String str, Class arg1Type, Class arg2Type)
throws ParseException;
2004-12-14 03:38:34 UTC by davidahall
-
jga: Generic Algorithms for Java, release 0.6
jga: Generic Algorithms for Java, release 0.6 is now available at
http://jga.sf.net
The goal of the project is to supply the functors, predicates, and
algorithms missing from STL in java. jga won't reproduce STL in all
of its details and methods. Instead, jga adapts the functionality of
STL to java idioms: where C++/STL provide different interpretations
of standard design patterns, jga stays true to standard Java
practices. Example usage is provided by applying the functionality
of the library to swing models, editors, and renderers that can
greatly reduce boilerplate classes in desktop development.
The hilights of this release are;
- Support for the 2nd JDK1.5 beta.
- Refactored the functors in the comparison package, with an eye
toward reducing the class count. There are at this point more
classes, but once the deprecated classes are removed in the next
release, there will be far fewer primary functor classes.
- Spreadsheet engine now somewhat working: spreadsheets can be built
programatically, and users can enter raw data (but not formulas)
into cells with full recalculation of dependant cells
- Support for formatting and parsing in the swing package
This release is compatable with either Java 1.4 or Java 1.5.
http://jga.sf.net/
2004-09-16 03:52:19 UTC by davidahall
-
jga & the java 1.5 forloop
One of the new features in Java 1.5 is the new forloop syntax. The new
forloop is analagous to a foreach construct that is common in other
languages. The syntax hides the existance of an iterator, and is even
extended to cases that didn't have an iterator before (arrays). It
also extends to enumerated types.
So, if hiding the iterator is a step forward, can we take things
another step and capture more of the common patterns as part of the
loop mechanism? The answer is 'sort of'. We can't completely hide the
fact that decisions are being made, and that some elements are being
processed. What we can do is hide a lot of the mechanics of the
process.
(full article at http://jga.sf.net/docs/AddingAlgorithms.shtml)
2004-05-16 02:31:42 UTC by davidahall