Crossfire JXClient, Trunk  R20561
CommandExec.java
Go to the documentation of this file.
1 /*
2  * This file is part of JXClient, the Fullscreen Java Crossfire Client.
3  *
4  * JXClient is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation; either version 2 of the License, or
7  * (at your option) any later version.
8  *
9  * JXClient is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with JXClient; if not, write to the Free Software
16  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
17  *
18  * Copyright (C) 2005-2008 Yann Chachkoff.
19  * Copyright (C) 2006-2011 Andreas Kirschbaum.
20  */
21 
22 package com.realtime.crossfire.jxclient.commands;
23 
24 import org.jetbrains.annotations.NotNull;
25 import org.jetbrains.annotations.Nullable;
26 
31 public class CommandExec {
32 
36  @Nullable
37  private final Command command;
38 
42  @NotNull
43  private final String args;
44 
50  public CommandExec(@Nullable final Command command, @NotNull final String args) {
51  this.command = command;
52  this.args = args;
53  }
54 
59  @Nullable
60  public Command getCommand() {
61  return command;
62  }
63 
68  @NotNull
69  public String getArgs() {
70  return args;
71  }
72 
76  @Override
77  public int hashCode() {
78  return (command == null ? 0 : command.hashCode())+args.hashCode();
79  }
80 
84  @Override
85  public boolean equals(@Nullable final Object obj) {
86  if (obj == null || obj.getClass() != getClass()) {
87  return false;
88  }
89  final CommandExec o = (CommandExec)obj;
90  return command == o.command && args.equals(o.args);
91  }
92 
96  @NotNull
97  @Override
98  public String toString() {
99  return command+"/"+args;
100  }
101 
102 }
Implements a client-side command.
Definition: Command.java:30
Command getCommand()
Returns the command to execute or.
A Command instance and its arguments.
final String args
The command arguments.
boolean equals(@Nullable final Object obj)
String getArgs()
Returns the command arguments.
CommandExec(@Nullable final Command command, @NotNull final String args)
Creates a new instance.
final Command command
The command to execute or.