You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by eyala <gi...@git.apache.org> on 2016/09/13 08:18:53 UTC

[GitHub] commons-lang pull request #188: LANG-1266 Add alphabet converter

GitHub user eyala opened a pull request:

    https://github.com/apache/commons-lang/pull/188

    LANG-1266 Add alphabet converter

    (as described in [the mailing list](http://mail-archives.apache.org/mod_mbox/commons-dev/201609.mbox/%3c289983494.3057706.1472720010277@mail.yahoo.com%3e))
    
    This is a utility class I wrote for converting from one alphabet to another - for example, from unicode to latin, without using some of the chars in latin. The usage looks like this:
    
    ```
    Set<Character> originals; // a, b, c, d
    Set<Character> encoding; // 0, 1, d
    Set<Character> doNotEncode; // d
    
    AlphabetConverter ac = AlphabetConverter.createConverter(originals, encoding, doNotEncode);
    
    ac.encode("a"); // 00
    ac.encode("b"); // 01
    ac.encode("c"); // 0d
    ac.encode("d"); // d
    ac.encode("abcd"); // 00010dd
    ```
    Of course, 
    
    `x.equals(ac.decode(ac.encode(x)))`
    
     should always be true.
    
    The implementation provided makes the encodings of fixed length, other than the "do not encode" chars, which remain as they are (length one).
    
    In addition, in order to make it easier to preserve the encoding scheme, I've added a human-readable toString implementation, and a constructor that can recreate an AlphabetConverter from the encoding map, such that:
    ```
    
    AlphabetConverter ac;
    
    ac.equals(AlphabetConverter.createConverterFromMap(ac.getOriginalToEncoded())); // always should be true
    
    ```

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

    $ git pull https://github.com/eyala/commons-lang LANG-1266

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

    https://github.com/apache/commons-lang/pull/188.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 #188
    
----
commit c1a5a638a3132f2048bb4113181460c3c660c2a8
Author: eallweil <ea...@paypal.com>
Date:   2016-09-13T08:15:06Z

    LANG-1266 Add alphabet converter

----


---
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.
---

[GitHub] commons-lang issue #188: LANG-1266 Add alphabet converter

Posted by britter <gi...@git.apache.org>.
Github user britter commented on the issue:

    https://github.com/apache/commons-lang/pull/188
  
    The issue has been moved to https://issues.apache.org/jira/browse/TEXT-19 Please reference TEXT-19 in your PR against the Commons Text repository. Thank you!


---
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.
---

[GitHub] commons-lang issue #188: LANG-1266 Add alphabet converter

Posted by coveralls <gi...@git.apache.org>.
Github user coveralls commented on the issue:

    https://github.com/apache/commons-lang/pull/188
  
    
    [![Coverage Status](https://coveralls.io/builds/7858389/badge)](https://coveralls.io/builds/7858389)
    
    Coverage decreased (-0.02%) to 93.559% when pulling **c1a5a638a3132f2048bb4113181460c3c660c2a8 on eyala:LANG-1266** into **dad86bc0a29689fd29bf03b382a39621718e8b05 on apache:master**.



---
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.
---

[GitHub] commons-lang pull request #188: LANG-1266 Add alphabet converter

Posted by eyala <gi...@git.apache.org>.
Github user eyala closed the pull request at:

    https://github.com/apache/commons-lang/pull/188


---
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.
---