<commit_before>package com.airhacks.enhydrator.in;

/*
 * #%L
 * enhydrator
 * %%
 * Copyright (C) 2014 <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.
 * #L%
 */
import com.airhacks.enhydrator.out.Sink;
import java.util.ArrayList;
import java.util.List;

/**
 *
 * @author <EMAIL>
 */
public class VirtualSinkSource extends Sink implements Source {

    private List<List<Entry>> rows;

    public VirtualSinkSource() {
        this(new ArrayList<>());
    }

    public VirtualSinkSource(List<List<Entry>> entries) {
        this.rows = entries;
    }

    public VirtualSinkSource addRow(List<Entry> entries) {
        this.rows.add(entries);
        return this;
    }

    public int getNumberOfRows() {
        return rows.size();
    }

    public List<Entry> getRow(int index) {
        if (index >= this.rows.size()) {
            return new ArrayList<>();
        }
        return this.rows.get(index);
    }

    /**
     * @see Source
     * @param query not applicable
     * @param params not applicable
     * @return the cached content
     */
    @Override
    public Iterable<List<Entry>> query(String query, Object... params) {
        return this.rows;
    }

    /**
     * @see Sink
     * @param entries process row
     */
    @Override
    public void processRow(List<Entry> entries) {
        this.addRow(entries);
    }

    public static class Rows {

        private List<Entry> currentRow;
        private List<List<Entry>> rows;

        public Rows() {
            this.rows = new ArrayList<>();
            this.currentRow = new ArrayList<>();
            this.rows.add(currentRow);
        }

        public Rows addColumn(Entry entry) {
            this.currentRow.add(entry);
            return this;
        }

        public Rows addColumn(String name, String value) {
            int index = this.currentRow.size() - 1;
            if (index == -1) {
                //in case row is empty
                index = 0;
            }
            return addColumn(new Entry(index, name, value));
        }

        public Rows addRow() {
            this.rows.add(this.currentRow);
            this.currentRow = new ArrayList<>();
            return this;
        }

        public VirtualSinkSource build() {
            return new VirtualSinkSource(this.rows);
        }

    }
}
<commit_msg>Name added to the source<commit_after>package com.airhacks.enhydrator.in;

/*
 * #%L
 * enhydrator
 * %%
 * Copyright (C) 2014 <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.
 * #L%
 */
import com.airhacks.enhydrator.out.Sink;
import java.util.ArrayList;
import java.util.List;

/**
 *
 * @author airhack<EMAIL>
 */
public class VirtualSinkSource extends Sink implements Source {

    private List<List<Entry>> rows;

    public VirtualSinkSource() {
        this("*", new ArrayList<>());
    }

    public VirtualSinkSource(String name, List<List<Entry>> entries) {
        super(name);
        this.rows = entries;
    }

    public VirtualSinkSource addRow(List<Entry> entries) {
        this.rows.add(entries);
        return this;
    }

    public int getNumberOfRows() {
        return rows.size();
    }

    public List<Entry> getRow(int index) {
        if (index >= this.rows.size()) {
            return new ArrayList<>();
        }
        return this.rows.get(index);
    }

    /**
     * @see Source
     * @param query not applicable
     * @param params not applicable
     * @return the cached content
     */
    @Override
    public Iterable<List<Entry>> query(String query, Object... params) {
        return this.rows;
    }

    /**
     * @see Sink
     * @param entries process row
     */
    @Override
    public void processRow(List<Entry> entries) {
        this.addRow(entries);
    }

    public static class Rows {

        private List<Entry> currentRow;
        private List<List<Entry>> rows;
        private String name;

        public Rows() {
            this.rows = new ArrayList<>();
            this.currentRow = new ArrayList<>();
            this.rows.add(currentRow);
            this.name = "*";
        }

        public Rows addColumn(Entry entry) {
            this.currentRow.add(entry);
            return this;
        }

        public Rows addColumn(String name, String value) {
            int index = this.currentRow.size() - 1;
            if (index == -1) {
                //in case row is empty
                index = 0;
            }
            return addColumn(new Entry(index, name, value));
        }

        public Rows addRow() {
            this.rows.add(this.currentRow);
            this.currentRow = new ArrayList<>();
            return this;
        }

        public Rows sinkName(String name) {
            this.name = name;
            return this;
        }

        public VirtualSinkSource build() {
            return new VirtualSinkSource(this.name, this.rows);
        }

    }
}

{'fraction_non_alphanumeric': 0.10761199056921522, 'fraction_numerical': 0.00370495116200741, 'mean_word_length': 2.059763008758372, 'pattern_counts': {'":': 0, '<': 41, '<?xml version=': 0, '>': 43, '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': '3874741', 'n_tokens_mistral': 1672, 'n_tokens_neox': 1622, 'n_words': 499}