01: /*
02: * xtc - The eXTensible Compiler
03: * Copyright (C) 2007 Robert Grimm
04: *
05: * This program is free software; you can redistribute it and/or
06: * modify it under the terms of the GNU General Public License
07: * version 2 as published by the Free Software Foundation.
08: *
09: * This program 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 this program; if not, write to the Free Software
16: * Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
17: * USA.
18: */
19: package xtc.type;
20:
21: /**
22: * A language tag
23: *
24: * @author Robert Grimm
25: * @version $Revision: 1.2 $
26: */
27: public class Language {
28:
29: /** The canonical language tag for C. */
30: public static final Language C = new Language("C");
31:
32: /** The canonical language tag for Java. */
33: public static final Language JAVA = new Language("Java");
34:
35: /** The language's name. */
36: private String name;
37:
38: /**
39: * Create a new language tag.
40: *
41: * @param name The language's name.
42: */
43: public Language(String name) {
44: this .name = name;
45: }
46:
47: public int hashCode() {
48: return name.hashCode();
49: }
50:
51: public boolean equals(Object o) {
52: if (!(o instanceof Language))
53: return false;
54: return name.equals(((Language) o).name);
55: }
56:
57: public String toString() {
58: return name;
59: }
60:
61: }
|