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;
    }
public int findMatch ( List list , String name , DownloadRequest dreq , JnlpResource [ ] result ) { if ( list == null ) { return DownloadResponse . ERR_10_NO_RESOURCE ; } VersionID bestVersionId = null ; int error = DownloadResponse . ERR_10_NO_RESOURCE ; VersionString vs = new VersionString ( dreq . getVersion ( ) ) ; 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 ; }
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