public static void assertRunArrayEquals(int[][] expected, Bidi bidi) { assertEquals("different length", expected.length, bidi.getRunCount()); FORRUN: for (int i = 0; i < bidi.getRunCount(); i++) { int[] butWas = new int[] {bidi.getRunStart(i), bidi.getRunLimit(i), bidi.getRunLevel(i)}; for (int j = 0; j < expected.length; j++) { if (expected[j][0] == butWas[0] && expected[j][1] == butWas[1] && expected[j][2] == butWas[2]) { continue FORRUN; } } fail( "expected [" + i + "] " + " start: " + butWas[0] + " limit: " + butWas[1] + " level: " + butWas[2]); } }
private String func_78283_c(String p_78283_1_) { if (p_78283_1_ != null && Bidi.requiresBidi(p_78283_1_.toCharArray(), 0, p_78283_1_.length())) { Bidi var2 = new Bidi(p_78283_1_, -2); byte[] var3 = new byte[var2.getRunCount()]; String[] var4 = new String[var3.length]; int var7; for (int var5 = 0; var5 < var3.length; ++var5) { int var6 = var2.getRunStart(var5); var7 = var2.getRunLimit(var5); int var8 = var2.getRunLevel(var5); String var9 = p_78283_1_.substring(var6, var7); var3[var5] = (byte) var8; var4[var5] = var9; } String[] var11 = (String[]) var4.clone(); Bidi.reorderVisually(var3, 0, var4, 0, var3.length); StringBuilder var12 = new StringBuilder(); var7 = 0; while (var7 < var4.length) { byte var13 = var3[var7]; int var14 = 0; while (true) { if (var14 < var11.length) { if (!var11[var14].equals(var4[var7])) { ++var14; continue; } var13 = var3[var14]; } if ((var13 & 1) == 0) { var12.append(var4[var7]); } else { for (var14 = var4[var7].length() - 1; var14 >= 0; --var14) { char var10 = var4[var7].charAt(var14); if (var10 == 40) { var10 = 41; } else if (var10 == 41) { var10 = 40; } var12.append(var10); } } ++var7; break; } } return var12.toString(); } else { return p_78283_1_; } }
private static void addRuns(List<BidiRun> runs, char[] text, int start, int end) { if (start >= end) return; Bidi bidi = new Bidi(text, start, null, 0, end - start, Bidi.DIRECTION_LEFT_TO_RIGHT); int runCount = bidi.getRunCount(); for (int i = 0; i < runCount; i++) { addOrMergeRun( runs, new BidiRun( (byte) bidi.getRunLevel(i), start + bidi.getRunStart(i), start + bidi.getRunLimit(i))); } }