<commit_before>/*
 * Copyright 2013 MovingBlocks
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package org.terasology.input;

import com.google.common.collect.Lists;

import java.util.List;

/**
 * @author Immortius
 */
public enum MouseInput {
    MOUSE_NONE(InputType.MOUSE_BUTTON, -1, ""),
    MOUSE_LEFT(InputType.MOUSE_BUTTON, 0, "M_Left", "M_1"),
    MOUSE_RIGHT(InputType.MOUSE_BUTTON, 1, "M_Right", "M_2"),
    MOUSE_3(InputType.MOUSE_BUTTON, 2, "M_3"),
    MOUSE_4(InputType.MOUSE_BUTTON, 3, "M_4"),
    MOUSE_5(InputType.MOUSE_BUTTON, 4, "M_5"),
    MOUSE_WHEEL_UP(InputType.MOUSE_WHEEL, 1, "MWheel_Up"),
    MOUSE_WHEEL_DOWN(InputType.MOUSE_WHEEL, -1, "MWheel_Down");

    private InputType type;
    private int id;
    private String shortString;
    private List<String> alternateStrings;

    private MouseInput(InputType type, int id, String shortString, String ... alternateStrings) {
        this.type = type;
        this.id = id;
        this.shortString = shortString;
        this.alternateStrings = Lists.newArrayList(alternateStrings);
    }

    public InputType getType() {
        return type;
    }

    public int getId() {
        return id;
    }

    public Input getInput() {
        return new Input(type, id);
    }

    public String toShortString() {
        return shortString;
    }

    public static MouseInput parse(String id) {
        for (MouseInput input : values()) {
            if (input.shortString.equals(id) || input.alternateStrings.contains(id)) {
                return input;
            }
        }
        return MOUSE_NONE;
    }

    public static MouseInput getInputFor(InputType type, int id) {
        for (MouseInput input : values()) {
            if (input.type == type && input.id == id) {
                return input;
            }
        }
        return MOUSE_NONE;
    }
}<commit_msg>Fix for MouseInput case sensitivity when parsing.<commit_after>/*
 * Copyright 2013 MovingBlocks
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package org.terasology.input;

import com.google.common.collect.Lists;

import java.util.List;
import java.util.Locale;

/**
 * @author Immortius
 */
public enum MouseInput {
    MOUSE_NONE(InputType.MOUSE_BUTTON, -1, ""),
    MOUSE_LEFT(InputType.MOUSE_BUTTON, 0, "M_Left", "M_1"),
    MOUSE_RIGHT(InputType.MOUSE_BUTTON, 1, "M_Right", "M_2"),
    MOUSE_3(InputType.MOUSE_BUTTON, 2, "M_3"),
    MOUSE_4(InputType.MOUSE_BUTTON, 3, "M_4"),
    MOUSE_5(InputType.MOUSE_BUTTON, 4, "M_5"),
    MOUSE_WHEEL_UP(InputType.MOUSE_WHEEL, 1, "MWheel_Up"),
    MOUSE_WHEEL_DOWN(InputType.MOUSE_WHEEL, -1, "MWheel_Down");

    private InputType type;
    private int id;
    private String shortString;
    private List<String> alternateStrings;

    private MouseInput(InputType type, int id, String shortString, String ... alternateStrings) {
        this.type = type;
        this.id = id;
        this.shortString = shortString.toLowerCase(Locale.ENGLISH);
        this.alternateStrings = Lists.newArrayListWithCapacity(alternateStrings.length);
        for (String alternate : alternateStrings) {
            this.alternateStrings.add(alternate.toLowerCase(Locale.ENGLISH));
        }
    }

    public InputType getType() {
        return type;
    }

    public int getId() {
        return id;
    }

    public Input getInput() {
        return new Input(type, id);
    }

    public String toShortString() {
        return shortString;
    }

    public static MouseInput parse(String id) {
        for (MouseInput input : values()) {
            if (input.shortString.equals(id.toLowerCase(Locale.ENGLISH)) || input.alternateStrings.contains(id.toLowerCase(Locale.ENGLISH))) {
                return input;
            }
        }
        return MOUSE_NONE;
    }

    public static MouseInput getInputFor(InputType type, int id) {
        for (MouseInput input : values()) {
            if (input.type == type && input.id == id) {
                return input;
            }
        }
        return MOUSE_NONE;
    }
}
{'fraction_non_alphanumeric': 0.10229521171349426, 'fraction_numerical': 0.009497427779976256, 'mean_word_length': 2.809344385832705, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, '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': '4640123', 'n_tokens_mistral': 1550, 'n_tokens_neox': 1557, 'n_words': 423}