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


Java EditDistance类代码示例

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


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

示例1: checkUnusedProperties

import com.sun.xml.internal.bind.v2.util.EditDistance; //导入依赖的package包/类
/**
 * Report errors for unused propOrder entries.
 */
public void checkUnusedProperties() {
    for( int i=0; i<used.length; i++ )
        if(used[i]==null) {
            String unusedName = propOrder[i];
            String nearest = EditDistance.findNearest(unusedName, new AbstractList<String>() {
                public String get(int index) {
                    return properties.get(index).getName();
                }

                public int size() {
                    return properties.size();
                }
            });
            boolean isOverriding = (i > (properties.size()-1)) ? false : properties.get(i).hasAnnotation(OverrideAnnotationOf.class);
            if (!isOverriding) {
                builder.reportError(new IllegalAnnotationException(
                Messages.PROPERTY_ORDER_CONTAINS_UNUSED_ENTRY.format(unusedName,nearest),ClassInfoImpl.this));
            }
        }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:24,代码来源:ClassInfoImpl.java

示例2: getNearestTypeName

import com.sun.xml.internal.bind.v2.util.EditDistance; //导入依赖的package包/类
/**
 * Finds a type name that this context recognizes which is
 * "closest" to the given type name.
 *
 * <p>
 * This method is used for error recovery.
 */
public String getNearestTypeName(QName name) {
    String[] all = new String[typeMap.size()];
    int i=0;
    for (QName qn : typeMap.keySet()) {
        if(qn.getLocalPart().equals(name.getLocalPart()))
            return qn.toString();  // probably a match, as people often gets confused about namespace.
        all[i++] = qn.toString();
    }

    String nearest = EditDistance.findNearest(name.toString(), all);

    if(EditDistance.editDistance(nearest,name.toString())>10)
        return null;    // too far apart.

    return nearest;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:24,代码来源:JAXBContextImpl.java

示例3: checkAndEnable

import com.sun.xml.internal.bind.v2.util.EditDistance; //导入依赖的package包/类
/**
 * Verify that the given URI is indeed a valid extension namespace URI,
 * and if so enable it.
 * <p>
 * This method does all the error handling.
 */
protected final void checkAndEnable(String uri) throws SAXException {
    if( !isRecognizableExtension(uri) ) {
        String nearest = EditDistance.findNearest(uri, recognizableExtensions);
        // not the namespace URI we know of
        error( Messages.ERR_UNSUPPORTED_EXTENSION.format(uri,nearest) );
    } else
    if( !isSupportedExtension(uri) ) {
        // recognizable but not not supported, meaning
        // the plug-in isn't enabled

        // look for plug-in that handles this URI
        Plugin owner = null;
        for( Plugin p : options.getAllPlugins() ) {
            if(p.getCustomizationURIs().contains(uri)) {
                owner = p;
                break;
            }
        }
        if(owner!=null)
            // we know the plug-in that supports this namespace, but it's not enabled
            error( Messages.ERR_PLUGIN_NOT_ENABLED.format(owner.getOptionName(),uri));
        else {
            // this shouldn't happen, but be defensive...
            error( Messages.ERR_UNSUPPORTED_EXTENSION.format(uri) );
        }
    }

    // as an error recovery enable this namespace URI anyway.
    enabledExtensions.add(uri);
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:37,代码来源:AbstractExtensionBindingChecker.java


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