You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@lucenenet.apache.org by AndyPook <gi...@git.apache.org> on 2017/08/14 22:47:02 UTC

[GitHub] lucenenet pull request #212: LUCENENET-469 - enumerables

GitHub user AndyPook opened a pull request:

    https://github.com/apache/lucenenet/pull/212

    LUCENENET-469 - enumerables

    See https://issues.apache.org/jira/projects/LUCENENET/issues/LUCENENET-469 for background.
    
    This is an early stage proposal for implementing IEnumerable<T> on various "Enum" types. To enable `foreach` and linq style operators.
    
    This prototype provides `EnumEnumerator<T>` as a helper. It can be used in various ways to make the implementation of `IEnumerable<T>` more straightforward.
    
    I have modified `IBytesRefIterator` and `TermsEnum` to add `IEnumerable<BytesRef>` and therefore to all of it's descendants.
    
    The test (such as it is) demonstrates retrieving a `TermsEnum` from a reader. Then using `foreach` and a simple `.Count()` linq operator.
    
    If this approach is acceptable it ought to be adaptable to other Enum types

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/AndyPook/lucenenet LUCENENET-469

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/lucenenet/pull/212.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #212
    
----
commit 008df498bcba7e9940ca97efc83d656ddb03b2c3
Author: Andy Pook <an...@gmail.com>
Date:   2017-08-14T21:32:45Z

    simple editorconfig
    
    ensures spaces for indent

commit 59646be0cf8fbc7e8ad64f395f451a11aca57fc6
Author: Andy Pook <an...@gmail.com>
Date:   2017-08-14T21:34:48Z

    add EnumEnumerator helper

commit 526ddaf8c837f82cd141324e922372155914701b
Author: Andy Pook <an...@gmail.com>
Date:   2017-08-14T21:35:32Z

    add IEnumerable to TermsEnum/IBytesRefArray

commit 456df8e8347ef67055b712722b50cc3b1bbf26cc
Author: Andy Pook <an...@gmail.com>
Date:   2017-08-14T21:36:54Z

    add header, fix usings

commit 1a1c25da7cbcd112d12d6c418c669786cdf4088c
Author: Andy Pook <an...@gmail.com>
Date:   2017-08-14T22:25:15Z

    add example test

----


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---