<commit_before>package com.github.javachat.streems.guava;

import com.github.javachat.streems.Traversal;
import com.google.common.collect.TreeTraverser;

import java.util.function.Function;

public final class GuavaTraversal<E>
{
    private final TreeTraverser<E> traverser;

    public GuavaTraversal(final TreeTraverser<E> traverser)
    {
        this.traverser = traverser;
    }

    public Function<E, Iterable<E>> forTraversal(final Traversal traversal)
    {
        switch (traversal) {
            case BREADTHFIRST:
                return this::breadthfirst;
            case POSTORDER:
                return this::postorder;
            case PREORDER:
                return this::preorder;
        }
        throw new IllegalStateException("How did I even get there??");
    }

    public Iterable<E> preorder(final E root)
    {
        return traverser.preOrderTraversal(root);
    }

    public Iterable<E> postorder(final E root)
    {
        return traverser.postOrderTraversal(root);
    }

    public Iterable<E> breadthfirst(final E root)
    {
        return traverser.breadthFirstTraversal(root);
    }
}<commit_msg>GuavaTraversal: make traversal methods private<commit_after>package com.github.javachat.streems.guava;

import com.github.javachat.streems.Traversal;
import com.google.common.collect.TreeTraverser;

import java.util.function.Function;

public final class GuavaTraversal<E>
{
    private final TreeTraverser<E> traverser;

    public GuavaTraversal(final TreeTraverser<E> traverser)
    {
        this.traverser = traverser;
    }

    public Function<E, Iterable<E>> forTraversal(final Traversal traversal)
    {
        switch (traversal) {
            case BREADTHFIRST:
                return this::breadthfirst;
            case POSTORDER:
                return this::postorder;
            case PREORDER:
                return this::preorder;
        }
        throw new IllegalStateException("How did I even get there??");
    }

    private Iterable<E> preorder(final E root)
    {
        return traverser.preOrderTraversal(root);
    }

    private Iterable<E> postorder(final E root)
    {
        return traverser.postOrderTraversal(root);
    }

    private Iterable<E> breadthfirst(final E root)
    {
        return traverser.breadthFirstTraversal(root);
    }
}
{'fraction_non_alphanumeric': 0.08663793103448277, 'fraction_numerical': 0.0, 'mean_word_length': 2.643642072213501, 'pattern_counts': {'":': 0, '<': 19, '<?xml version=': 0, '>': 19, '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': '139159', 'n_tokens_mistral': 735, 'n_tokens_neox': 680, 'n_words': 146}