/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/ContactsCache.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

Lines of Context:
72
72
                 */
73
73
                public static CacheIdentifier factory( Importer.ContactData contact )
74
74
                {
75
 
                        CacheIdentifier ret = null;
 
75
                        CacheIdentifier identifier = null;
76
76
 
77
77
                        if( contact.hasName() )
78
 
                                ret = factory( CacheIdentifier.Type.NAME,
 
78
                                identifier = factory( CacheIdentifier.Type.NAME,
79
79
                                        contact.getName() );
80
 
                        if( ret == null && contact.hasPrimaryOrganisation() )
81
 
                                ret = factory( CacheIdentifier.Type.ORGANISATION,
 
80
                        if( identifier != null ) return identifier;
 
81
 
 
82
                        if( contact.hasPrimaryOrganisation() )
 
83
                                identifier = factory( CacheIdentifier.Type.ORGANISATION,
82
84
                                        contact.getPrimaryOrganisation() );
83
 
                        if( ret == null && contact.hasPrimaryNumber() )
84
 
                                ret = factory( CacheIdentifier.Type.PRIMARY_NUMBER,
 
85
                        if( identifier != null ) return identifier;
 
86
 
 
87
                        if( contact.hasPrimaryNumber() )
 
88
                                identifier = factory( CacheIdentifier.Type.PRIMARY_NUMBER,
85
89
                                        contact.getPrimaryNumber() );
86
 
                        if( ret == null && contact.hasPrimaryEmail() )
87
 
                                ret = factory( CacheIdentifier.Type.PRIMARY_EMAIL,
 
90
                        if( identifier != null ) return identifier;
 
91
 
 
92
                        if( contact.hasPrimaryEmail() )
 
93
                                identifier = factory( CacheIdentifier.Type.PRIMARY_EMAIL,
88
94
                                        contact.getPrimaryEmail() );
 
95
                        if( identifier != null ) return identifier;
89
96
 
90
 
                        return ret;
 
97
                        return null;
91
98
                }
92
99
 
93
100
                protected CacheIdentifier( Type type, String detail )