commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Bruno P. Kinoshita" <brunodepau...@yahoo.com.br>
Subject [functor] Patch for FUNCTOR-14, new Generators and Ranges
Date Tue, 05 Jun 2012 04:59:06 GMT
Hi all, 

I've finished a patch for FUNCTOR-14, regarding the Generators API in [functor]. I'd like
to hear what others think about what was done before attaching the patch to JIRA: 

- Didn't change the Generator interface. Although I commented in the issue about removing
the stop() and isStopped() methods and moving to a different interface, it would require a
major refactoring, as many other generators are built upon this idea.

- Created IntegerGenerator, LongGenerator, FloatGenerator, DoubleGenerator and CharacterGenerator.
Didn't implement a DateGenerator as it would require more time and a discussion on how to
use days, months, years, days of week, etc. 

- Introduced Ranges, with the following initial ranges: IntegerRange, LongRange, FloatRange,
DoubleRange and CharacterRange. This API is quite similar to other existing APIs, with the
difference that you can specify the step (like ranges in Matlab)

- The generators that use numbers (there are many other generators, like GenerateWhile, GenerateUntil,
etc) use ranges to create the series. The objects are created only when the generator is executed,
calling a procedure. Like in python, but instead of retrieving the value with a 'yield' statement,
we give a procedure to be executed using the value created.

- Included tests to cover the changes. 

- Updated web site examples.

All the tests passed, no checkstyle/pmd/findbugs errors. The character range/generator is
a very simple, and there are some operations with double/float in the ranges and generators.
I keep my code mirrored in github too, in case someone prefers reading it there https://github.com/kinow/functor.

Let me know what you think about it :-) 

Thank you in advance!

Bruno P. Kinoshita
http://kinoshita.eti.br
http://tupilabs.com 

Mime
View raw message