]> gerrit.simantics Code Review - simantics/platform.git/blob - bundles/org.simantics.scenegraph/src/org/simantics/scenegraph/g2d/events/command/Command.java
Fixed all line endings of the repository
[simantics/platform.git] / bundles / org.simantics.scenegraph / src / org / simantics / scenegraph / g2d / events / command / Command.java
1 /*******************************************************************************
2  * Copyright (c) 2007, 2010 Association for Decentralized Information Management
3  * in Industry THTH ry.
4  * All rights reserved. This program and the accompanying materials
5  * are made available under the terms of the Eclipse Public License v1.0
6  * which accompanies this distribution, and is available at
7  * http://www.eclipse.org/legal/epl-v10.html
8  *
9  * Contributors:
10  *     VTT Technical Research Centre of Finland - initial API and implementation
11  *******************************************************************************/
12 package org.simantics.scenegraph.g2d.events.command;
13
14 import java.io.Serializable;
15
16 /**
17  * 
18  * @See {@link Commands} Default commands
19  * @See {@link CommandKeyBinding} Default command bindings
20  * 
21  * @author Toni Kalajainen
22  */
23 public class Command implements Serializable {
24
25     private static final long serialVersionUID = 9117246464320469783L;
26
27     public final String id;
28
29     public Command(String id) {
30         if (id == null)
31             throw new NullPointerException("null id");
32         this.id = id;
33     }
34
35     @Override
36     public int hashCode() {
37         return id.hashCode();
38     }
39
40     @Override
41     public boolean equals(Object obj) {
42         if (this == obj)
43             return true;
44         if (!(obj instanceof Command))
45             return false;
46         Command other = (Command) obj;
47         return id.equals(other.id);
48     }
49
50     @Override
51     public String toString() {
52         return id;
53     }
54
55 }