KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > jdt > internal > core > util > KeyKind


1 /*******************************************************************************
2  * Copyright (c) 2005 IBM Corporation and others.
3  * All rights reserved. This program and the accompanying materials
4  * are made available under the terms of the Eclipse Public License v1.0
5  * which accompanies this distribution, and is available at
6  * http://www.eclipse.org/legal/epl-v10.html
7  *
8  * Contributors:
9  * IBM Corporation - initial API and implementation
10  *******************************************************************************/

11 package org.eclipse.jdt.internal.core.util;
12
13 public class KeyKind extends BindingKeyParser {
14
15     public static final int F_TYPE = 0x00001;
16     public static final int F_METHOD = 0x00010;
17     public static final int F_FIELD = 0x00011;
18     public static final int F_TYPE_PARAMETER = 0x00100;
19     public static final int F_LOCAL_VAR = 0x00101;
20     public static final int F_MEMBER = 0x00110;
21     public static final int F_LOCAL = 0x00111;
22     public static final int F_PARAMETERIZED_TYPE = 0x01000;
23     public static final int F_RAW_TYPE = 0x01001;
24     public static final int F_WILDCARD_TYPE = 0x01010;
25     public static final int F_PARAMETERIZED_METHOD = 0x01011;
26     public static final int F_CAPTURE = 0x01111;
27     public static final int F_CONSTRUCTOR = 0x10000;
28     
29     public int flags = 0;
30     private KeyKind innerKeyKind;
31     
32     public KeyKind(BindingKeyParser parser) {
33         super(parser);
34     }
35     
36     public KeyKind(String JavaDoc key) {
37         super(key);
38     }
39     
40     public void consumeBaseType(char[] baseTypeSig) {
41         this.flags |= F_TYPE;
42     }
43
44     public void consumeCapture(int position) {
45         this.flags |= F_CAPTURE;
46     }
47     
48     public void consumeField(char[] fieldName) {
49         this.flags |= F_FIELD;
50     }
51
52     public void consumeLocalType(char[] uniqueKey) {
53         this.flags |= F_LOCAL;
54     }
55
56     public void consumeLocalVar(char[] varName) {
57         this.flags |= F_LOCAL_VAR;
58     }
59
60     public void consumeMemberType(char[] simpleTypeName) {
61         this.flags |= F_MEMBER;
62     }
63
64     public void consumeMethod(char[] selector, char[] signature) {
65         this.flags |= F_METHOD;
66         if (selector.length == 0)
67             this.flags |= F_CONSTRUCTOR;
68     }
69
70     public void consumeParameterizedGenericMethod() {
71         this.flags |= F_PARAMETERIZED_METHOD;
72     }
73
74     public void consumeParameterizedType(char[] simpleTypeName, boolean isRaw) {
75         this.flags |= isRaw ? F_RAW_TYPE : F_PARAMETERIZED_TYPE;
76     }
77     
78     public void consumeParser(BindingKeyParser parser) {
79         this.innerKeyKind = (KeyKind) parser;
80     }
81
82     public void consumeRawType() {
83         this.flags |= F_RAW_TYPE;
84     }
85
86     public void consumeTopLevelType() {
87         this.flags |= F_TYPE;
88     }
89
90     public void consumeTypeParameter(char[] typeParameterName) {
91         this.flags |= F_TYPE_PARAMETER;
92     }
93     
94     public void consumeTypeWithCapture() {
95         this.flags = this.innerKeyKind.flags;
96     }
97
98     public void consumeWildCard(int kind) {
99         this.flags |= F_WILDCARD_TYPE;
100     }
101
102     public BindingKeyParser newParser() {
103         return new KeyKind(this);
104     }
105 }
106
Popular Tags