<commit_before>package jp.gr.java_conf.neko_daisuki.fsyscall.slave;

import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.util.LinkedList;
import java.util.List;

import jp.gr.java_conf.neko_daisuki.fsyscall.io.InputSyscallStream;
import jp.gr.java_conf.neko_daisuki.fsyscall.io.OutputSyscallStream;

public class SlaveHub extends Worker {

    private static class Peer {

        public InputSyscallStream in;
        public OutputSyscallStream out;

        public Peer(InputSyscallStream in, OutputSyscallStream out) {
            this.in = in;
            this.out = out;
        }
    }

    private Application mApplication;
    private Peer mMhub;
    private List<Peer> mSlaves;

    public SlaveHub(Application application, InputStream mhubIn, OutputStream mhubOut, InputStream slaveIn, OutputStream slaveOut) {
        mApplication = application;
        mMhub = new Peer(
                new InputSyscallStream(mhubIn),
                new OutputSyscallStream(mhubOut));
        mSlaves = new LinkedList<Peer>();
        mSlaves.add(
                new Peer(
                    new InputSyscallStream(slaveIn),
                    new OutputSyscallStream(slaveOut)));
    }

    public boolean isReady() throws IOException {
        if (mMhub.in.isReady()) {
            return true;
        }
        for (Peer peer: mSlaves) {
            if (peer.in.isReady()) {
                return true;
            }
        }
        return false;
    }

    public void work() {
        // TODO
    }
}

/**
 * vim: tabstop=4 shiftwidth=4 expandtab softtabstop=4
 */
<commit_msg>Changed SlaveHub.java to use getter/setter for streams.<commit_after>package jp.gr.java_conf.neko_daisuki.fsyscall.slave;

import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.util.LinkedList;
import java.util.List;

import jp.gr.java_conf.neko_daisuki.fsyscall.io.InputSyscallStream;
import jp.gr.java_conf.neko_daisuki.fsyscall.io.OutputSyscallStream;

public class SlaveHub extends Worker {

    private static class Peer {

        private InputSyscallStream mIn;
        private OutputSyscallStream mOut;

        public Peer(InputSyscallStream in, OutputSyscallStream out) {
            mIn = in;
            mOut = out;
        }

        public InputSyscallStream getInputStream() {
            return mIn;
        }

        public OutputSyscallStream getOutputStream() {
            return mOut;
        }
    }

    private Application mApplication;
    private Peer mMhub;
    private List<Peer> mSlaves;

    public SlaveHub(Application application, InputStream mhubIn, OutputStream mhubOut, InputStream slaveIn, OutputStream slaveOut) {
        mApplication = application;
        mMhub = new Peer(
                new InputSyscallStream(mhubIn),
                new OutputSyscallStream(mhubOut));
        mSlaves = new LinkedList<Peer>();
        mSlaves.add(
                new Peer(
                    new InputSyscallStream(slaveIn),
                    new OutputSyscallStream(slaveOut)));
    }

    public boolean isReady() throws IOException {
        if (mMhub.getInputStream().isReady()) {
            return true;
        }
        for (Peer slave: mSlaves) {
            if (slave.getInputStream().isReady()) {
                return true;
            }
        }
        return false;
    }

    public void work() throws IOException {
        if (mMhub.getInputStream().isReady()) {
            // TODO
        }
        for (Peer peer: mSlaves) {
            if (peer.getInputStream().isReady()) {
                // TODO
            }
        }
    }
}

/**
 * vim: tabstop=4 shiftwidth=4 expandtab softtabstop=4
 */

{'fraction_non_alphanumeric': 0.08646616541353383, 'fraction_numerical': 0.001611170784103115, 'mean_word_length': 2.130252100840336, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, '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': '1088419', 'n_tokens_mistral': 1127, 'n_tokens_neox': 1024, 'n_words': 241}