<commit_before>package fini.main.model;

import java.util.Arrays;

public class Command {
	public static enum CommandType {
		ADD, UPDATE, DELETE, CLEAR, UNDO, REDO, DISPLAY, SEARCH, MODE, EXIT, COMPLETE, UNCOMPLETE, MODS, INVALID
	};
	
	private CommandType commandType;
	private String userCommand;
	private int objectIndex = -1;

	private String commandParameters = null;
	
	public Command(String userInput) {
		String[] splitUserInput = userInput.trim().split("\\s+");
		userCommand = splitUserInput[0].toLowerCase();
		commandType = determineCommandType(userCommand);
		
		if (commandType == CommandType.UPDATE ||
			commandType == CommandType.DELETE ||
			commandType == CommandType.COMPLETE ||
			commandType == CommandType.UNCOMPLETE) {
			try {
				objectIndex = Integer.parseInt(splitUserInput[1]);
			} catch (IndexOutOfBoundsException | NumberFormatException e) {
				commandType = CommandType.INVALID;
			}
			commandParameters = String.join(" ", Arrays.copyOfRange(splitUserInput, 2, splitUserInput.length));
		} else {
			commandParameters = String.join(" ", Arrays.copyOfRange(splitUserInput, 1, splitUserInput.length));
		}
	}
	
	public CommandType getCommandType() {
		return commandType;
	}
	
	public int getObjectIndex() {
		return objectIndex;
	}
	
	public String getCommandParameters() {
		return commandParameters;
	}
	
	private CommandType determineCommandType(String userCommand) {
		switch (userCommand) {
		case "add":
			return CommandType.ADD;
		case "update":
			return CommandType.UPDATE;
		case "delete":
			return CommandType.DELETE;
		case "clear":
			return CommandType.CLEAR;
		case "undo":
			return CommandType.UNDO;
		case "redo":
			return CommandType.REDO;
		case "display":
			return CommandType.DISPLAY;
		case "mode":
			return CommandType.MODE;
		case "exit":
			return CommandType.EXIT;
		case "complete":
			return CommandType.COMPLETE;
		case "uncomplete":
			return CommandType.UNCOMPLETE;
		case "mods":
			return CommandType.MODS;
		default:
			return CommandType.INVALID;
		}
	}
}<commit_msg>update search function. add command type<commit_after>package fini.main.model;

import java.util.Arrays;

public class Command {
	public static enum CommandType {
		ADD, UPDATE, DELETE, CLEAR, UNDO, REDO, DISPLAY, SEARCH, MODE, EXIT, COMPLETE, UNCOMPLETE, MODS, INVALID
	};
	
	private CommandType commandType;
	private String userCommand;
	private int objectIndex = -1;

	private String commandParameters = null;
	
	public Command(String userInput) {
		String[] splitUserInput = userInput.trim().split("\\s+");
		userCommand = splitUserInput[0].toLowerCase();
		commandType = determineCommandType(userCommand);
		
		if (commandType == CommandType.UPDATE ||
			commandType == CommandType.DELETE ||
			commandType == CommandType.COMPLETE ||
			commandType == CommandType.UNCOMPLETE) {
			try {
				objectIndex = Integer.parseInt(splitUserInput[1]);
			} catch (IndexOutOfBoundsException | NumberFormatException e) {
				commandType = CommandType.INVALID;
			}
			commandParameters = String.join(" ", Arrays.copyOfRange(splitUserInput, 2, splitUserInput.length));
		} else {
			commandParameters = String.join(" ", Arrays.copyOfRange(splitUserInput, 1, splitUserInput.length));
		}
	}
	
	public CommandType getCommandType() {
		return commandType;
	}
	
	public int getObjectIndex() {
		return objectIndex;
	}
	
	public String getCommandParameters() {
		return commandParameters;
	}
	
	private CommandType determineCommandType(String userCommand) {
		switch (userCommand) {
		case "add":
			return CommandType.ADD;
		case "update":
			return CommandType.UPDATE;
		case "delete":
			return CommandType.DELETE;
		case "clear":
			return CommandType.CLEAR;
		case "undo":
			return CommandType.UNDO;
		case "redo":
			return CommandType.REDO;
		case "display":
			return CommandType.DISPLAY;
		case "search":
		    return CommandType.SEARCH;
		case "mode":
			return CommandType.MODE;
		case "exit":
			return CommandType.EXIT;
		case "complete":
			return CommandType.COMPLETE;
		case "uncomplete":
			return CommandType.UNCOMPLETE;
		case "mods":
			return CommandType.MODS;
		default:
			return CommandType.INVALID;
		}
	}
}
{'fraction_non_alphanumeric': 0.10665385539274562, 'fraction_numerical': 0.0024021138601969735, 'mean_word_length': 4.311224489795919, 'pattern_counts': {'":': 25, '<': 3, '<?xml version=': 0, '>': 3, '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': '224888', 'n_tokens_mistral': 1439, 'n_tokens_neox': 1266, 'n_words': 309}