01: /*
02: * Sun Public License Notice
03: *
04: * The contents of this file are subject to the Sun Public License
05: * Version 1.0 (the "License"). You may not use this file except in
06: * compliance with the License. A copy of the License is available at
07: * http://www.sun.com/
08: *
09: * The Original Code is NetBeans. The Initial Developer of the Original
10: * Code is Sun Microsystems, Inc. Portions Copyright 1997-2000 Sun
11: * Microsystems, Inc. All Rights Reserved.
12: */
13:
14: package org.netbeans.editor;
15:
16: /**
17: * Base implementation of the token-id.
18: *
19: * @author Miloslav Metelka
20: * @version 1.00
21: */
22:
23: public class BaseTokenID implements TokenID {
24:
25: private final String name;
26:
27: private final int numericID;
28:
29: private final TokenCategory category;
30:
31: public BaseTokenID(String name) {
32: this (name, 0);
33: }
34:
35: public BaseTokenID(String name, int numericID) {
36: this (name, numericID, null);
37: }
38:
39: public BaseTokenID(String name, TokenCategory category) {
40: this (name, 0, category);
41: }
42:
43: public BaseTokenID(String name, int numericID,
44: TokenCategory category) {
45: this .name = name;
46: this .numericID = numericID;
47: this .category = category;
48: }
49:
50: public String getName() {
51: return name;
52: }
53:
54: public int getNumericID() {
55: return numericID;
56: }
57:
58: public TokenCategory getCategory() {
59: return category;
60: }
61:
62: public String toString() {
63: return getName()
64: + ((getCategory() != null) ? (", category=" + getCategory())
65: : ""); // NOI18N
66: }
67:
68: }
|