[ https://issues.apache.org/jira/browse/FUNCTOR-14?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Bruno P. Kinoshita resolved FUNCTOR-14. --------------------------------------- Resolution: Fixed > 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 was sent by Atlassian JIRA (v6.1#6144)