Add some comments
This commit is contained in:
parent
be5819c3db
commit
3b56cb449d
1 changed files with 20 additions and 9 deletions
|
@ -24,7 +24,8 @@ public class Reshaper {
|
||||||
// return s;
|
// return s;
|
||||||
// }
|
// }
|
||||||
try {
|
try {
|
||||||
ArabicShaping as = new ArabicShaping(ArabicShaping.LETTERS_SHAPE | ArabicShaping.LENGTH_GROW_SHRINK);
|
ArabicShaping as = new ArabicShaping(ArabicShaping.LETTERS_SHAPE | ArabicShaping.LENGTH_GROW_SHRINK
|
||||||
|
);
|
||||||
try {
|
try {
|
||||||
s = as.shape(s);
|
s = as.shape(s);
|
||||||
} catch (ArabicShapingException e) {
|
} catch (ArabicShapingException e) {
|
||||||
|
@ -86,20 +87,30 @@ public class Reshaper {
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
// char[] c = new char[] {'א', 'ד','ם', ' ', '1', '2'} ;
|
// char[] c = new char[] {'א', 'ד','ם', ' ', '1', '2'} ;
|
||||||
// String reshape = "אדם";
|
// String reshape = "אדם";
|
||||||
char[] c = new char[] {'א', 'ד','ם'} ;
|
// char[] c = new char[] {'א', 'ד','ם'} ;
|
||||||
String reshape = reshape(new String(c));
|
// String reshape = reshape(new String(c));
|
||||||
for(int i=0; i < reshape.length(); i++) {
|
// for (int i = 0; i < reshape.length(); i++) {
|
||||||
System.out.println(reshape.charAt(i));
|
// System.out.println(reshape.charAt(i));
|
||||||
}
|
// }
|
||||||
test2();
|
test2();
|
||||||
|
// test3();
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void test3() {
|
||||||
|
String s = "מרכז מסחרי/השלום (40050)";
|
||||||
|
String reshape = reshape(s);
|
||||||
|
String expected = "(40050) םולשה/ירחסמ זכרמ";
|
||||||
|
if (!reshape.equals(expected)) {
|
||||||
|
throw new IllegalArgumentException(String.format("Bug: expected '%s', reshaped '%s'", expected, reshape));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void test2() {
|
private static void test2() {
|
||||||
String s = "گچ پژ نمکی باللغة العربي";
|
String s = "گچ پژ نمکی باللغة العربي";
|
||||||
String reshape = reshape(s);
|
String reshape = reshape(s);
|
||||||
|
String expected = "ﻲﺑﺮﻌﻟﺍ ﺔﻐﻠﻟﺎﺑ ﯽﮑﻤﻧ ﮋﭘ ﭻﮔ";
|
||||||
if (!reshape.equals("ﻲﺑﺮﻌﻟﺍ ﺔﻐﻠﻟﺎﺑ ﯽﮑﻤﻧ ﮋﭘ ﭻﮔ")) {
|
if (!reshape.equals(expected)) {
|
||||||
throw new IllegalArgumentException("BUG!!!");
|
throw new IllegalArgumentException(String.format("Bug: expected '%s', reshaped '%s'", expected, reshape));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue