<commit_before>/*
 * See LICENSE file in distribution for copyright and licensing information.
 */
package org.yaml.snakeyaml.nodes;

import org.yaml.snakeyaml.error.Mark;

/**
 * @see PyYAML 3.06 for more information
 */
public abstract class Node {
    private String tag;
    private Object value;
    private int hash = -1;
    private Mark startMark;
    private Mark endMark;

    public Node(final String tag, final Object value, final Mark startMark, final Mark endMark) {
        this.tag = tag;
        this.value = value;
        this.startMark = startMark;
        this.endMark = endMark;
    }

    public String getTag() {
        return this.tag;
    }

    public Object getValue() {
        return this.value;
    }

    public int hashCode() {
        if (hash == -1) {
            hash = 3;
            hash += (null == tag) ? 0 : 3 * tag.hashCode();
            hash += (null == value) ? 0 : 3 * value.hashCode();
        }
        return hash;
    }

    public boolean equals(final Object oth) {
        if (oth instanceof Node) {
            final Node nod = (Node) oth;
            return ((this.tag != null) ? this.tag.equals(nod.tag) : nod.tag == null)
                    && ((this.value != null) ? this.value.equals(nod.value) : nod.value == null);
        }
        return false;
    }

    public String toString() {
        return "<" + this.getClass().getName() + " (tag=" + getTag() + ", value=" + getValue()
                + ")>";
    }

    /**
     * For error reporting.
     * 
     * @see class variable 'id' in PyYAML
     * @return scalar, sequence, mapping
     */
    public abstract String getNodeId();

    public Mark getStartMark() {
        return startMark;
    }

    public Mark getEndMark() {
        return endMark;
    }
}
<commit_msg>add redundant check for Null in Node<commit_after>/*
 * See LICENSE file in distribution for copyright and licensing information.
 */
package org.yaml.snakeyaml.nodes;

import org.yaml.snakeyaml.error.Mark;

/**
 * @see PyYAML 3.06 for more information
 */
public abstract class Node {
    private String tag;
    private Object value;
    private int hash = -1;
    private Mark startMark;
    private Mark endMark;

    public Node(final String tag, final Object value, final Mark startMark, final Mark endMark) {
        this.tag = tag;
        if (tag == null) {
            throw new NullPointerException("tag in a Node is required.");
        }
        this.value = value;
        if (value == null) {
            throw new NullPointerException("value in a Node is required.");
        }
        this.startMark = startMark;
        this.endMark = endMark;
    }

    public String getTag() {
        return this.tag;
    }

    public Object getValue() {
        return this.value;
    }

    public int hashCode() {
        if (hash == -1) {
            hash = 3;
            hash += (null == tag) ? 0 : 3 * tag.hashCode();
            hash += (null == value) ? 0 : 3 * value.hashCode();
        }
        return hash;
    }

    public boolean equals(final Object oth) {
        if (oth instanceof Node) {
            final Node nod = (Node) oth;
            return ((this.tag != null) ? this.tag.equals(nod.tag) : nod.tag == null)
                    && ((this.value != null) ? this.value.equals(nod.value) : nod.value == null);
        }
        return false;
    }

    public String toString() {
        return "<" + this.getClass().getName() + " (tag=" + getTag() + ", value=" + getValue()
                + ")>";
    }

    /**
     * For error reporting.
     * 
     * @see class variable 'id' in PyYAML
     * @return scalar, sequence, mapping
     */
    public abstract String getNodeId();

    public Mark getStartMark() {
        return startMark;
    }

    public Mark getEndMark() {
        return endMark;
    }
}

{'fraction_non_alphanumeric': 0.12170279446330634, 'fraction_numerical': 0.005223295899712719, 'mean_word_length': 1.8993186979560939, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, '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': '6533766', 'n_tokens_mistral': 1135, 'n_tokens_neox': 1094, 'n_words': 342}