/android/import-contacts

To get this branch, use:
bzr branch http://bzr.ed.am/android/import-contacts

« back to all changes in this revision

Viewing changes to src/am/ed/importcontacts/VcardImporter.java

  • Committer: edam
  • Date: 2012-12-20 17:16:08 UTC
  • Revision ID: tim@ed.am-20121220171608-vx41zykf4krel9xf
slightly improved the efficiency of the cache identifier factory function

Show diffs side-by-side

added added

removed removed

1013
1013
                        HashSet< String > ret = new HashSet< String >();
1014
1014
 
1015
1015
                        Pattern p = Pattern.compile(
1016
 
                                "^" + name + "[ \\t]*=[ \\t]*(\"?)(.*)\\1$",
1017
 
                                Pattern.CASE_INSENSITIVE );
 
1016
                                "^" + name + "[ \\t]*=[ \\t]*(\"?)(.*)\\1$" );
1018
1017
                        for( int i = 0; i < params.length; i++ ) {
1019
1018
                                Matcher m = p.matcher( params[ i ] );
1020
1019
                                if( m.matches() )
1028
1027
                 * Amongst the params, return any type values present. For v2.1 vCards,
1029
1028
                 * those types are just parameters. For v3.0, they are prefixed with
1030
1029
                 * "TYPE=". There may also be multiple type parameters.
1031
 
                 * @param params an array of params to look for types in
1032
 
                 * @param valid_types an list of upper-case type values to look for
 
1030
                 * @param params
 
1031
                 * @param a list of type values to look for
1033
1032
                 * @return a set of present type values
1034
1033
                 */
1035
1034
                private Set< String > extractTypes( String[] params,
1045
1044
                                // the specs!)
1046
1045
                                String[] parts = type_params[ a ].split( "," );
1047
1046
                                for( int i = 0; i < parts.length; i++ )
1048
 
                                        parts[ i ] = parts[ i ].toUpperCase( Locale.US );
1049
 
                                for( int i = 0; i < parts.length; i++ )
1050
1047
                                        if( valid_types.contains( parts[ i ] ) )
1051
1048
                                                types.add( parts[ i ] );
1052
1049
                        }