You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Bruno P. Kinoshita (JIRA)" <ji...@apache.org> on 2013/09/12 13:58:51 UTC
[jira] [Commented] (FUNCTOR-14) Enhancements on the Generator API
[ https://issues.apache.org/jira/browse/FUNCTOR-14?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13765365#comment-13765365 ]
Bruno P. Kinoshita commented on FUNCTOR-14:
-------------------------------------------
Author: kinow
Date: Thu Sep 12 04:29:46 2013
New Revision: 1522355
URL: http://svn.apache.org/r1522355
Log:
[FUNCTOR-14] Merge branch generators-FUNCTOR-14. Adding the loop and range packages, and simplifying the BaseGenerator type.
Added:
commons/proper/functor/trunk/core/src/main/java/org/apache/commons/functor/generator/loop/
commons/proper/functor/trunk/core/src/main/java/org/apache/commons/functor/generator/loop/GenerateUntil.java
commons/proper/functor/trunk/core/src/main/java/org/apache/commons/functor/generator/loop/GenerateWhile.java
commons/proper/functor/trunk/core/src/main/java/org/apache/commons/functor/generator/loop/IteratorToGeneratorAdapter.java
commons/proper/functor/trunk/core/src/main/java/org/apache/commons/functor/generator/loop/LoopGenerator.java
commons/proper/functor/trunk/core/src/main/java/org/apache/commons/functor/generator/loop/TransformedGenerator.java
commons/proper/functor/trunk/core/src/main/java/org/apache/commons/functor/generator/loop/UntilGenerate.java
commons/proper/functor/trunk/core/src/main/java/org/apache/commons/functor/generator/loop/WhileGenerate.java
commons/proper/functor/trunk/core/src/main/java/org/apache/commons/functor/generator/loop/package-info.java
commons/proper/functor/trunk/core/src/main/java/org/apache/commons/functor/range/
commons/proper/functor/trunk/core/src/main/java/org/apache/commons/functor/range/BoundType.java
commons/proper/functor/trunk/core/src/main/java/org/apache/commons/functor/range/CharacterRange.java
commons/proper/functor/trunk/core/src/main/java/org/apache/commons/functor/range/DoubleRange.java
commons/proper/functor/trunk/core/src/main/java/org/apache/commons/functor/range/Endpoint.java
commons/proper/functor/trunk/core/src/main/java/org/apache/commons/functor/range/FloatRange.java
commons/proper/functor/trunk/core/src/main/java/org/apache/commons/functor/range/IntegerRange.java
commons/proper/functor/trunk/core/src/main/java/org/apache/commons/functor/range/LongRange.java
commons/proper/functor/trunk/core/src/main/java/org/apache/commons/functor/range/NumericRange.java
commons/proper/functor/trunk/core/src/main/java/org/apache/commons/functor/range/Range.java
commons/proper/functor/trunk/core/src/main/java/org/apache/commons/functor/range/Ranges.java
commons/proper/functor/trunk/core/src/main/java/org/apache/commons/functor/range/package-info.java
commons/proper/functor/trunk/core/src/test/java/org/apache/commons/functor/generator/loop/
commons/proper/functor/trunk/core/src/test/java/org/apache/commons/functor/generator/loop/TestGenerateUntil.java
commons/proper/functor/trunk/core/src/test/java/org/apache/commons/functor/generator/loop/TestGenerateWhile.java
commons/proper/functor/trunk/core/src/test/java/org/apache/commons/functor/generator/loop/TestIteratorToGeneratorAdapter.java
commons/proper/functor/trunk/core/src/test/java/org/apache/commons/functor/generator/loop/TestLoopGenerator.java
commons/proper/functor/trunk/core/src/test/java/org/apache/commons/functor/generator/loop/TestTransformedGenerator.java
commons/proper/functor/trunk/core/src/test/java/org/apache/commons/functor/generator/loop/TestUntilGenerate.java
commons/proper/functor/trunk/core/src/test/java/org/apache/commons/functor/generator/loop/TestWhileGenerate.java
commons/proper/functor/trunk/core/src/test/java/org/apache/commons/functor/range/
commons/proper/functor/trunk/core/src/test/java/org/apache/commons/functor/range/TestCharacterRange.java
commons/proper/functor/trunk/core/src/test/java/org/apache/commons/functor/range/TestDoubleRange.java
commons/proper/functor/trunk/core/src/test/java/org/apache/commons/functor/range/TestEndpoint.java
commons/proper/functor/trunk/core/src/test/java/org/apache/commons/functor/range/TestFloatRange.java
commons/proper/functor/trunk/core/src/test/java/org/apache/commons/functor/range/TestIntegerRange.java
commons/proper/functor/trunk/core/src/test/java/org/apache/commons/functor/range/TestLongRange.java
Removed:
commons/proper/functor/trunk/core/src/main/java/org/apache/commons/functor/generator/GenerateUntil.java
commons/proper/functor/trunk/core/src/main/java/org/apache/commons/functor/generator/GenerateWhile.java
commons/proper/functor/trunk/core/src/main/java/org/apache/commons/functor/generator/IteratorToGeneratorAdapter.java
commons/proper/functor/trunk/core/src/main/java/org/apache/commons/functor/generator/TransformedGenerator.java
commons/proper/functor/trunk/core/src/main/java/org/apache/commons/functor/generator/UntilGenerate.java
commons/proper/functor/trunk/core/src/main/java/org/apache/commons/functor/generator/WhileGenerate.java
commons/proper/functor/trunk/core/src/main/java/org/apache/commons/functor/generator/util/IntegerRange.java
commons/proper/functor/trunk/core/src/main/java/org/apache/commons/functor/generator/util/LongRange.java
commons/proper/functor/trunk/core/src/test/java/org/apache/commons/functor/generator/TestGenerateUntil.java
commons/proper/functor/trunk/core/src/test/java/org/apache/commons/functor/generator/TestGenerateWhile.java
commons/proper/functor/trunk/core/src/test/java/org/apache/commons/functor/generator/TestIteratorToGeneratorAdapter.java
commons/proper/functor/trunk/core/src/test/java/org/apache/commons/functor/generator/TestTransformedGenerator.java
commons/proper/functor/trunk/core/src/test/java/org/apache/commons/functor/generator/TestUntilGenerate.java
commons/proper/functor/trunk/core/src/test/java/org/apache/commons/functor/generator/TestWhileGenerate.java
commons/proper/functor/trunk/core/src/test/java/org/apache/commons/functor/generator/util/TestIntegerRange.java
commons/proper/functor/trunk/core/src/test/java/org/apache/commons/functor/generator/util/TestLongRange.java
Modified:
commons/proper/functor/trunk/core/src/main/java/org/apache/commons/functor/adapter/FullyBoundNullaryPredicate.java
commons/proper/functor/trunk/core/src/main/java/org/apache/commons/functor/adapter/FullyBoundNullaryProcedure.java
commons/proper/functor/trunk/core/src/main/java/org/apache/commons/functor/core/algorithm/IndexOfInGenerator.java
commons/proper/functor/trunk/core/src/main/java/org/apache/commons/functor/generator/BaseGenerator.java
commons/proper/functor/trunk/core/src/main/java/org/apache/commons/functor/generator/FilteredGenerator.java
commons/proper/functor/trunk/core/src/main/java/org/apache/commons/functor/generator/Generator.java
commons/proper/functor/trunk/core/src/main/java/org/apache/commons/functor/generator/util/EachElement.java
commons/proper/functor/trunk/core/src/test/java/org/apache/commons/functor/TestAlgorithms.java
commons/proper/functor/trunk/core/src/test/java/org/apache/commons/functor/core/algorithm/TestFindWithinGenerator.java
commons/proper/functor/trunk/core/src/test/java/org/apache/commons/functor/core/algorithm/TestFoldLeft.java
commons/proper/functor/trunk/core/src/test/java/org/apache/commons/functor/core/algorithm/TestFoldRight.java
commons/proper/functor/trunk/core/src/test/java/org/apache/commons/functor/core/algorithm/TestGeneratorContains.java
commons/proper/functor/trunk/core/src/test/java/org/apache/commons/functor/core/algorithm/TestIndexOfInGenerator.java
commons/proper/functor/trunk/core/src/test/java/org/apache/commons/functor/example/QuicksortExample.java
commons/proper/functor/trunk/core/src/test/java/org/apache/commons/functor/example/kata/two/TestBinaryChop.java
commons/proper/functor/trunk/core/src/test/java/org/apache/commons/functor/example/lines/Lines.java
commons/proper/functor/trunk/core/src/test/java/org/apache/commons/functor/example/lines/TestLines.java
commons/proper/functor/trunk/core/src/test/java/org/apache/commons/functor/example/map/FixedSizeMap.java
commons/proper/functor/trunk/core/src/test/java/org/apache/commons/functor/generator/TestBaseGenerator.java
commons/proper/functor/trunk/core/src/test/java/org/apache/commons/functor/generator/TestFilteredGenerator.java
commons/proper/functor/trunk/core/src/test/java/org/apache/commons/functor/generator/util/TestEachElement.java
commons/proper/functor/trunk/src/changes/changes.xml
commons/proper/functor/trunk/src/site/xdoc/examples.xml
> Enhancements on the Generator API
> ---------------------------------
>
> Key: FUNCTOR-14
> URL: https://issues.apache.org/jira/browse/FUNCTOR-14
> Project: Commons Functor
> Issue Type: Improvement
> Reporter: Bruno P. Kinoshita
> Assignee: Bruno P. Kinoshita
> Priority: Minor
>
> Apparently, the Generator API in [functor] was created based on Python generators. However, there is room for enhancements in the current implementation.
> The Generator interface contains methods to stop its execution. However not all generators are necessarily 'stoppable'. Maybe we could move this behavior to a separate interface.
> The parameters passed to a generator (from, to, step) are the same that, in Python, can be used to create a Range. Ranges are used in many examples of Generators in Python. We could include Ranges in [functor] and utilize them in Generators. It would be good if we could include/exclude the Range boundary values, i.e. we could create a Range 0..2, and define 0 or 2, as being either inclusive or exclusive.
> Among the current generators, there is one for Integer's, and another one for Long's. We could create generators for other types too (e.g.: Char, Date, Double, Float, ...).
> Another feature usually related to Generators in Python is the yield statement. There are some API's in Java that provide a yield implementation. This is not entirely necessary, but could be convenient to include it to [functor] too, combined with Generators. Maybe in [functor] we could create a YieldProcedure. This way, the Generator would yield its values to this procedure. Just food for thought.
> This issue is quite vague, so feel free to add comments, or criticize. This way we can achieve a common consensus on a new and awesome Generator API for [functor]. No hard feelings :-)
> Cheers
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira