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


Java VersionID类代码示例

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


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

示例1: findMatch

import jnlp.sample.util.VersionID; //导入依赖的package包/类
/** This method finds the best match, or return the best error code. The
    *  result parameter must be an array with room for one element.
    *
    *  If a match is found, the method returns DownloadResponse.STS_00_OK
    *  If one or more entries matches on: name, version-id, os, arch, and locale,
    *  then the one with the highest version-id is set in the result[0] field.
    *
    *  If a match is not found, it returns an error code, either: ERR_10_NO_RESOURCE,
    *  ERR_11_NO_VERSION, ERR_20_UNSUP_OS, ERR_21_UNSUP_ARCH, ERR_22_UNSUP_LOCALE,
    *  ERR_23_UNSUP_JRE.
    *
    */
   public int findMatch(List list, String name, DownloadRequest dreq, JnlpResource[] result) {
if (list == null) return DownloadResponse.ERR_10_NO_RESOURCE;
// Setup return values
VersionID bestVersionId = null;
int error = DownloadResponse.ERR_10_NO_RESOURCE;
VersionString vs = new VersionString(dreq.getVersion());
// Iterate through entries
for(int i = 0; i < list.size(); i++) {
    JnlpResource respath = (JnlpResource)list.get(i);
    VersionID vid = new VersionID(respath.getVersionId());	
    int sts = matchEntry(name, vs, dreq, respath, vid);
    if (sts == DownloadResponse.STS_00_OK) {
	if (result[0] == null || vid.isGreaterThan(bestVersionId)) {
	    result[0] = respath;
	    bestVersionId = vid;
	}
    } else {
	error = Math.max(error, sts);
    }
}
return (result[0] != null) ? DownloadResponse.STS_00_OK : error;
   }
 
开发者ID:steveonjava,项目名称:widgetfx,代码行数:35,代码来源:ResourceCatalog.java

示例2: matchEntry

import jnlp.sample.util.VersionID; //导入依赖的package包/类
public int matchEntry(String name, VersionString vs, DownloadRequest dreq, JnlpResource jnlpres, VersionID vid) {
if (!name.equals(jnlpres.getName())) {
    return DownloadResponse.ERR_10_NO_RESOURCE;
}
if (!vs.contains(vid)) {
    return DownloadResponse.ERR_11_NO_VERSION;
}
if (!prefixMatchLists(jnlpres.getOSList(), dreq.getOS())) {
    return DownloadResponse.ERR_20_UNSUP_OS;
}
if (!prefixMatchLists(jnlpres.getArchList(), dreq.getArch())) {
    return DownloadResponse.ERR_21_UNSUP_ARCH;
}
if (!prefixMatchLists(jnlpres.getLocaleList(), dreq.getLocale())) {
    return DownloadResponse.ERR_22_UNSUP_LOCALE;
}
return DownloadResponse.STS_00_OK;
   }
 
开发者ID:steveonjava,项目名称:widgetfx,代码行数:19,代码来源:ResourceCatalog.java

示例3: matchEntry

import jnlp.sample.util.VersionID; //导入依赖的package包/类
public int matchEntry( String name, VersionString vs, DownloadRequest dreq, JnlpResource jnlpres, VersionID vid )
{
    if ( !name.equals( jnlpres.getName() ) )
    {
        return DownloadResponse.ERR_10_NO_RESOURCE;
    }
    if ( !vs.contains( vid ) )
    {
        return DownloadResponse.ERR_11_NO_VERSION;
    }
    if ( !prefixMatchLists( jnlpres.getOSList(), dreq.getOS() ) )
    {
        return DownloadResponse.ERR_20_UNSUP_OS;
    }
    if ( !prefixMatchLists( jnlpres.getArchList(), dreq.getArch() ) )
    {
        return DownloadResponse.ERR_21_UNSUP_ARCH;
    }
    if ( !prefixMatchLists( jnlpres.getLocaleList(), dreq.getLocale() ) )
    {
        return DownloadResponse.ERR_22_UNSUP_LOCALE;
    }
    return DownloadResponse.STS_00_OK;
}
 
开发者ID:mojohaus,项目名称:webstart,代码行数:25,代码来源:ResourceCatalog.java

示例4: findMatch

import jnlp.sample.util.VersionID; //导入依赖的package包/类
/** This method finds the best match, or return the best error code. The
 *  result parameter must be an array with room for one element.
 *
 *  If a match is found, the method returns DownloadResponse.STS_00_OK
 *  If one or more entries matches on: name, version-id, os, arch, and locale,
 *  then the one with the highest version-id is set in the result[0] field.
 *
 *  If a match is not found, it returns an error code, either: ERR_10_NO_RESOURCE,
 *  ERR_11_NO_VERSION, ERR_20_UNSUP_OS, ERR_21_UNSUP_ARCH, ERR_22_UNSUP_LOCALE,
 *  ERR_23_UNSUP_JRE.
 *
 */
public int findMatch(List list, String name, DownloadRequest dreq, JnlpResource[] result) {
    if (list == null) return DownloadResponse.ERR_10_NO_RESOURCE;
    // Setup return values
    VersionID bestVersionId = null;
    int error = DownloadResponse.ERR_10_NO_RESOURCE;
    VersionString vs = new VersionString(dreq.getVersion());
    // Iterate through entries
    for(int i = 0; i < list.size(); i++) {
        JnlpResource respath = (JnlpResource)list.get(i);
        VersionID vid = new VersionID(respath.getVersionId());
        int sts = matchEntry(name, vs, dreq, respath, vid);
        if (sts == DownloadResponse.STS_00_OK) {
            if (result[0] == null || vid.isGreaterThan(bestVersionId)) {
                result[0] = respath;
                bestVersionId = vid;
            }
        } else {
            error = Math.max(error, sts);
        }
    }
    return (result[0] != null) ? DownloadResponse.STS_00_OK : error;
}
 
开发者ID:WhiteBearSolutions,项目名称:WBSAirback,代码行数:35,代码来源:ResourceCatalog.java

示例5: matchEntry

import jnlp.sample.util.VersionID; //导入依赖的package包/类
public int matchEntry(String name, VersionString vs, DownloadRequest dreq, JnlpResource jnlpres, VersionID vid) {
    if (!name.equals(jnlpres.getName())) {
        return DownloadResponse.ERR_10_NO_RESOURCE;
    }
    if (!vs.contains(vid)) {
        return DownloadResponse.ERR_11_NO_VERSION;
    }
    if (!prefixMatchLists(jnlpres.getOSList(), dreq.getOS())) {
        return DownloadResponse.ERR_20_UNSUP_OS;
    }
    if (!prefixMatchLists(jnlpres.getArchList(), dreq.getArch())) {
        return DownloadResponse.ERR_21_UNSUP_ARCH;
    }
    if (!prefixMatchLists(jnlpres.getLocaleList(), dreq.getLocale())) {
        return DownloadResponse.ERR_22_UNSUP_LOCALE;
    }
    return DownloadResponse.STS_00_OK;
}
 
开发者ID:WhiteBearSolutions,项目名称:WBSAirback,代码行数:19,代码来源:ResourceCatalog.java

示例6: findMatch

import jnlp.sample.util.VersionID; //导入依赖的package包/类
/**
 * This method finds the best match, or return the best error code. The
 * result parameter must be an array with room for one element.
 * <p>
 * If a match is found, the method returns DownloadResponse.STS_00_OK
 * If one or more entries matches on: name, version-id, os, arch, and locale,
 * then the one with the highest version-id is set in the result[0] field.
 * <p>
 * If a match is not found, it returns an error code, either: ERR_10_NO_RESOURCE,
 * ERR_11_NO_VERSION, ERR_20_UNSUP_OS, ERR_21_UNSUP_ARCH, ERR_22_UNSUP_LOCALE,
 * ERR_23_UNSUP_JRE.
 *
 * @param list   TODO
 * @param name   TODO
 * @param dreq   TODO
 * @param result TODO
 * @return TODO
 */
public int findMatch( List list, String name, DownloadRequest dreq, JnlpResource[] result )
{
    if ( list == null )
    {
        return DownloadResponse.ERR_10_NO_RESOURCE;
    }
    // Setup return values
    VersionID bestVersionId = null;
    int error = DownloadResponse.ERR_10_NO_RESOURCE;
    VersionString vs = new VersionString( dreq.getVersion() );
    // Iterate through entries
    for ( Object aList : list )
    {
        JnlpResource respath = (JnlpResource) aList;
        VersionID vid = new VersionID( respath.getVersionId() );
        int sts = matchEntry( name, vs, dreq, respath, vid );
        if ( sts == DownloadResponse.STS_00_OK )
        {
            if ( result[0] == null || vid.isGreaterThan( bestVersionId ) )
            {
                result[0] = respath;
                bestVersionId = vid;
            }
        }
        else
        {
            error = Math.max( error, sts );
        }
    }
    return ( result[0] != null ) ? DownloadResponse.STS_00_OK : error;
}
 
开发者ID:mojohaus,项目名称:webstart,代码行数:50,代码来源:ResourceCatalog.java


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