Use standard maven directory structure, but still allow building with make.

Moved java sources into java/src/main/java instead of plain "java".
Created empty src/test/java for future unit test cases.
Moved code-generation and test classes into src/util/java instead of "misc"
Adapted make files for changed paths
Use standard maven directory structure, but still allow building with make.

Moved java sources into java/src/main/java instead of plain "java".
Created empty src/test/java for future unit test cases.
Moved code-generation and test classes into src/util/java instead of "misc"
Adapted make files for changed paths

Signed-off-by: Simon Josefsson <simon@josefsson.org>
Make maven build with new directory structure.

Added maven configuration to at least avoid warnings when building and make build reproducible

Signed-off-by: Simon Josefsson <simon@josefsson.org>
Replace needlessly synchronized StringBuffer with StringBuilder everywhere, benchmarked to result in roughly 4x stringprep speedup

Signed-off-by: Simon Josefsson <simon@josefsson.org>
Make example.c compile on Ubuntu 12.04 LTS, cast %ld printf arguments

Signed-off-by: Simon Josefsson <simon@josefsson.org>
Make example3/4/5.c compile on Ubuntu 12.04 LTS, cast %ld printf arguments

Signed-off-by: Simon Josefsson <simon@josefsson.org>
Change comments from stringbuffer to StringBuilder as well

Signed-off-by: Simon Josefsson <simon@josefsson.org>
Added test cases converted from C version. Avoid reading first character of empty strings, happened when a zero width space is converted to nothing.

Signed-off-by: Simon Josefsson <simon@josefsson.org>
Revert from fast StringBuilder to slow StringBuffer for now just to establish a performance baseline.

Signed-off-by: Simon Josefsson <simon@josefsson.org>
Added caliper tests for common types of stringprep operations. Allows use of jenkins + caliper-ci to produce nice graphs of improvements per release.

Signed-off-by: Simon Josefsson <simon@josefsson.org>
Replace synchronized StringBuffer with faster unsynchronized StringBuilder

Signed-off-by: Simon Josefsson <simon@josefsson.org>
Do character-replacement lookups through binary search instead of linear search

Signed-off-by: Simon Josefsson <simon@josefsson.org>
Don't do redundant StringBuilder length() or charAt() calls when doing contains-checks

Signed-off-by: Simon Josefsson <simon@josefsson.org>
If tested text characters all below char to match (out of sorted set), abort as remaining higher chars won't be matched either

Signed-off-by: Simon Josefsson <simon@josefsson.org>
Added RangeSet implementation used for stringprep-table-contains lookups. Made nodeprep twice as fast, nameprep slightly faster, overall 20-40% faster.

Signed-off-by: Simon Josefsson <simon@josefsson.org>
Replaced all contains methods with RangeSet operations.

Made resourceprep faster, others slightly slower. Less redundant code to maintain/optimize later though

Signed-off-by: Simon Josefsson <simon@josefsson.org>
normalizeNFKC pre-allocates output, pre-calculate fixed input length

Signed-off-by: Simon Josefsson <simon@josefsson.org>
Filter using RangeSet, reverse loops order

Signed-off-by: Simon Josefsson <simon@josefsson.org>
First check most significant gap (exists if it contains the letter "a") in the ranges, often provides fast-fail

Signed-off-by: Simon Josefsson <simon@josefsson.org>
Optimize search for head-range, don't binary-search past end-index of highest character

Signed-off-by: Simon Josefsson <simon@josefsson.org>