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


Java RuleBasedCollator.getCollationElementIterator方法代碼示例

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


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

示例1: testPrevious

import java.text.RuleBasedCollator; //導入方法依賴的package包/類
public void testPrevious() {
    RuleBasedCollator coll = (RuleBasedCollator) Collator.getInstance(Locale.US);
    String text = "abc";
    CollationElementIterator iterator = coll
            .getCollationElementIterator(text);
    int[] orders = new int[text.length()];
    int order = iterator.next();
    int i = 0;
    while (order != CollationElementIterator.NULLORDER) {
        orders[i++] = order;
        order = iterator.next();
    }

    int offset = iterator.getOffset();
    assertEquals(text.length(), offset);
    order = iterator.previous();

    while (order != CollationElementIterator.NULLORDER) {
        assertEquals(orders[--i], order);
        order = iterator.previous();
    }

    assertEquals(0, iterator.getOffset());
}
 
開發者ID:keplersj,項目名稱:In-the-Box-Fork,代碼行數:25,代碼來源:OldCollationElementIteratorTest.java

示例2: testTertiaryOrder

import java.text.RuleBasedCollator; //導入方法依賴的package包/類
public void testTertiaryOrder() {
	RuleBasedCollator rbColl = (RuleBasedCollator) Collator
			.getInstance(new Locale("fr", "FR"));
	String text = "abAB";
	CollationElementIterator iterator = rbColl
			.getCollationElementIterator(text);
	int order = iterator.next();
	int tOrder1 = CollationElementIterator.tertiaryOrder(order);
	order = iterator.next();
	int tOrder2 = CollationElementIterator.tertiaryOrder(order);
	assertEquals(tOrder1, tOrder2);

	order = iterator.next();
	tOrder1 = CollationElementIterator.tertiaryOrder(order);
	order = iterator.next();
	tOrder2 = CollationElementIterator.tertiaryOrder(order);
	assertEquals(tOrder1, tOrder2);
}
 
開發者ID:shannah,項目名稱:cn1,代碼行數:19,代碼來源:CollationElementIteratorTest.java

示例3: testGetMaxExpansion

import java.text.RuleBasedCollator; //導入方法依賴的package包/類
public void testGetMaxExpansion() {
	String text = "cha";
	RuleBasedCollator rbColl = (RuleBasedCollator) Collator
			.getInstance(new Locale("es", "", "TRADITIONAL"));
	CollationElementIterator iterator = rbColl
			.getCollationElementIterator(text);
	int order = iterator.next();
	while (order != CollationElementIterator.NULLORDER) {
		assertEquals(1, iterator.getMaxExpansion(order));
		order = iterator.next();
	}

}
 
開發者ID:shannah,項目名稱:cn1,代碼行數:14,代碼來源:CollationElementIteratorTest.java

示例4: testPrimaryOrder

import java.text.RuleBasedCollator; //導入方法依賴的package包/類
public void testPrimaryOrder() {
	RuleBasedCollator rbColl = (RuleBasedCollator) Collator
			.getInstance(new Locale("de", "DE"));
	String text = "\u00e6";
	CollationElementIterator iterator = rbColl
			.getCollationElementIterator(text);
	int order = iterator.next();
	int pOrder = CollationElementIterator.primaryOrder(order);
	CollationElementIterator iterator2 = rbColl
			.getCollationElementIterator("ae");
	int order2 = iterator2.next();
	int pOrder2 = CollationElementIterator.primaryOrder(order2);
	assertEquals(pOrder, pOrder2);
}
 
開發者ID:shannah,項目名稱:cn1,代碼行數:15,代碼來源:CollationElementIteratorTest.java

示例5: testSecondaryOrder

import java.text.RuleBasedCollator; //導入方法依賴的package包/類
public void testSecondaryOrder() {
	RuleBasedCollator rbColl = (RuleBasedCollator) Collator
			.getInstance(new Locale("fr", "FR"));
	String text = "a\u00e0";
	CollationElementIterator iterator = rbColl
			.getCollationElementIterator(text);
	int order = iterator.next();
	int sOrder1 = CollationElementIterator.secondaryOrder(order);

	order = iterator.next();
	int sOrder2 = CollationElementIterator.secondaryOrder(order);

	assertEquals(sOrder1, sOrder2);
}
 
開發者ID:shannah,項目名稱:cn1,代碼行數:15,代碼來源:CollationElementIteratorTest.java

示例6: testSetOffset

import java.text.RuleBasedCollator; //導入方法依賴的package包/類
public void testSetOffset() {
	RuleBasedCollator rbColl = (RuleBasedCollator) Collator
			.getInstance(new Locale("es", "", "TRADITIONAL"));
	String text = "cha";
	CollationElementIterator iterator = rbColl
			.getCollationElementIterator(text);
	iterator.setOffset(1);
	assertEquals(1, iterator.getOffset());
}
 
開發者ID:shannah,項目名稱:cn1,代碼行數:10,代碼來源:CollationElementIteratorTest.java

示例7: testSetTextString

import java.text.RuleBasedCollator; //導入方法依賴的package包/類
public void testSetTextString() {
	RuleBasedCollator rbColl = (RuleBasedCollator) Collator
			.getInstance(new Locale("es", "", "TRADITIONAL"));
	String text = "caa";
	CollationElementIterator iterator = rbColl
			.getCollationElementIterator(text);
	iterator.setOffset(1);
	assertEquals(1, iterator.getOffset());
	iterator.setText("cha");
	iterator.setOffset(1);
	assertEquals(1, iterator.getOffset());
}
 
開發者ID:shannah,項目名稱:cn1,代碼行數:13,代碼來源:CollationElementIteratorTest.java

示例8: testSetTextCharacterIterator

import java.text.RuleBasedCollator; //導入方法依賴的package包/類
public void testSetTextCharacterIterator() {
	RuleBasedCollator rbColl = (RuleBasedCollator) Collator
			.getInstance(new Locale("es", "", "TRADITIONAL"));
	String text = "caa";
	CollationElementIterator iterator = rbColl
			.getCollationElementIterator(text);
	iterator.setOffset(1);
	assertEquals(1, iterator.getOffset());
	iterator.setText(new StringCharacterIterator("cha"));
	iterator.setOffset(1);
	assertEquals(1, iterator.getOffset());
}
 
開發者ID:shannah,項目名稱:cn1,代碼行數:13,代碼來源:CollationElementIteratorTest.java

示例9: testSetOffset

import java.text.RuleBasedCollator; //導入方法依賴的package包/類
public void testSetOffset() {
	RuleBasedCollator rbColl = (RuleBasedCollator) Collator
			.getInstance(new Locale("es", "", "TRADITIONAL"));
	String text = "cha";
	CollationElementIterator iterator = rbColl
			.getCollationElementIterator(text);
	iterator.setOffset(1);
	assertEquals(0, iterator.getOffset());
}
 
開發者ID:freeVM,項目名稱:freeVM,代碼行數:10,代碼來源:CollationElementIteratorTest.java

示例10: testSetTextString

import java.text.RuleBasedCollator; //導入方法依賴的package包/類
public void testSetTextString() {
	RuleBasedCollator rbColl = (RuleBasedCollator) Collator
			.getInstance(new Locale("es", "", "TRADITIONAL"));
	String text = "caa";
	CollationElementIterator iterator = rbColl
			.getCollationElementIterator(text);
	iterator.setOffset(1);
	assertEquals(1, iterator.getOffset());
	iterator.setText("cha");
	iterator.setOffset(1);
	assertEquals(0, iterator.getOffset());
}
 
開發者ID:freeVM,項目名稱:freeVM,代碼行數:13,代碼來源:CollationElementIteratorTest.java

示例11: testSetTextCharacterIterator

import java.text.RuleBasedCollator; //導入方法依賴的package包/類
public void testSetTextCharacterIterator() {
	RuleBasedCollator rbColl = (RuleBasedCollator) Collator
			.getInstance(new Locale("es", "", "TRADITIONAL"));
	String text = "caa";
	CollationElementIterator iterator = rbColl
			.getCollationElementIterator(text);
	iterator.setOffset(1);
	assertEquals(1, iterator.getOffset());
	iterator.setText(new StringCharacterIterator("cha"));
	iterator.setOffset(1);
	assertEquals(0, iterator.getOffset());
}
 
開發者ID:freeVM,項目名稱:freeVM,代碼行數:13,代碼來源:CollationElementIteratorTest.java


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