<commit_before>/*
 * Copyright (C) 2017 <NAME>, www.github.com/steve111MV/DeliciousRecipes
 */

package cg.stevendende.deliciousrecipes.data;

import android.content.ContentResolver;
import android.content.ContentUris;
import android.net.Uri;
import android.provider.BaseColumns;

public class RecipesContract {

    public static final String DATABASE_NAME = "delrecipes.db";

    // The "Content authority" is a name for the entire content provider, similar to the
    // relationship between a domain name and its website.  A convenient string to use for the
    // content authority is the package name for the app, which is guaranteed to be unique on the
    // device.
    public static final String CONTENT_AUTHORITY = "cg.stevendende.deliciousrecipes";

    // The CONTENT_AUTHORITY is used to create the base of all URI's which apps will use to contact
    // the content provider.
    public static final Uri BASE_CONTENT_URI = Uri.parse("content://" + CONTENT_AUTHORITY);

    // Possible paths
    public static final String PATH_RECIPES = "recipes";
    public static final String PATH_RECIPE_INGREDIENTS = "ingredients";
    public static final String PATH_RECIPE_STEPS = "steps";


    /* Inner class that defines the table contents of Movie table */
    public static final class RecipeEntry implements BaseColumns {

        public static final Uri CONTENT_URI =
                BASE_CONTENT_URI.buildUpon().appendPath(PATH_RECIPES).build();

        public static final String CONTENT_TYPE =
                ContentResolver.CURSOR_DIR_BASE_TYPE + "/" + CONTENT_AUTHORITY + "/" + PATH_RECIPES;

        // Table name
        public static final String TABLE_NAME = "recipes";

        public static final String COLUMN_NAME = "name";
        public static final String COLUMN_SERVINGS = "servings";
        public static final String COLUMN_IMAGE = "image";

        public static Uri buildRecipeUri(long id) {
            return ContentUris.withAppendedId(CONTENT_URI, id);
        }

        public static long getRecipeIdFromUri(Uri uri) {
            return Long.parseLong(uri.getLastPathSegment());
        }

        public static final String[] COLUMNS_RECIPES = new String[]{
                RecipesContract.RecipeEntry.TABLE_NAME+"."+RecipesContract.RecipeEntry._ID,
                RecipesContract.RecipeEntry.TABLE_NAME+"."+ RecipeEntry.COLUMN_NAME,
                RecipesContract.RecipeEntry.TABLE_NAME+"."+RecipesContract.RecipeEntry.COLUMN_SERVINGS,
                RecipesContract.RecipeEntry.TABLE_NAME+"."+RecipesContract.RecipeEntry.COLUMN_IMAGE
        };

        public static final int INDEX_ID = 0;
        public static final int INDEX_NAME = 1;
        public static final int INDEX_SERVINGS = 2;
        public static final int INDEX_IMAGE = 3;

    }

    /* Inner class that defines the table contents of Ingredients table */
    public static final class IngredientEntry implements BaseColumns {<commit_msg>refactor: Ensure a fair & working ContentUri with normalization<commit_after>/*
 * Copyright (C) 2017 <NAME>, www.github.com/steve111MV/DeliciousRecipes
 */

package cg.stevendende.deliciousrecipes.data;

import android.content.ContentResolver;
import android.content.ContentUris;
import android.net.Uri;
import android.provider.BaseColumns;

public class RecipesContract {

    public static final String DATABASE_NAME = "delrecipes.db";

    // The "Content authority" is a name for the entire content provider, similar to the
    // relationship between a domain name and its website.  A convenient string to use for the
    // content authority is the package name for the app, which is guaranteed to be unique on the
    // device.
    public static final String CONTENT_AUTHORITY = "cg.stevendende.deliciousrecipes";

    // The CONTENT_AUTHORITY is used to create the base of all URI's which apps will use to contact
    // the content provider.
    public static final Uri BASE_CONTENT_URI = Uri.parse("content://" + CONTENT_AUTHORITY);

    // Possible paths
    public static final String PATH_RECIPES = "recipes";
    public static final String PATH_RECIPE_INGREDIENTS = "ingredients";
    public static final String PATH_RECIPE_STEPS = "steps";


    /* Inner class that defines the table contents of Movie table */
    public static final class RecipeEntry implements BaseColumns {

        public static final Uri CONTENT_URI =
                BASE_CONTENT_URI.buildUpon().appendPath(PATH_RECIPES).build().normalizeScheme();

        public static final String CONTENT_TYPE =
                ContentResolver.CURSOR_DIR_BASE_TYPE + "/" + CONTENT_AUTHORITY + "/" + PATH_RECIPES;

        // Table name
        public static final String TABLE_NAME = "recipes";

        public static final String COLUMN_NAME = "name";
        public static final String COLUMN_SERVINGS = "servings";
        public static final String COLUMN_IMAGE = "image";

        public static Uri buildRecipeUri(long id) {
            return ContentUris.withAppendedId(CONTENT_URI, id).normalizeScheme();
        }

        public static long getRecipeIdFromUri(Uri uri) {
            return Long.parseLong(uri.getLastPathSegment());
        }

        public static final String[] COLUMNS_RECIPES = new String[]{
                RecipesContract.RecipeEntry.TABLE_NAME+"."+RecipesContract.RecipeEntry._ID,
                RecipesContract.RecipeEntry.TABLE_NAME+"."+ RecipeEntry.COLUMN_NAME,
                RecipesContract.RecipeEntry.TABLE_NAME+"."+RecipesContract.RecipeEntry.COLUMN_SERVINGS,
                RecipesContract.RecipeEntry.TABLE_NAME+"."+RecipesContract.RecipeEntry.COLUMN_IMAGE
        };

        public static final int INDEX_ID = 0;
        public static final int INDEX_NAME = 1;
        public static final int INDEX_SERVINGS = 2;
        public static final int INDEX_IMAGE = 3;

    }

    /* Inner class that defines the table contents of Ingredients table */
    public static final class IngredientEntry implements BaseColumns {
{'fraction_non_alphanumeric': 0.07374040707374041, 'fraction_numerical': 0.003670337003670337, 'mean_word_length': 3.1316333563059957, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1221487', 'n_tokens_mistral': 1723, 'n_tokens_neox': 1600, 'n_words': 507}