本文整理匯總了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());
}
示例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);
}
示例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();
}
}
示例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);
}
示例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);
}
示例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());
}
示例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());
}
示例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());
}
示例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());
}
示例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());
}
示例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());
}