當前位置: 首頁>>代碼示例>>Java>>正文


Java Bidi.DIRECTION_RIGHT_TO_LEFT屬性代碼示例

本文整理匯總了Java中java.text.Bidi.DIRECTION_RIGHT_TO_LEFT屬性的典型用法代碼示例。如果您正苦於以下問題:Java Bidi.DIRECTION_RIGHT_TO_LEFT屬性的具體用法?Java Bidi.DIRECTION_RIGHT_TO_LEFT怎麽用?Java Bidi.DIRECTION_RIGHT_TO_LEFT使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在java.text.Bidi的用法示例。


在下文中一共展示了Bidi.DIRECTION_RIGHT_TO_LEFT屬性的10個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: testDefaultEmbeddings

public void testDefaultEmbeddings() {
	bd = new Bidi(new char[] { 's', 's', 's' }, 0, new byte[] { (byte) 0,
			(byte) 0, (byte) 0 }, 0, 3, Bidi.DIRECTION_RIGHT_TO_LEFT);
	assertFalse(bd.baseIsLeftToRight());
	assertEquals(1, bd.getBaseLevel());
	assertEquals(3, bd.getLength());
	assertEquals(2, bd.getLevelAt(0));
	assertEquals(2, bd.getLevelAt(1));
	assertEquals(2, bd.getLevelAt(2));
	assertEquals(1, bd.getLevelAt(1000));
	assertEquals(1, bd.getRunCount());
	assertRunArrayEquals(new int[][] { { 0, 3, 2 }, }, bd);
	assertFalse(bd.isLeftToRight());
	assertTrue(bd.isMixed());
	assertFalse(bd.isRightToLeft());
}
 
開發者ID:shannah,項目名稱:cn1,代碼行數:16,代碼來源:BidiTest.java

示例2: testRelativeEmbeddings

public void testRelativeEmbeddings() {
	bd = new Bidi(new char[] { 's', 's', 's' }, 0, new byte[] { (byte) 1,
			(byte) 2, (byte) 3 }, 0, 3, Bidi.DIRECTION_RIGHT_TO_LEFT);
	assertFalse(bd.baseIsLeftToRight());
	assertEquals(1, bd.getBaseLevel());
	assertEquals(3, bd.getLength());
	assertEquals(2, bd.getLevelAt(0));
	assertEquals(2, bd.getLevelAt(1));
	assertEquals(4, bd.getLevelAt(2));
	assertEquals(1, bd.getLevelAt(1000));
	assertEquals(2, bd.getRunCount());
	assertRunArrayEquals(new int[][] { { 0, 2, 2 }, { 2, 3, 4 }, }, bd);
	assertFalse(bd.isLeftToRight());
	assertTrue(bd.isMixed());
	assertFalse(bd.isRightToLeft());
}
 
開發者ID:shannah,項目名稱:cn1,代碼行數:16,代碼來源:BidiTest.java

示例3: testComplicatedBidi

public void testComplicatedBidi() {
	bd = new Bidi("a\u05D0a\"a\u05D0\"\u05D0a",
			Bidi.DIRECTION_RIGHT_TO_LEFT);
	assertFalse(bd.baseIsLeftToRight());
	assertEquals(1, bd.getBaseLevel());
	assertEquals(9, bd.getLength());
	assertEquals(2, bd.getLevelAt(0));
	assertEquals(1, bd.getLevelAt(1));
	assertEquals(2, bd.getLevelAt(2));
	assertEquals(2, bd.getLevelAt(3));
	assertEquals(2, bd.getLevelAt(4));
	assertEquals(1, bd.getLevelAt(5));
	assertEquals(1, bd.getLevelAt(6));
	assertEquals(1, bd.getLevelAt(7));
	assertEquals(2, bd.getLevelAt(8));
	assertEquals(1, bd.getLevelAt(1000));
	assertEquals(5, bd.getRunCount());
	assertRunArrayEquals(new int[][] { { 0, 1, 2 }, { 1, 2, 1 },
			{ 2, 5, 2 }, { 5, 8, 1 }, { 8, 9, 2 }, }, bd);
	assertFalse(bd.isLeftToRight());
	assertTrue(bd.isMixed());
	assertFalse(bd.isRightToLeft());
}
 
開發者ID:shannah,項目名稱:cn1,代碼行數:23,代碼來源:BidiTest.java

示例4: testComplicatedOverrideBidi

public void testComplicatedOverrideBidi() {
	bd = new Bidi("a\u05D0a\"a\u05D0\"\u05D0a".toCharArray(), 0,
			new byte[] { 0, 0, 0, -3, -3, 2, 2, 0, 3 }, 0, 9,
			Bidi.DIRECTION_RIGHT_TO_LEFT);
	assertFalse(bd.baseIsLeftToRight());
	assertEquals(1, bd.getBaseLevel());
	assertEquals(9, bd.getLength());
	assertEquals(2, bd.getLevelAt(0));
	assertEquals(1, bd.getLevelAt(1));
	assertEquals(2, bd.getLevelAt(2));
	assertEquals(3, bd.getLevelAt(3));
	assertEquals(3, bd.getLevelAt(4));
	assertEquals(3, bd.getLevelAt(5));
	assertEquals(2, bd.getLevelAt(6));
	assertEquals(1, bd.getLevelAt(7));
	assertEquals(4, bd.getLevelAt(8));
	assertEquals(1, bd.getLevelAt(1000));
	assertEquals(7, bd.getRunCount());
	assertRunArrayEquals(new int[][] { { 0, 1, 2 }, { 1, 2, 1 },
			{ 2, 3, 2 }, { 3, 6, 3 }, { 6, 7, 2 }, { 7, 8, 1 },
			{ 8, 9, 4 }, }, bd);
	assertFalse(bd.isLeftToRight());
	assertTrue(bd.isMixed());
	assertFalse(bd.isRightToLeft());
}
 
開發者ID:shannah,項目名稱:cn1,代碼行數:25,代碼來源:BidiTest.java

示例5: testCreateLineBidi

public void testCreateLineBidi() {
	bd = new Bidi("a\u05D0a\u05D0a\u05D0\"\u05D0a".toCharArray(), 0,
			new byte[] { 0, 0, 0, -3, -3, 2, 2, 0, 3 }, 0, 9,
			Bidi.DIRECTION_RIGHT_TO_LEFT);
	Bidi line = bd.createLineBidi(2, 7);
	assertFalse(line.baseIsLeftToRight());
	assertEquals(1, line.getBaseLevel());
	assertEquals(5, line.getLength());
	assertEquals(2, line.getLevelAt(0));
	assertEquals(3, line.getLevelAt(1));
	assertEquals(3, line.getLevelAt(2));
	assertEquals(3, line.getLevelAt(3));
	assertEquals(2, line.getLevelAt(4));
	assertEquals(1, line.getLevelAt(1000));
	assertEquals(3, line.getRunCount());
	assertRunArrayEquals(new int[][] { { 0, 1, 2 }, { 1, 4, 3 },
			{ 4, 5, 2 }, }, line);
	assertFalse(line.isLeftToRight());
	assertTrue(line.isMixed());
	assertFalse(line.isRightToLeft());
}
 
開發者ID:shannah,項目名稱:cn1,代碼行數:21,代碼來源:BidiTest.java

示例6: testIncompatibleLineAlgorithm

public void testIncompatibleLineAlgorithm() {
	// ICU treat a new line as in the same run, however RI does not
	bd = new Bidi("aaaaa".toCharArray(), 0,
			new byte[] { -2, -1, -3, -3, -2 }, 0, 5,
			Bidi.DIRECTION_RIGHT_TO_LEFT);
	Bidi line = bd.createLineBidi(1, 4);
	assertFalse(line.baseIsLeftToRight());
	assertEquals(1, line.getBaseLevel());
	assertEquals(3, line.getLength());
	assertEquals(1, line.getLevelAt(0));
	assertEquals(1, line.getLevelAt(1));
	assertEquals(1, line.getLevelAt(2));
	assertEquals(1, line.getLevelAt(1000));
	assertEquals(1, line.getRunCount());
	assertRunArrayEquals(new int[][] { { 0, 3, 1 }, }, line);
	assertFalse(line.isLeftToRight());
	assertFalse(line.isMixed());
	assertTrue(line.isRightToLeft());
}
 
開發者ID:shannah,項目名稱:cn1,代碼行數:19,代碼來源:BidiTest.java

示例7: testBadEmbeddings

public void testBadEmbeddings() {
	try {
		bd = new Bidi("".toCharArray(), 0, new byte[] {}, 0, 1,
				Bidi.DIRECTION_RIGHT_TO_LEFT);
		fail("should throw IAE");
	} catch (IllegalArgumentException e) {
		// expected
	}
}
 
開發者ID:shannah,項目名稱:cn1,代碼行數:9,代碼來源:BidiTest.java

示例8: testRIBug_1

public void testRIBug_1() {
	bd = new Bidi("t", Bidi.DIRECTION_RIGHT_TO_LEFT);
	assertFalse(bd.baseIsLeftToRight());
	// the base level it the essential cause
	assertEquals(1, bd.getBaseLevel());
	assertEquals(1, bd.getLength());
	assertEquals(2, bd.getLevelAt(0));
	assertEquals(1, bd.getLevelAt(1000));
	assertEquals(1, bd.getRunCount());
	assertRunArrayEquals(new int[][] { { 0, 1, 2 }, }, bd);
	assertFalse(bd.isLeftToRight());
	assertTrue(bd.isMixed());
	assertFalse(bd.isRightToLeft());
}
 
開發者ID:shannah,項目名稱:cn1,代碼行數:14,代碼來源:BidiTest.java

示例9: testCreateLineBidi_AndroidFailure

public void testCreateLineBidi_AndroidFailure() {
    // This is a difference between ICU4C and the RI. ICU4C insists that 'limit' is strictly
    // greater than 'start'. We have to paper over this in our Java code.
    Bidi bidi = new Bidi("str", Bidi.DIRECTION_RIGHT_TO_LEFT);
    bidi.createLineBidi(2, 2);
}
 
開發者ID:keplersj,項目名稱:In-the-Box-Fork,代碼行數:6,代碼來源:OldBidiTest.java

示例10: getDefaultDirection

private static int getDefaultDirection(final Object runDirection) {
    return TextAttribute.RUN_DIRECTION_LTR.equals(runDirection)
           ? Bidi.DIRECTION_LEFT_TO_RIGHT
           : Bidi.DIRECTION_RIGHT_TO_LEFT;
}
 
開發者ID:shannah,項目名稱:cn1,代碼行數:5,代碼來源:AbstractDocument.java


注:本文中的java.text.Bidi.DIRECTION_RIGHT_TO_LEFT屬性示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。