~ubuntu-branches/ubuntu/wily/aspectj/wily-proposed

« back to all changes in this revision

Viewing changes to org.aspectj/modules/org.aspectj.ajdt.core/src/org/aspectj/org/eclipse/jdt/core/dom/TypeCategoryTypePattern.java

  • Committer: Bazaar Package Importer
  • Author(s): Damien Raude-Morvan
  • Date: 2011-03-15 23:54:31 UTC
  • mfrom: (1.2.5 upstream)
  • mto: This revision was merged to the branch mainline in revision 9.
  • Revision ID: james.westby@ubuntu.com-20110315235431-iq2gxbsx08kpwuiw
* New upstream release.
* Updated Standards-Version to 3.9.1 (no changes needed).
* Fix local Javadoc links:
  - d/patches/07_javadoc_links.diff: Use locally installed
   javadoc packages and hyperlink with them.
  - d/control: Add B-D on default-java-doc and libasm3-java-doc.
* d/control: Drop B-D on itself (our new bootstrap infrastructure doesn't need
  that anymore).
* Split packages into :
  - aspectj: only contains CLI tools.
  - libaspectj-java: JAR librairies for /usr/share/java.
  - libaspectj-java-doc: 4 API's Javadoc.
  - aspectj-doc: Programming Guides and SDK Documentation.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/********************************************************************
 
2
 * Copyright (c) 2010 Contributors. All rights reserved. 
 
3
 * This program and the accompanying materials are made available 
 
4
 * under the terms of the Eclipse Public License v1.0 
 
5
 * which accompanies this distribution and is available at 
 
6
 * http://eclipse.org/legal/epl-v10.html 
 
7
 *  
 
8
 * Contributors: Nieraj Singh - initial implementation
 
9
 *******************************************************************/
 
10
package org.aspectj.org.eclipse.jdt.core.dom;
 
11
 
 
12
import java.util.List;
 
13
 
 
14
public class TypeCategoryTypePattern extends TypePattern {
 
15
 
 
16
        private int typeCategory;
 
17
 
 
18
        public static final int CLASS = org.aspectj.weaver.patterns.TypeCategoryTypePattern.CLASS;
 
19
        public static final int INTERFACE = org.aspectj.weaver.patterns.TypeCategoryTypePattern.INTERFACE;
 
20
        public static final int ASPECT = org.aspectj.weaver.patterns.TypeCategoryTypePattern.ASPECT;
 
21
        public static final int INNER = org.aspectj.weaver.patterns.TypeCategoryTypePattern.INNER;
 
22
        public static final int ANONYMOUS = org.aspectj.weaver.patterns.TypeCategoryTypePattern.ANONYMOUS;
 
23
        public static final int ENUM = org.aspectj.weaver.patterns.TypeCategoryTypePattern.ENUM;
 
24
        public static final int ANNOTATION = org.aspectj.weaver.patterns.TypeCategoryTypePattern.ANNOTATION;
 
25
 
 
26
        /**
 
27
         * 
 
28
         * See the weaver implementation for the type categories.
 
29
         * 
 
30
         * @see org.aspectj.weaver.patterns.TypeCategoryTypePattern
 
31
         * @param ast
 
32
         *            must not be null
 
33
         * @param typeCategory
 
34
         *            as defined in the corresponding weaver node type
 
35
         */
 
36
        TypeCategoryTypePattern(AST ast, int typeCategory) {
 
37
                super(ast, null);
 
38
                this.typeCategory = typeCategory;
 
39
        }
 
40
 
 
41
        /**
 
42
         * 
 
43
         * See the weaver implementation for the type categories.
 
44
         * 
 
45
         * @see org.aspectj.weaver.patterns.TypeCategoryTypePattern
 
46
         * @return type category
 
47
         */
 
48
        public int getTypeCategory() {
 
49
                return typeCategory;
 
50
        }
 
51
 
 
52
        List<?> internalStructuralPropertiesForType(int apiLevel) {
 
53
                return null;
 
54
        }
 
55
 
 
56
        public String getTypePatternExpression() {
 
57
 
 
58
                String expression = super.getTypePatternExpression();
 
59
                if (expression == null) {
 
60
                        switch (getTypeCategory()) {
 
61
                        case CLASS:
 
62
                                expression = "ClassType";
 
63
                                break;
 
64
                        case INNER:
 
65
                                expression = "InnerType";
 
66
                                break;
 
67
                        case INTERFACE:
 
68
                                expression = "InterfaceType";
 
69
                                break;
 
70
                        case ANNOTATION:
 
71
                                expression = "AnnotationType";
 
72
                                break;
 
73
                        case ANONYMOUS:
 
74
                                expression = "AnonymousType";
 
75
                                break;
 
76
                        case ASPECT:
 
77
                                expression = "AspectType";
 
78
                                break;
 
79
                        case ENUM:
 
80
                                expression = "EnumType";
 
81
                                break;
 
82
                        }
 
83
                        expression = (expression != null) ? "is(" + expression + ")"
 
84
                                        : EMPTY_EXPRESSION;
 
85
                        setTypePatternExpression(expression);
 
86
 
 
87
                }
 
88
                return expression;
 
89
        }
 
90
 
 
91
        ASTNode clone0(AST target) {
 
92
                ASTNode cloned = new TypeCategoryTypePattern(target, getTypeCategory());
 
93
                cloned.setSourceRange(getStartPosition(), getLength());
 
94
                return cloned;
 
95
        }
 
96
 
 
97
        void accept0(ASTVisitor visitor) {
 
98
                if (visitor instanceof AjASTVisitor) {
 
99
                        AjASTVisitor ajVisitor = (AjASTVisitor) visitor;
 
100
                        ajVisitor.visit(this);
 
101
                        ajVisitor.endVisit(this);
 
102
                }
 
103
        }
 
104
 
 
105
        boolean subtreeMatch0(ASTMatcher matcher, Object other) {
 
106
                if (matcher instanceof AjASTMatcher) {
 
107
                        AjASTMatcher ajmatcher = (AjASTMatcher) matcher;
 
108
                        return ajmatcher.match(this, other);
 
109
                }
 
110
                return false;
 
111
        }
 
112
 
 
113
}