<commit_before>package edu.govschool.govchat.socket;

// For input/output streams
import java.io.*;
// For built-in sockets
import java.net.*;
// For Platform.runLater()
import javafx.application.Platform;

/**
 * Generic socket to extend for use in GovChat.
 * Based on Oracle documentation.
 * Abstract classes must have their abstract methods implemented in a subclass,
 * which will happen in <code>GCClientSocket</code> and 
 * <code>GCServerSocket</code>. We define this 'generic' socket, however, 
 * because both the client and server sockets share a lot of the same code.
 * @author <NAME>
 */
public abstract class GCGenericSocket implements GCSocketListener
{
    // For testing purposes, we'll use a default port of 2000.
    // It is defined here in the superclass because both the
    // client and server need to agree on the port.
    public static final int DEFAULT_PORT = 2000;
    
    // The port we'll be using
    public int port;
    // The Socket connection we'll be using
    // `protected` means that we and our subclasses can access this property, 
    // no classes outside us.
    protected Socket socketConncetion = null;
    // Streams to perform I/O
    private BufferedWriter output = null;
    private BufferedReader input = null;
    // Flag to see if our setup has completed
    private boolean ready = false;
    // Thread to setup our connection
    private Thread setupThread;
    // Thread to read message from our connection
    private Thread readerThread;
}<commit_msg>Add stubs for private setup and reader thread classes in GCGenericSocket, as well as an implementation for connect() showing usage.<commit_after>package edu.govschool.govchat.socket;

// For input/output streams
import java.io.*;
// For built-in sockets
import java.net.*;
// For Platform.runLater()
import javafx.application.Platform;

/**
 * Generic socket to extend for use in GovChat.
 * Based on Oracle documentation.
 * Abstract classes must have their abstract methods implemented in a subclass,
 * which will happen in <code>GCClientSocket</code> and 
 * <code>GCServerSocket</code>. We define this 'generic' socket, however, 
 * because both the client and server sockets share a lot of the same code.
 * @author <NAME>
 */
public abstract class GCGenericSocket implements GCSocketListener
{
    // For testing purposes, we'll use a default port of 2000.
    // It is defined here in the superclass because both the
    // client and server need to agree on the port.
    public static final int DEFAULT_PORT = 2000;
    
    // The port we'll be using
    public int port;
    // The Socket connection we'll be using
    // `protected` means that we and our subclasses can access this property, 
    // no classes outside us.
    protected Socket socketConncetion = null;
    // Streams to perform I/O
    private BufferedWriter output = null;
    private BufferedReader input = null;
    // Flag to see if our setup has completed
    private boolean ready = false;
    // Thread to setup our connection
    private Thread setupThread;
    // Thread to read message from our connection
    private Thread readerThread;
    
    /**
     * Empty constructor.
     * Creates a new <code>GCGenericSocket</code> on port 2000.
     */
    public GCGenericSocket()
    {
        this(DEFAULT_PORT);
    }
    
    /**
     * Default constructor.
     * Creates a new <code>GCGenericSocket</code> on the given port.
     * @param port the port to bind to
     */
    public GCGenericSocket(int port)
    {
        this.port = port;
    }
    
    /**
     * Setup a connection in the background.
     * Later, <code>onCloseUpdate(boolean)</code> will be called if this method
     * successfully completes.
     */
    public void connect()
    {
        try {
            // Open the socket connection in the background and setup our I/O 
            // streams
            setupThread = new SocketSetupThread();
            setupThread.start();
            // Start the thread that will listen for message on the input stream
            // in the background
            readerThread = new SocketReaderThread();
            readerThread.start();
        } catch (Exception e) {} // You dun goofed!
    }
    
    /**
     * Setup our initial connection in the background.
     * Normally, our entire application would have to wait until the connection
     * occurred before continuing. However, since we will be doing it in a 
     * <code>Thread</code>, it will happen in the background.
     */
    private class SocketSetupThread extends Thread
    {
        @Override
        public void run()
        {
            
        }
    }
    
    /**
     * Listen for messages in the background.
     * Again, our application would seem to freeze while waiting for messages.
     * We need to try to read from the input stream in the background.
     */
    private class SocketReaderThread extends Thread
    {
        @Override
        public void run()
        {
            
        }
    }
}
{'fraction_non_alphanumeric': 0.07419226166733148, 'fraction_numerical': 0.003988831272437176, 'mean_word_length': 2.49721059972106, 'pattern_counts': {'":': 0, '<': 21, '<?xml version=': 0, '>': 21, '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': '138102', 'n_tokens_mistral': 1301, 'n_tokens_neox': 1254, 'n_words': 567}