<commit_before>/*
 * Copyright 2013-2016 Netherlands Forensic Institute
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package nl.minvenj.nfi.metal.data;

import static nl.minvenj.nfi.metal.Util.checkNotNull;

public final class ParseItem {

    private final ParseValue _pv;
    private final ParseGraph _pg;
    private final ParseRef _pr;

    public ParseItem(final ParseValue pv) {
        _pv = checkNotNull(pv, "pv");
        _pg = null;
        _pr = null;
    }

    public ParseItem(final ParseGraph pg) {
        _pg = checkNotNull(pg, "pg");
        _pv = null;
        _pr = null;
    }

    public ParseItem(final ParseRef ref) {
        _pg = null;
        _pv = null;
        _pr = ref;
    }

    public boolean isValue() { return _pv != null; }
    public boolean isGraph() { return _pg != null; }
    public boolean isRef() { return _pr != null; }

    public ParseValue getValue() {
        if (!isValue()) { throw new IllegalStateException("This ParseItem does not contain a ParseValue."); }
        return _pv;
    }

    public ParseGraph getGraph() {
        if (!isGraph()) { throw new IllegalStateException("This ParseItem does not contain a ParseGraph."); }
        return _pg;
    }

    public ParseRef getRef() {
        if (!isRef()) { throw new IllegalStateException("This ParseItem does not contain a Reference."); }<commit_msg>METAL-25: Added a forgotten check.<commit_after>/*
 * Copyright 2013-2016 Netherlands Forensic Institute
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package nl.minvenj.nfi.metal.data;

import static nl.minvenj.nfi.metal.Util.checkNotNull;

public final class ParseItem {

    private final ParseValue _pv;
    private final ParseGraph _pg;
    private final ParseRef _pr;

    public ParseItem(final ParseValue pv) {
        _pv = checkNotNull(pv, "pv");
        _pg = null;
        _pr = null;
    }

    public ParseItem(final ParseGraph pg) {
        _pg = checkNotNull(pg, "pg");
        _pv = null;
        _pr = null;
    }

    public ParseItem(final ParseRef pr) {
        _pg = null;
        _pv = null;
        _pr = checkNotNull(pr, "pr");
    }

    public boolean isValue() { return _pv != null; }
    public boolean isGraph() { return _pg != null; }
    public boolean isRef() { return _pr != null; }

    public ParseValue getValue() {
        if (!isValue()) { throw new IllegalStateException("This ParseItem does not contain a ParseValue."); }
        return _pv;
    }

    public ParseGraph getGraph() {
        if (!isGraph()) { throw new IllegalStateException("This ParseItem does not contain a ParseGraph."); }
        return _pg;
    }

    public ParseRef getRef() {
        if (!isRef()) { throw new IllegalStateException("This ParseItem does not contain a Reference."); }
{'fraction_non_alphanumeric': 0.0933298180859478, 'fraction_numerical': 0.006854732401792776, 'mean_word_length': 2.8714285714285714, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '2764343', 'n_tokens_mistral': 1072, 'n_tokens_neox': 1034, 'n_words': 407}