<commit_before>package com.apixandru.games.rummikub.client;

import com.apixandru.games.rummikub.brotocol.SocketWrapper;
import com.apixandru.games.rummikub.brotocol.util.SocketPacketProcessor;
import com.apixandru.rummikub.StateChangeListener;
import com.apixandru.rummikub.client.ClientPacketHandler;
import com.apixandru.rummikub.client.waiting.ClientWaitingRoomConfigurer;
import com.apixandru.rummikub.game.GameConfigurerAdapter;
import com.apixandru.rummikub.waiting.WaitingRoomConfigurer;
import com.apixandru.rummikub.waiting.WaitingRoomListener;

import static com.apixandru.games.rummikub.brotocol.Brotocols.USE_NEW_IMPLEMENTATION;

/**
 * @author <NAME>
 * @since April 02, 2016
 */
public final class RummikubConnector {

    final SocketWrapper socketWrapper;
    final StateChangeListener stateChangeListener;
    private final ClientPacketHandler packetHandler = new ClientPacketHandler();
    private final SocketPacketProcessor socketPacketProcessor;

    public RummikubConnector(final SocketWrapper socketWrapper, final StateChangeListener stateChangeListener) {
        this.socketWrapper = socketWrapper;
        this.stateChangeListener = stateChangeListener;

        this.socketPacketProcessor = new SocketPacketProcessor(this.socketWrapper, this.packetHandler);
    }

    public void connect() {
        if (USE_NEW_IMPLEMENTATION) {
            newConnect();
        } else {
            oldConnect();
        }
    }

    private void newConnect() {
//        packetHandler.setStartGameListener(() -> stateChangeListener.enteredGame(new ClientGameConfigurer(packetHandler, this.socketWrapper)));
        packetHandler.setStartGameListener(() -> stateChangeListener.enteredGame(new GameConfigurerAdapter()));
        ClientWaitingRoomConfigurer waitingRoomConfigurer = new ClientWaitingRoomConfigurer(packetHandler, socketWrapper);
        stateChangeListener.enteredWaitingRoom(waitingRoomConfigurer);
        new Thread(socketPacketProcessor).start();
    }

    private void oldConnect() {
        stateChangeListener.enteredWaitingRoom(new WaitingRoomConfigurer() {
            @Override
            public void registerListener(final WaitingRoomListener listener) {
            }

            @Override
            public void startGame() {
                stateChangeListener.enteredGame(new GameConfigurerAdapter());
            }
        });
    }

}<commit_msg>wire up to the correct listener in the new implementation<commit_after>package com.apixandru.games.rummikub.client;

import com.apixandru.games.rummikub.brotocol.SocketWrapper;
import com.apixandru.games.rummikub.brotocol.util.SocketPacketProcessor;
import com.apixandru.rummikub.StateChangeListener;
import com.apixandru.rummikub.client.ClientPacketHandler;
import com.apixandru.rummikub.client.game.ClientGameConfigurer;
import com.apixandru.rummikub.client.waiting.ClientWaitingRoomConfigurer;
import com.apixandru.rummikub.game.GameConfigurerAdapter;
import com.apixandru.rummikub.waiting.WaitingRoomConfigurer;
import com.apixandru.rummikub.waiting.WaitingRoomListener;

import static com.apixandru.games.rummikub.brotocol.Brotocols.USE_NEW_IMPLEMENTATION;

/**
 * @author <NAME>
 * @since April 02, 2016
 */
public final class RummikubConnector {

    final SocketWrapper socketWrapper;
    final StateChangeListener stateChangeListener;
    private final ClientPacketHandler packetHandler = new ClientPacketHandler();
    private final SocketPacketProcessor socketPacketProcessor;

    public RummikubConnector(final SocketWrapper socketWrapper, final StateChangeListener stateChangeListener) {
        this.socketWrapper = socketWrapper;
        this.stateChangeListener = stateChangeListener;

        this.socketPacketProcessor = new SocketPacketProcessor(this.socketWrapper, this.packetHandler);
    }

    public void connect() {
        if (USE_NEW_IMPLEMENTATION) {
            newConnect();
        } else {
            oldConnect();
        }
    }

    private void newConnect() {
        packetHandler.setStartGameListener(() -> stateChangeListener.enteredGame(new ClientGameConfigurer(packetHandler, this.socketWrapper)));
        ClientWaitingRoomConfigurer waitingRoomConfigurer = new ClientWaitingRoomConfigurer(packetHandler, socketWrapper);
        stateChangeListener.enteredWaitingRoom(waitingRoomConfigurer);
        new Thread(socketPacketProcessor).start();
    }

    private void oldConnect() {
        stateChangeListener.enteredWaitingRoom(new WaitingRoomConfigurer() {
            @Override
            public void registerListener(final WaitingRoomListener listener) {
            }

            @Override
            public void startGame() {
                stateChangeListener.enteredGame(new GameConfigurerAdapter());
            }
        });
    }

}
{'fraction_non_alphanumeric': 0.0779030910609858, 'fraction_numerical': 0.002506265664160401, 'mean_word_length': 4.0094142259414225, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 8, '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': '5401297', 'n_tokens_mistral': 1329, 'n_tokens_neox': 1296, 'n_words': 218}