<commit_before>/*
 * FRC 4931 (http://www.evilletech.com)
 *
 * Open source software. Licensed under the FIRST BSD license file in the
 * root directory of this project's Git repository.
 */
package org.frc4931.robot.mock;

import org.frc4931.robot.component.DataStream;

import java.nio.ByteBuffer;

/**
 * A mock implementation of {@link org.frc4931.robot.component.DataStream} that does not require hardware.
 */
public class MockDataStream implements DataStream {
    private ByteBuffer readBuffer;
    private ByteBuffer writeBuffer;
    private ByteBuffer flushBuffer;

    /**
     * Creates a new data stream.
     *
     * @param readCapacity  The capacity of the read buffer.
     * @param writeCapacity The capacity of the write buffer.
     * @param flushCapacity The capacity of the flush buffer.
     */
    public MockDataStream(int readCapacity, int writeCapacity, int flushCapacity) {
        readBuffer = ByteBuffer.allocate(readCapacity);
        writeBuffer = ByteBuffer.allocate(writeCapacity);
        flushBuffer = ByteBuffer.allocate(flushCapacity);
    }

    /**
     * Sets the limit on the read buffer.
     * Delegates {@link java.nio.Buffer#limit(int)}
     *
     * @param limit The new limit
     */
    public void setReadLimit(int limit) {
        readBuffer.limit(limit);
    }

    /**
     * Sets the limit on the write buffer.
     * Delegates {@link java.nio.Buffer#limit(int)}
     *
     * @param limit The new limit
     */
    public void setWriteLimit(int limit) {
        writeBuffer.limit(limit);
    }

    /**
     * Sets the limit on the flush buffer.
     * Delegates {@link java.nio.Buffer#limit(int)}
     *
     * @param limit The new limit
     */
    public void setFlushLimit(int limit) {
        flushBuffer.limit(limit);
    }

    /**
     * Clears the read buffer.
     * Delegates java.nio.Buffer#clear()
     */
    public void clearReadBuffer() {
        readBuffer.clear();
    }<commit_msg>Added isEmpty methods for data buffers<commit_after>/*
 * FRC 4931 (http://www.evilletech.com)
 *
 * Open source software. Licensed under the FIRST BSD license file in the
 * root directory of this project's Git repository.
 */
package org.frc4931.robot.mock;

import org.frc4931.robot.component.DataStream;

import java.nio.ByteBuffer;

/**
 * A mock implementation of {@link org.frc4931.robot.component.DataStream} that does not require hardware.
 */
public class MockDataStream implements DataStream {
    private ByteBuffer readBuffer;
    private ByteBuffer writeBuffer;
    private ByteBuffer flushBuffer;

    /**
     * Creates a new data stream.
     *
     * @param readCapacity  The capacity of the read buffer.
     * @param writeCapacity The capacity of the write buffer.
     * @param flushCapacity The capacity of the flush buffer.
     */
    public MockDataStream(int readCapacity, int writeCapacity, int flushCapacity) {
        readBuffer = ByteBuffer.allocate(readCapacity);
        writeBuffer = ByteBuffer.allocate(writeCapacity);
        flushBuffer = ByteBuffer.allocate(flushCapacity);
    }

    /**
     * Sets the limit on the read buffer.
     * Delegates {@link java.nio.Buffer#limit(int)}
     *
     * @param limit The new limit
     */
    public void setReadLimit(int limit) {
        readBuffer.limit(limit);
    }

    /**
     * Sets the limit on the write buffer.
     * Delegates {@link java.nio.Buffer#limit(int)}
     *
     * @param limit The new limit
     */
    public void setWriteLimit(int limit) {
        writeBuffer.limit(limit);
    }

    /**
     * Sets the limit on the flush buffer.
     * Delegates {@link java.nio.Buffer#limit(int)}
     *
     * @param limit The new limit
     */
    public void setFlushLimit(int limit) {
        flushBuffer.limit(limit);
    }

    /**
     * Determines whether there is remaining data in the read buffer.
     *
     * @return true if there is no remaining data in the buffer.
     */
    public boolean isReadEmpty() {
        return !readBuffer.hasRemaining();
    }

    /**
     * Determines whether there is remaining data in the write buffer.
     *
     * @return true if there is no remaining data in the buffer.
     */
    public boolean isWriteEmpty() {
        return !writeBuffer.hasRemaining();
    }

    /**
     * Determines whether there is remaining data in the flush buffer.
     *
     * @return true if there is no remaining data in the buffer.
     */
    public boolean isFlushEmpty() {
        return !flushBuffer.hasRemaining();
    }

    /**
     * Clears the read buffer.
     * Delegates java.nio.Buffer#clear()
     */
    public void clearReadBuffer() {
        readBuffer.clear();
    }
{'fraction_non_alphanumeric': 0.09464668094218416, 'fraction_numerical': 0.006852248394004282, 'mean_word_length': 2.5466970387243735, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '5031245', 'n_tokens_mistral': 1347, 'n_tokens_neox': 1297, 'n_words': 415}