本文整理汇总了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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}