Please wait. This can take some minutes ...
Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance.
Project price only 1 $
You can buy this project and download/modify it how often you want.
com.pdfjet.Bidi Maven / Gradle / Ivy
/* */ package com.pdfjet;
/* */
/* */ public class Bidi
/* */ {
/* 45 */ private static char[] forms = { 'أ', 65155, 65156, 'أ', 'أ', 'ب', 65167, 65168, 65170, 65169, 'ت', 65173, 65174, 65176, 65175, 'ث', 65177, 65178, 65180, 65179, 'ج', 65181, 65182, 65184, 65183, 'ح', 65185, 65186, 65188, 65187, 'خ', 65189, 65190, 65192, 65191, 'د', 65193, 65194, 'د', 'د', 'ذ', 65195, 65196, 'ذ', 'ذ', 'ر', 65197, 65198, 'ر', 'ر', 'ز', 65199, 65200, 'ز', 'ز', 'س', 65201, 65202, 65204, 65203, 'ش', 65205, 65206, 65208, 65207, 'ص', 65209, 65210, 65212, 65211, 'ض', 65213, 65214, 65216, 65215, 'ط', 65217, 65218, 65220, 65219, 'ظ', 65221, 65222, 65224, 65223, 'ع', 65225, 65226, 65228, 65227, 'غ', 65229, 65230, 65232, 65231, 'ف', 65233, 65234, 65236, 65235, 'ق', 65237, 65238, 65240, 65239, 'ك', 65241, 65242, 65244, 65243, 'ل', 65245, 65246, 65248, 65247, 'م', 65249, 65250, 65252, 65251, 'ن', 65253, 65254, 65256, 65255, 'ه', 65257, 65258, 65260, 65259, 'و', 65261, 65262, 'و', 'و', 'ي', 65265, 65266, 65268, 65267, 'آ', 65153, 65154, 'آ', 'آ', 'ة', 65171, 65172, 'ة', 'ة', 'ى', 65263, 65264, 'ى', 'ى' };
/* */
/* */ private static boolean isArabicLetter(char paramChar)
/* */ {
/* 81 */ for (int i = 0; i < forms.length; i += 5) {
/* 82 */ if (paramChar == forms[i]) {
/* 83 */ return true;
/* */ }
/* */ }
/* 86 */ return false;
/* */ }
/* */
/* */ public static String reorderVisually(String paramString)
/* */ {
/* 98 */ StringBuilder localStringBuilder1 = new StringBuilder();
/* 99 */ StringBuilder localStringBuilder2 = new StringBuilder();
/* 100 */ int i = 1;
/* 101 */ for (int j = 0; j < paramString.length(); j++) {
/* 102 */ int k = paramString.charAt(j);
/* 103 */ if (k == 8206)
/* */ {
/* 105 */ i = 0;
/* */ }
/* 108 */ else if ((k == 8207) || (k == 1564))
/* */ {
/* 111 */ i = 1;
/* */ }
/* 114 */ else if ((isArabic(k)) || (isHebrew(k)) || (k == 171) || (k == 187) || (k == 40) || (k == 41) || (k == 91) || (k == 93))
/* */ {
/* 119 */ i = 1;
/* 120 */ if (localStringBuilder2.length() > 0) {
/* 121 */ localStringBuilder1.append(process(localStringBuilder2));
/* 122 */ localStringBuilder2.setLength(0);
/* */ }
/* 124 */ if (k == 171) {
/* 125 */ localStringBuilder1.append('»');
/* */ }
/* 127 */ else if (k == 187) {
/* 128 */ localStringBuilder1.append('«');
/* */ }
/* 130 */ else if (k == 40) {
/* 131 */ localStringBuilder1.append(')');
/* */ }
/* 133 */ else if (k == 41) {
/* 134 */ localStringBuilder1.append('(');
/* */ }
/* 136 */ else if (k == 91) {
/* 137 */ localStringBuilder1.append(']');
/* */ }
/* 139 */ else if (k == 93) {
/* 140 */ localStringBuilder1.append('[');
/* */ }
/* */ else {
/* 143 */ localStringBuilder1.append(k);
/* */ }
/* */ }
/* 146 */ else if (isAlphaNumeric(k)) {
/* 147 */ i = 0;
/* 148 */ localStringBuilder2.append(k);
/* */ }
/* 151 */ else if (i != 0) {
/* 152 */ localStringBuilder1.append(k);
/* */ }
/* */ else {
/* 155 */ localStringBuilder2.append(k);
/* */ }
/* */ }
/* */
/* 159 */ if (localStringBuilder2.length() > 0) {
/* 160 */ localStringBuilder1.append(process(localStringBuilder2));
/* */ }
/* */
/* 163 */ StringBuilder localStringBuilder3 = new StringBuilder();
/* 164 */ for (int m = localStringBuilder1.length() - 1; m >= 0; m--) {
/* 165 */ char c1 = localStringBuilder1.charAt(m);
/* 166 */ if (isArabicLetter(c1)) {
/* 167 */ char c2 = m > 0 ? localStringBuilder1.charAt(m - 1) : '\000';
/* 168 */ char c3 = m < localStringBuilder1.length() - 1 ? localStringBuilder1.charAt(m + 1) : '\000';
/* 169 */ for (int n = 0; n < forms.length; n += 5) {
/* 170 */ if (c1 == forms[n]) {
/* 171 */ if ((!isArabicLetter(c2)) && (!isArabicLetter(c3))) {
/* 172 */ localStringBuilder3.append(forms[(n + 1)]);
/* */ }
/* 174 */ else if ((isArabicLetter(c2)) && (!isArabicLetter(c3))) {
/* 175 */ localStringBuilder3.append(forms[(n + 2)]);
/* */ }
/* 177 */ else if ((isArabicLetter(c2)) && (isArabicLetter(c3))) {
/* 178 */ localStringBuilder3.append(forms[(n + 3)]);
/* */ }
/* 180 */ else if ((!isArabicLetter(c2)) && (isArabicLetter(c3)))
/* 181 */ localStringBuilder3.append(forms[(n + 4)]);
/* */ }
/* */ }
/* */ }
/* */ else
/* */ {
/* 187 */ localStringBuilder3.append(c1);
/* */ }
/* */ }
/* 190 */ return localStringBuilder3.toString();
/* */ }
/* */
/* */ public static boolean isArabic(char paramChar)
/* */ {
/* 195 */ return (paramChar >= '') && (paramChar <= 'ۿ');
/* */ }
/* */
/* */ private static boolean isHebrew(char paramChar)
/* */ {
/* 200 */ return (paramChar >= '֑') && (paramChar <= '״');
/* */ }
/* */
/* */ private static boolean isAlphaNumeric(char paramChar)
/* */ {
/* 205 */ if ((paramChar >= '0') && (paramChar <= '9')) {
/* 206 */ return true;
/* */ }
/* 208 */ if ((paramChar >= 'a') && (paramChar <= 'z')) {
/* 209 */ return true;
/* */ }
/* 211 */ if ((paramChar >= 'A') && (paramChar <= 'Z')) {
/* 212 */ return true;
/* */ }
/* 214 */ return false;
/* */ }
/* */
/* */ private static StringBuilder process(StringBuilder paramStringBuilder)
/* */ {
/* 219 */ StringBuilder localStringBuilder1 = paramStringBuilder.reverse();
/* 220 */ StringBuilder localStringBuilder2 = new StringBuilder();
/* 221 */ StringBuilder localStringBuilder3 = new StringBuilder();
/* 222 */ for (int i = 0; i < localStringBuilder1.length(); i++) {
/* 223 */ char c = localStringBuilder1.charAt(i);
/* 224 */ if ((c == ' ') || (c == ',') || (c == '.') || (c == '-')) {
/* 225 */ localStringBuilder2.append(c);
/* */ }
/* */ else {
/* 228 */ localStringBuilder3.append(localStringBuilder1.substring(i));
/* 229 */ localStringBuilder3.append(localStringBuilder2.reverse());
/* 230 */ break;
/* */ }
/* */ }
/* 232 */ return localStringBuilder3;
/* */ }
/* */ }
/* Location: E:\EGGWIFI\Customer\trunk\src\Workspace\Customer\Customer Maven Webapp\src\main\webapp\WEB-INF\lib\PDFjet.jar
* Qualified Name: com.pdfjet.Bidi
* JD-Core Version: 0.6.2
*/