<commit_before>package jjtraveler;

import java.util.LinkedList;

public class BreadthFirst {

    public BreadthFirst(Visitor v) {
	pending = new LinkedList();
	this.v = v;
    }

    LinkedList pending;
    Visitor v;

    public Visitable visit(Visitable x)
      throws VisitFailure {
	Visitable result = v.visit(x);
	int childCount = result.getChildCount();

        for (int i = 0; i < childCount; i++) {
            pending.addLast(x.getChildAt(i));<commit_msg>  * Added second constructor method.<commit_after>package jjtraveler;

/**
 * <code>BF(v) = Seq(v,All(EnQ),Try(Seq(DeQ,BF(v)))</code>
 * <p>
 * Visit a tree in breadth-first order.
 */

import java.util.LinkedList;
import java.util.Collection;

public class BreadthFirst {

    public BreadthFirst(Visitor v) {
	pending = new LinkedList();
	this.v = v;
    }

    public BreadthFirst(Visitor v, Collection c) {
	pending = new LinkedList(c);
	this.v = v;
    }

    LinkedList pending;
    Visitor v;

    public Visitable visit(Visitable x)
      throws VisitFailure {
	Visitable result = v.visit(x);
	int childCount = result.getChildCount();

        for (int i = 0; i < childCount; i++) {
            pending.addLast(x.getChildAt(i));
{'fraction_non_alphanumeric': 0.12375415282392027, 'fraction_numerical': 0.0016611295681063123, 'mean_word_length': 3.1986062717770034, 'pattern_counts': {'":': 0, '<': 8, '<?xml version=': 0, '>': 6, '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': '6119396', 'n_tokens_mistral': 418, 'n_tokens_neox': 395, 'n_words': 102}