當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。