本文整理汇总了Java中java.awt.font.NumericShaper.getContextualShaper方法的典型用法代码示例。如果您正苦于以下问题:Java NumericShaper.getContextualShaper方法的具体用法?Java NumericShaper.getContextualShaper怎么用?Java NumericShaper.getContextualShaper使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类java.awt.font.NumericShaper
的用法示例。
在下文中一共展示了NumericShaper.getContextualShaper方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testGetContextualShaperIntInt
import java.awt.font.NumericShaper; //导入方法依赖的package包/类
public final void testGetContextualShaperIntInt() {
NumericShaper ns;
ns = NumericShaper.getContextualShaper(NumericShaper.ARABIC | NumericShaper.TAMIL, NumericShaper.EASTERN_ARABIC);
assertNotNull(ns);
assertEquals("Ranges are different", NumericShaper.ARABIC | NumericShaper.TAMIL, ns.getRanges());
assertTrue("Contextual shaper isContextual() method must return true value", ns.isContextual());
try{
// wrong ranges value
ns = NumericShaper.getShaper(13);
fail("IlligalArgumentException wasn't thrown with invalid shaper value");
} catch (IllegalArgumentException e){
}
}
示例2: testGetContextualShaperInt
import java.awt.font.NumericShaper; //导入方法依赖的package包/类
public final void testGetContextualShaperInt() {
NumericShaper ns;
ns = NumericShaper.getContextualShaper(NumericShaper.ARABIC | NumericShaper.TAMIL);
assertNotNull(ns);
assertEquals("Ranges are not the same", NumericShaper.ARABIC | NumericShaper.TAMIL, ns.getRanges());
assertTrue("Default contextual shaper isContextual() method must return true value", ns.isContextual());
try{
// wrong ranges value
ns = NumericShaper.getShaper(13);
fail("IlligalArgumentException wasn't thrown with invalid shaper value");
} catch (IllegalArgumentException e){
}
}
示例3: testEqualsObject
import java.awt.font.NumericShaper; //导入方法依赖的package包/类
public final void testEqualsObject() {
NumericShaper ns;
NumericShaper ns1;
// Simple shapers are equal
ns = NumericShaper.getShaper(NumericShaper.BENGALI);
assertTrue("NonContextual object isn't equal to itself", ns.equals(ns));
ns1 = NumericShaper.getShaper(NumericShaper.BENGALI);
assertTrue("NonContextual object isn't equal to the equal object", ns.equals(ns1));
ns1 = NumericShaper.getShaper(NumericShaper.ARABIC);
assertFalse("Object equals to the different NumericShaper nonContextual object", ns.equals(ns1));
// Context shapers with default context are equal
ns = NumericShaper.getContextualShaper(NumericShaper.BENGALI);
assertTrue("Contextual(default) object isn't equal to itself", ns.equals(ns));
ns1 = NumericShaper.getContextualShaper(NumericShaper.BENGALI);
assertTrue("Contextual(default) object isn't equal to the equal object", ns.equals(ns1));
ns1 = NumericShaper.getContextualShaper(NumericShaper.ARABIC);
assertFalse("Object equals to the different NumericShaper contextual(default) object", ns.equals(ns1));
// Context shapers with context are equal
ns = NumericShaper.getContextualShaper(NumericShaper.ARABIC | NumericShaper.ETHIOPIC, NumericShaper.BENGALI);
assertTrue("Contextual object isn't equal to itself", ns.equals(ns));
ns1 = NumericShaper.getContextualShaper(NumericShaper.ARABIC | NumericShaper.ETHIOPIC, NumericShaper.BENGALI);
assertTrue("Contextual object isn't equal to the equal object", ns.equals(ns1));
ns1 = NumericShaper.getContextualShaper(NumericShaper.ARABIC | NumericShaper.ETHIOPIC, NumericShaper.EUROPEAN);
assertFalse("Object equals to the different NumericShaper contextual object", ns.equals(ns1));
}
示例4: testGetRanges
import java.awt.font.NumericShaper; //导入方法依赖的package包/类
public final void testGetRanges() {
NumericShaper ns;
int ranges;
ns = NumericShaper.getShaper(NumericShaper.ARABIC);
ranges = ns.getRanges();
assertEquals("Simple shaper ranges have differences", NumericShaper.ARABIC, ranges);
ns = NumericShaper.getContextualShaper(NumericShaper.ARABIC | NumericShaper.TAMIL, NumericShaper.EASTERN_ARABIC);
ranges = ns.getRanges();
assertEquals("Contextual shaper ranges have differences", NumericShaper.ARABIC | NumericShaper.TAMIL, ranges);
}
示例5: testIsContextual
import java.awt.font.NumericShaper; //导入方法依赖的package包/类
public final void testIsContextual() {
NumericShaper ns;
// Simple shapers
ns = NumericShaper.getShaper(NumericShaper.EASTERN_ARABIC);
assertFalse("Simple shapers may not be contextual", ns.isContextual());
// Context shapers with default context
ns = NumericShaper.getContextualShaper(NumericShaper.ARABIC | NumericShaper.TAMIL);
assertTrue("Default context shapers must be contextual", ns.isContextual());
// Context shapers with context
ns = NumericShaper.getContextualShaper(NumericShaper.ARABIC | NumericShaper.TAMIL, NumericShaper.EASTERN_ARABIC);
assertTrue("Context shapers must be contextual", ns.isContextual());
}
示例6: format
import java.awt.font.NumericShaper; //导入方法依赖的package包/类
/**
* Format.
*
* @param str
* String
* @return String
*/
public static String format(final String str) {
final NumericShaper shaper = NumericShaper.getContextualShaper(NumericShaper.ARABIC);
final char[] c = str.toCharArray();
shaper.shape(c, 0, c.length, NumericShaper.ARABIC);
return new String(c);
}