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


Java NumericShaper.getContextualShaper方法代码示例

本文整理汇总了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){
        
    }
}
 
开发者ID:shannah,项目名称:cn1,代码行数:17,代码来源:NumericShaperTest.java

示例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){
        
    }

}
 
开发者ID:shannah,项目名称:cn1,代码行数:18,代码来源:NumericShaperTest.java

示例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));
}
 
开发者ID:shannah,项目名称:cn1,代码行数:35,代码来源:NumericShaperTest.java

示例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);
}
 
开发者ID:shannah,项目名称:cn1,代码行数:13,代码来源:NumericShaperTest.java

示例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());
}
 
开发者ID:shannah,项目名称:cn1,代码行数:16,代码来源:NumericShaperTest.java

示例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);
}
 
开发者ID:kiswanij,项目名称:jk-util,代码行数:14,代码来源:ArabicDigits.java


注:本文中的java.awt.font.NumericShaper.getContextualShaper方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。