<commit_before>package com.jamerlan.commands.impl.in;

import com.jamerlan.ServerState;
import com.jamerlan.commands.Command;
import com.jamerlan.utils.CommandParser;

import java.io.IOException;
import java.io.PrintWriter;

/**
 LEFT chanName userName [{reason}]
 */
public class Left implements Command {
    private String line;
    private ServerState serverState;

    public Left(String line, ServerState serverState) {
        this.line = line;
        this.serverState = serverState;
    }

    @Override
    public void execute(PrintWriter writer) throws IOException {
        CommandParser parser = new CommandParser(line);
        String commandName = parser.getString(" ");

        String chanName = parser.getString(" ");

        if (parser.hasNext(" ")){
            String userName = parser.getString(" ");
            String reason = parser.getString();
            for (com.jamerlan.model.Channel channel:serverState.getChannels()) {
                if(chanName.equals(channel.getChanName())) {
                    channel.getClients().remove(userName);
                }
            }
        }else {
            String userName = parser.getString();
            String reason = "";
            for (com.jamerlan.model.Channel channel:serverState.getChannels()) {
                if (chanName.equals(channel.getChanName())) {
                    channel.getClients().remove(userName);
                }
            }
        }
    }
}
<commit_msg>in/left refactored<commit_after>package com.jamerlan.commands.impl.in;

import com.jamerlan.ServerState;
import com.jamerlan.commands.Command;
import com.jamerlan.utils.CommandParser;

import java.io.IOException;
import java.io.PrintWriter;

/**
 LEFT chanName userName [{reason}]
 */
public class Left implements Command {
    private String line;
    private ServerState serverState;

    public Left(String line, ServerState serverState) {
        this.line = line;
        this.serverState = serverState;
    }

    @Override
    public void execute(PrintWriter writer) throws IOException {
        CommandParser parser = new CommandParser(line);
        String commandName = parser.getString(" ");

        String chanName = parser.getString(" ");

        if (parser.hasNext(" ")){
            String userName = parser.getString(" ");
            String reason = parser.getString();
            serverState.getChannels().stream().filter(channel -> channel.getChanName().equals(chanName)).findAny().ifPresent(channel -> channel.getClients().remove(userName));
        }else {
            String userName = parser.getString();
            String reason = "";

            serverState.getChannels().stream().filter(channel -> channel.getChanName().equals(chanName)).findAny().ifPresent(channel -> channel.getClients().remove(userName));
        }
    }
}

{'fraction_non_alphanumeric': 0.11646017699115044, 'fraction_numerical': 0.0, 'mean_word_length': 2.6277278562259307, 'pattern_counts': {'":': 0, '<': 3, '<?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': '975450', 'n_tokens_mistral': 753, 'n_tokens_neox': 727, 'n_words': 152}