/**
  * Build a simple {@link SelectionBuilder} to match the requested {@link Uri}. This is usually
  * enough to support {@link #insert}, {@link #update}, and {@link #delete} operations.
  */
 private SelectionBuilder buildSimpleSelection(Uri uri) {
   final SelectionBuilder builder = new SelectionBuilder();
   final int match = sUriMatcher.match(uri);
   switch (match) {
     case ALBUMS:
       {
         return builder.table(Tables.ALBUMS);
       }
     case ALBUMS_ID:
       {
         final String albumId = Albums.getAlbumId(uri);
         return builder.table(Tables.ALBUMS).where(Albums.ID + "=?", albumId);
       }
     case ARTISTS:
       {
         return builder.table(Tables.ARTISTS);
       }
     case ARTISTS_ID:
       {
         final String artistId = Artists.getArtistId(uri);
         return builder.table(Tables.ARTISTS).where(Artists.ID + "=?", artistId);
       }
     default:
       {
         throw new UnsupportedOperationException("Unknown uri: " + uri);
       }
   }
 }
 /**
  * Build an advanced {@link SelectionBuilder} to match the requested {@link Uri}. This is usually
  * only used by {@link #query}, since it performs table joins useful for {@link Cursor} data.
  */
 private SelectionBuilder buildExpandedSelection(Uri uri, int match) {
   final SelectionBuilder builder = new SelectionBuilder();
   switch (match) {
     case ALBUMS:
       {
         return builder.table(Tables.ALBUMS_JOIN_ARTISTS);
       }
     case ALBUMS_ID:
       {
         final String albumId = Albums.getAlbumId(uri);
         return builder.table(Tables.ALBUMS).where(Albums.ID + "=?", albumId);
       }
     case ARTISTS:
       {
         return builder
             .table(Tables.ARTISTS)
             .map(Artists.ALBUMS_COUNT, Subquery.ARTIST_ALBUMS_COUNT);
       }
     case ARTISTS_ID_ALBUMS:
       {
         final String artistId = Artists.getArtistId(uri);
         return builder.table(Tables.ALBUMS).where(Artists.ID + "=?", artistId);
       }
     default:
       {
         throw new UnsupportedOperationException("Unknown uri: " + uri);
       }
   }
 }
 @Override
 public Uri insert(Uri uri, ContentValues values) {
   if (LOGV) Log.v(TAG, "insert(uri=" + uri + ", values=" + values.toString() + ")");
   final SQLiteDatabase db = mOpenHelper.getWritableDatabase();
   final int match = sUriMatcher.match(uri);
   switch (match) {
     case ALBUMS:
       {
         db.insertOrThrow(Tables.ALBUMS, null, values);
         getContext().getContentResolver().notifyChange(uri, null);
         return Albums.buildAlbumUri(values.getAsString(Albums.ID));
       }
     case ARTISTS:
       {
         db.insertOrThrow(Tables.ARTISTS, null, values);
         getContext().getContentResolver().notifyChange(uri, null);
         return Artists.buildArtistUri(values.getAsString(Artists.ID));
       }
     default:
       {
         throw new UnsupportedOperationException("Unknown uri: " + uri);
       }
   }
 }