<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;

public final class ParseItem {

    private final ParseValue _pv;
    private final ParseGraph _pg;

    public ParseItem(final ParseValue pv) {
        _pv = pv;
        _pg = null;
    }
    
    public ParseItem(final ParseGraph pg) {
        _pg = pg;
        _pv = null;
    }
    
    public boolean isValue() { return _pv != null; }
    public boolean isGraph() { return _pg != 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;
    }

    @Override
    public String toString() {
        return isValue() ? "ParseValue(" + _pv.toString() + ")" : "ParseGraph(" + _pg.toString() + ")";
    }

}
<commit_msg>METAL-5: Fix.<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;

public final class ParseItem {

    private final ParseValue _pv;
    private final ParseGraph _pg;

    public ParseItem(final ParseValue pv) {
        if (pv == null) { throw new IllegalArgumentException("Argument pv may not be null."); }
        _pv = pv;
        _pg = null;
    }

    public ParseItem(final ParseGraph pg) {
        if (pg == null) { throw new IllegalArgumentException("Argument pg may not be null."); }
        _pg = pg;
        _pv = null;
    }

    public boolean isValue() { return _pv != null; }
    public boolean isGraph() { return _pg != 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;
    }

    @Override
    public String toString() {
        return isValue() ? "ParseValue(" + _pv.toString() + ")" : "ParseGraph(" + _pg.toString() + ")";
    }

}

{'fraction_non_alphanumeric': 0.0990424895272292, 'fraction_numerical': 0.007480550568521843, 'mean_word_length': 2.9053738317757007, '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': '6267805', 'n_tokens_mistral': 932, 'n_tokens_neox': 902, 'n_words': 359}