Groovy
  1. Groovy
  2. GROOVY-3246

There should be a DGM.normalize(String) method which acts like readLines().join('\n')

    Details

    • Type: New Feature New Feature
    • Status: Closed
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 1.6-rc-2, 1.5.8, 1.7-beta-1
    • Component/s: None
    • Labels:
      None
    1. DefaultGroovyMethods.diff
      3 kB
      Alexander Veit
    2. DefaultGroovyMethodsTest.diff
      3 kB
      Alexander Veit
    3. DGM-denormalize.txt
      1 kB
      Alexander Veit
    4. DGM-normalize.txt
      0.7 kB
      Alexander Veit
    5. DGMTest-denormalize.txt
      1 kB
      Alexander Veit
    6. DGMTest-normalize.txt
      1 kB
      Alexander Veit
    7. improve-normalization-patch.txt
      5 kB
      James P. White

      Issue Links

        Activity

        paulk@asert.com.au created issue -
        Paul King made changes -
        Field Original Value New Value
        Fix Version/s 1.6 [ 13832 ]
        Status Open [ 1 ] Resolved [ 5 ]
        Resolution Fixed [ 1 ]
        Fix Version/s 1.5.8 [ 14630 ]
        Hide
        James P. White added a comment -

        I would like normalize to be string-based and to not change whether there is a final line ending.

        Show
        James P. White added a comment - I would like normalize to be string-based and to not change whether there is a final line ending.
        James P. White made changes -
        Status Resolved [ 5 ] Reopened [ 4 ]
        Resolution Fixed [ 1 ]
        James P. White made changes -
        Link This issue is related to GROOVY-3264 [ GROOVY-3264 ]
        Hide
        James P. White added a comment -

        Patch for the trunk to make normalize and denormalize be string-based and which tighter semantics. Test cases updated.

        Show
        James P. White added a comment - Patch for the trunk to make normalize and denormalize be string-based and which tighter semantics. Test cases updated.
        James P. White made changes -
        Attachment improve-normalization-patch.txt [ 39315 ]
        Hide
        James P. White added a comment -

        Committed to trunk (cs15032). If there is no objection then I'll push this into the other branches.

        Show
        James P. White added a comment - Committed to trunk (cs15032). If there is no objection then I'll push this into the other branches.
        Hide
        Alexander Veit added a comment -

        The results seem to be fine now

        However the implementation is quite slow now. In my tests normalize is up to factor 25 slower than a character based single-pass implementation (patch from http://jira.codehaus.org/browse/GROOVY-3264). RegExes are expensive.

        Show
        Alexander Veit added a comment - The results seem to be fine now However the implementation is quite slow now. In my tests normalize is up to factor 25 slower than a character based single-pass implementation (patch from http://jira.codehaus.org/browse/GROOVY-3264 ). RegExes are expensive.
        Hide
        James P. White added a comment - - edited

        Yeah, I was afraid of that. But if we now agree on this API, speed tuning would be worthwhile.

        If you want to update your patch, that would be dandy.

        It would also be nice to know how much difference precompiling the patterns makes.

        Show
        James P. White added a comment - - edited Yeah, I was afraid of that. But if we now agree on this API, speed tuning would be worthwhile. If you want to update your patch, that would be dandy. It would also be nice to know how much difference precompiling the patterns makes.
        James P. White made changes -
        Status Reopened [ 4 ] Resolved [ 5 ]
        Resolution Fixed [ 1 ]
        Hide
        Alexander Veit added a comment -

        Attached alternative implementations and a patch for the 1_6_X branch.

        Show
        Alexander Veit added a comment - Attached alternative implementations and a patch for the 1_6_X branch.
        Alexander Veit made changes -
        Attachment DGM-normalize.txt [ 39387 ]
        Attachment DefaultGroovyMethods.diff [ 39389 ]
        Attachment DGMTest-denormalize.txt [ 39388 ]
        Hide
        Alexander Veit added a comment -

        Attachments (continued).

        Show
        Alexander Veit added a comment - Attachments (continued).
        Alexander Veit made changes -
        Attachment DefaultGroovyMethodsTest.diff [ 39392 ]
        Attachment DGM-denormalize.txt [ 39390 ]
        Attachment DGMTest-normalize.txt [ 39391 ]
        Hide
        James P. White added a comment - - edited

        I've committed (trunk first - cs15089 - branches later) tuned up versions of normalize and denormalize. I've used somewhat different logic and there are a couple comments explaining that.

        Also I didn't use the tests because there already are some in groovy.StringTest.groovy. If there are any cases missing from there, please do add them there.

        Thanks for your help!

        Show
        James P. White added a comment - - edited I've committed (trunk first - cs15089 - branches later) tuned up versions of normalize and denormalize . I've used somewhat different logic and there are a couple comments explaining that. Also I didn't use the tests because there already are some in groovy.StringTest.groovy . If there are any cases missing from there, please do add them there. Thanks for your help!
        Paul King made changes -
        Status Resolved [ 5 ] Closed [ 6 ]
        Mark Thomas made changes -
        Project Import Sun Apr 05 13:32:57 UTC 2015 [ 1428240777691 ]
        Mark Thomas made changes -
        Workflow jira [ 12732243 ] Default workflow, editable Closed status [ 12744050 ]
        Mark Thomas made changes -
        Project Import Mon Apr 06 02:11:23 UTC 2015 [ 1428286283443 ]
        Mark Thomas made changes -
        Workflow jira [ 12970095 ] Default workflow, editable Closed status [ 12977859 ]
        Mark Thomas made changes -
        Reporter Paul King [ paulk@asert.com.au ] Paul King [ paulk ]
        Mark Thomas made changes -
        Assignee paulk_asert [ paulk_asert ] Paul King [ paulk ]
        Transition Time In Source Status Execution Times Last Executer Last Execution Date
        Open Open Resolved Resolved
        4h 59m 1 Paul King 31/Dec/08 07:53
        Resolved Resolved Reopened Reopened
        13d 12h 7m 1 James P. White 13/Jan/09 20:01
        Reopened Reopened Resolved Resolved
        2d 7h 28m 1 James P. White 16/Jan/09 03:29
        Resolved Resolved Closed Closed
        6d 18h 4m 1 Paul King 22/Jan/09 21:34

          People

          • Assignee:
            Paul King
            Reporter:
            Paul King
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development