<commit_before>/*
 * Copyright 2013 <NAME>.
 *
 * 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 com.ilyagubarev.algorithms.adt.collections;

import java.util.Iterator;

import com.ilyagubarev.algorithms.adt.Item;
import com.ilyagubarev.algorithms.adt.ItemNode;
import com.ilyagubarev.algorithms.adt.ItemNodeFactory;
import com.ilyagubarev.algorithms.adt.tools.Counter;

/**
 * Simple ItemStack implementation based on item nodes.
 *
 * @see ItemStack
 *
 * @version 1.03, 13 September 2013
 * @since 02 September 2013
 * @author <NAME>
 */
public final class SimpleItemNodeStack implements ItemStack {

    private final Counter _reads;
    private final Counter _linkReads;
    private final Counter _linkWrites;
    private final ItemNodeFactory _factory;

    private int _size;
    private ItemNode _top;

    /**
     * Creates a new instance of SimpleItemNodeStack.
     *
     * @param factory an item nodes provider.
     * @param reads a counter of item read operations.
     * @param linkReads a counter of item node link read operations.
     * @param linkWrites a counter of item node link write operations.
     *
     * @see Counter
     * @see ItemNodeFactory
     */
    public SimpleItemNodeStack(ItemNodeFactory factory, Counter reads,
            Counter linkReads, Counter linkWrites) {
        if (factory == null) {
            throw new NullPointerException("item nodes provider is null");
        }
        if (reads == null) {
            throw new NullPointerException("item reads counter is null");
        }
        if (linkReads == null) {
            throw new NullPointerException("node link reads counter is null");
        }
        if (linkWrites == null) {
            throw new NullPointerException("node link writes counter is null");
        }
        _factory = factory;
        _reads = reads;
        _linkReads = linkReads;
        _linkWrites = linkWrites;
    }<commit_msg>SimpleItemNodeStack<commit_after>/*
 * Copyright 2013 <NAME>.
 *
 * 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 com.ilyagubarev.algorithms.adt.collections;

import java.util.Iterator;

import com.ilyagubarev.algorithms.adt.Item;
import com.ilyagubarev.algorithms.adt.ItemNode;
import com.ilyagubarev.algorithms.adt.ItemNodeFactory;

/**
 * Simple ItemStack implementation based on item nodes.
 *
 * @see ItemStack
 *
 * @version 1.03, 14 September 2013
 * @since 02 September 2013
 * @author <NAME>
 */
public final class SimpleItemNodeStack implements ItemStack {

    private final ItemNodeFactory _factory;

    private int _size;
    private ItemNode _top;

    /**
     * Creates a new instance of SimpleItemNodeStack.
     *
     * @param factory an item nodes provider.
     *
     * @see ItemNodeFactory
     */
    public SimpleItemNodeStack(ItemNodeFactory factory) {
        if (factory == null) {
            throw new NullPointerException("item nodes provider is null");
        }
        _factory = factory;
    }
{'fraction_non_alphanumeric': 0.0788152610441767, 'fraction_numerical': 0.011546184738955823, 'mean_word_length': 3.070480081716037, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, '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': '2282434', 'n_tokens_mistral': 1112, 'n_tokens_neox': 1065, 'n_words': 402}