<commit_before>package com.github.jsonldjava.core;

import com.github.jsonldjava.core.JsonLdConsts.Embed;

/**
 * The JsonLdOptions type as specified in the
 * <a href="http://www.w3.org/TR/json-ld-api/#the-jsonldoptions-type">JSON-LD-
 * API specification</a>.
 *
 * @author tristan
 *
 */
public class JsonLdOptions {

    public static final String JSON_LD_1_0 = "json-ld-1.0";

    public static final String JSON_LD_1_1 = "json-ld-1.1";
    
    public static final String JSON_LD_1_1_FRAME = "json-ld-1.1-expand-frame";

    public static final boolean DEFAULT_COMPACT_ARRAYS = true;

	/**
     * Constructs an instance of JsonLdOptions using an empty base.
     */
    public JsonLdOptions() {
        this("");
    }

    /**
     * Constructs an instance of JsonLdOptions using the given base.
     *
     * @param base
     *            The base IRI for the document.
     */
    public JsonLdOptions(String base) {
        this.setBase(base);
    }

    // Base options : http://www.w3.org/TR/json-ld-api/#idl-def-JsonLdOptions

    /**
     * http://www.w3.org/TR/json-ld-api/#widl-JsonLdOptions-base
     */
    private String base = null;

    /**
     * http://www.w3.org/TR/json-ld-api/#widl-JsonLdOptions-compactArrays
     */
    private Boolean compactArrays = DEFAULT_COMPACT_ARRAYS;
    /**
     * http://www.w3.org/TR/json-ld-api/#widl-JsonLdOptions-expandContext
     */
    private Object expandContext = null;
    /**
     * http://www.w3.org/TR/json-ld-api/#widl-JsonLdOptions-processingMode
     */
    private String processingMode = JSON_LD_1_0;
    /**
     * http://www.w3.org/TR/json-ld-api/#widl-JsonLdOptions-documentLoader
     */
    private DocumentLoader documentLoader = new DocumentLoader();

    // Frame options : http://json-ld.org/spec/latest/json-ld-framing/

    private Embed embed = Embed.LAST;
    private Boolean explicit = null;
    private Boolean omitDefault = null;
    private Boolean pruneBlankNodeIdentifiers = true;
    private Boolean requireAll = false;

    // RDF conversion options :
    // http://www.w3.org/TR/json-ld-api/#serialize-rdf-as-json-ld-algorithm

    Boolean useRdfType = false;
    Boolean useNativeTypes = false;
    private boolean produceGeneralizedRdf = false;

    public String getEmbed() {
        switch (this.embed) {
        case ALWAYS:
            return "@always";
        case NEVER:
            return "@never";
        case LINK:
            return "@link";
        default:
            return "@last";
        }
    }

    Embed getEmbedVal() {
        return this.embed;
    }

    public void setEmbed(Boolean embed) {
        this.embed = embed ? Embed.LAST : Embed.NEVER;
    }

    public void setEmbed(String embed) throws JsonLdError {
        switch (embed) {
        case "@always":
            this.embed = Embed.ALWAYS;
        case "@never":
            this.embed = Embed.NEVER;
        case "@last":
            this.embed = Embed.LAST;
        case "@link":
            this.embed = Embed.LINK;
        default:
            throw new JsonLdError(JsonLdError.Error.INVALID_EMBED_VALUE);
        }<commit_msg>Fix "switch" fallthrough bug in JsonLdOptions<commit_after>package com.github.jsonldjava.core;

import com.github.jsonldjava.core.JsonLdConsts.Embed;

/**
 * The JsonLdOptions type as specified in the
 * <a href="http://www.w3.org/TR/json-ld-api/#the-jsonldoptions-type">JSON-LD-
 * API specification</a>.
 *
 * @author tristan
 *
 */
public class JsonLdOptions {

    public static final String JSON_LD_1_0 = "json-ld-1.0";

    public static final String JSON_LD_1_1 = "json-ld-1.1";
    
    public static final String JSON_LD_1_1_FRAME = "json-ld-1.1-expand-frame";

    public static final boolean DEFAULT_COMPACT_ARRAYS = true;

	/**
     * Constructs an instance of JsonLdOptions using an empty base.
     */
    public JsonLdOptions() {
        this("");
    }

    /**
     * Constructs an instance of JsonLdOptions using the given base.
     *
     * @param base
     *            The base IRI for the document.
     */
    public JsonLdOptions(String base) {
        this.setBase(base);
    }

    // Base options : http://www.w3.org/TR/json-ld-api/#idl-def-JsonLdOptions

    /**
     * http://www.w3.org/TR/json-ld-api/#widl-JsonLdOptions-base
     */
    private String base = null;

    /**
     * http://www.w3.org/TR/json-ld-api/#widl-JsonLdOptions-compactArrays
     */
    private Boolean compactArrays = DEFAULT_COMPACT_ARRAYS;
    /**
     * http://www.w3.org/TR/json-ld-api/#widl-JsonLdOptions-expandContext
     */
    private Object expandContext = null;
    /**
     * http://www.w3.org/TR/json-ld-api/#widl-JsonLdOptions-processingMode
     */
    private String processingMode = JSON_LD_1_0;
    /**
     * http://www.w3.org/TR/json-ld-api/#widl-JsonLdOptions-documentLoader
     */
    private DocumentLoader documentLoader = new DocumentLoader();

    // Frame options : http://json-ld.org/spec/latest/json-ld-framing/

    private Embed embed = Embed.LAST;
    private Boolean explicit = null;
    private Boolean omitDefault = null;
    private Boolean pruneBlankNodeIdentifiers = true;
    private Boolean requireAll = false;

    // RDF conversion options :
    // http://www.w3.org/TR/json-ld-api/#serialize-rdf-as-json-ld-algorithm

    Boolean useRdfType = false;
    Boolean useNativeTypes = false;
    private boolean produceGeneralizedRdf = false;

    public String getEmbed() {
        switch (this.embed) {
        case ALWAYS:
            return "@always";
        case NEVER:
            return "@never";
        case LINK:
            return "@link";
        default:
            return "@last";
        }
    }

    Embed getEmbedVal() {
        return this.embed;
    }

    public void setEmbed(Boolean embed) {
        this.embed = embed ? Embed.LAST : Embed.NEVER;
    }

    public void setEmbed(String embed) throws JsonLdError {
        switch (embed) {
        case "@always":
            this.embed = Embed.ALWAYS;
            break;
        case "@never":
            this.embed = Embed.NEVER;
            break;
        case "@last":
            this.embed = Embed.LAST;
            break;
        case "@link":
            this.embed = Embed.LINK;
            break;
        default:
            throw new JsonLdError(JsonLdError.Error.INVALID_EMBED_VALUE);
        }
{'fraction_non_alphanumeric': 0.11983601387574898, 'fraction_numerical': 0.006937874487543362, 'mean_word_length': 2.1683316683316685, 'pattern_counts': {'":': 8, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 16, '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': '6646914', 'n_tokens_mistral': 2040, 'n_tokens_neox': 1996, 'n_words': 415}