当前位置: 首页>>代码示例>>Java>>正文


Java CollationElementIterator类代码示例

本文整理汇总了Java中java.text.CollationElementIterator的典型用法代码示例。如果您正苦于以下问题:Java CollationElementIterator类的具体用法?Java CollationElementIterator怎么用?Java CollationElementIterator使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


CollationElementIterator类属于java.text包,在下文中一共展示了CollationElementIterator类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: testPrevious

import java.text.CollationElementIterator; //导入依赖的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: testNext

import java.text.CollationElementIterator; //导入依赖的package包/类
public void testNext() {
	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:shannah,项目名称:cn1,代码行数:24,代码来源:CollationElementIteratorTest.java

示例3: testReset

import java.text.CollationElementIterator; //导入依赖的package包/类
public void testReset() {
	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);

	iterator.reset();
	assertEquals(0, iterator.getOffset());
}
 
开发者ID:shannah,项目名称:cn1,代码行数:19,代码来源:CollationElementIteratorTest.java

示例4: testTertiaryOrder

import java.text.CollationElementIterator; //导入依赖的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

示例5: assertCollationElementIterator

import java.text.CollationElementIterator; //导入依赖的package包/类
private void assertCollationElementIterator(CollationElementIterator it, Integer... offsets) {
    for (int offset : offsets) {
        assertEquals(offset, it.getOffset());
        it.next();
    }
    assertEquals(CollationElementIterator.NULLORDER, it.next());
}
 
开发者ID:keplersj,项目名称:In-the-Box-Fork,代码行数:8,代码来源:CollatorTest.java

示例6: testGetOffset

import java.text.CollationElementIterator; //导入依赖的package包/类
public void testGetOffset() {
	String text = "abc";
	CollationElementIterator iterator = coll
			.getCollationElementIterator(text);
	int[] offsets = { 0, 1, 2, 3 };
	int offset = iterator.getOffset();
	int i = 0;
	assertEquals(offsets[i++], offset);
	while (offset != text.length()) {
		iterator.next();
		offset = iterator.getOffset();
		assertEquals(offsets[i++], offset);
	}
}
 
开发者ID:shannah,项目名称:cn1,代码行数:15,代码来源:CollationElementIteratorTest.java

示例7: testGetMaxExpansion

import java.text.CollationElementIterator; //导入依赖的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

示例8: testPrimaryOrder

import java.text.CollationElementIterator; //导入依赖的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

示例9: testSecondaryOrder

import java.text.CollationElementIterator; //导入依赖的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

示例10: testSetOffset

import java.text.CollationElementIterator; //导入依赖的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

示例11: testSetTextString

import java.text.CollationElementIterator; //导入依赖的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

示例12: testSetTextCharacterIterator

import java.text.CollationElementIterator; //导入依赖的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

示例13: testSetOffset

import java.text.CollationElementIterator; //导入依赖的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

示例14: testSetTextString

import java.text.CollationElementIterator; //导入依赖的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

示例15: testSetTextCharacterIterator

import java.text.CollationElementIterator; //导入依赖的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.CollationElementIterator类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。