All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.github.mathiewz.slick.command.BasicCommand Maven / Gradle / Ivy

Go to download

The main purpose of this libraryis to modernize and maintain the slick2D library.

The newest version!
package com.github.mathiewz.slick.command;

/**
 * A simple named command
 *
 * @author kevin
 */
public class BasicCommand implements Command {
    /** The name of the command */
    private final String name;

    /**
     * Create a new basic command
     *
     * @param name
     *            The name to give this command
     */
    public BasicCommand(String name) {
        this.name = name;
    }

    /**
     * Get the name given for this basic command
     *
     * @return The name given for this basic command
     */
    public String getName() {
        return name;
    }

    /**
     * @see java.lang.Object#hashCode()
     */
    @Override
    public int hashCode() {
        return name.hashCode();
    }

    /**
     * @see java.lang.Object#equals(java.lang.Object)
     */
    @Override
    public boolean equals(Object other) {
        if (other instanceof BasicCommand) {
            return ((BasicCommand) other).name.equals(name);
        }

        return false;
    }

    /**
     * @see java.lang.Object#toString()
     */
    @Override
    public String toString() {
        return "[Command=" + name + "]";
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy