import eclipse 3.1 M4 compiler
[org.ibex.tool.git] / src / org / eclipse / jdt / internal / compiler / ast / NormalAnnotation.java
1 /*******************************************************************************
2  * Copyright (c) 2000, 2004 IBM Corporation and others.
3  * All rights reserved. This program and the accompanying materials 
4  * are made available under the terms of the Common Public License v1.0
5  * which accompanies this distribution, and is available at
6  * http://www.eclipse.org/legal/cpl-v10.html
7  * 
8  * Contributors:
9  *     IBM Corporation - initial API and implementation
10  *******************************************************************************/
11 package org.eclipse.jdt.internal.compiler.ast;
12
13 import org.eclipse.jdt.internal.compiler.ASTVisitor;
14 import org.eclipse.jdt.internal.compiler.lookup.*;
15
16 /**
17  * Normal annotation node
18  */
19 public class NormalAnnotation extends Annotation {
20         
21         public MemberValuePair[] memberValuePairs;
22         
23         public NormalAnnotation(TypeReference type, int sourceStart) {
24                 this.type = type;
25                 this.sourceStart = sourceStart;
26                 this.sourceEnd = type.sourceEnd;
27         }
28
29         /**
30          * @see org.eclipse.jdt.internal.compiler.ast.Annotation#memberValuePairs()
31          */
32         public MemberValuePair[] memberValuePairs() {
33                 return this.memberValuePairs == null ? NoValuePairs : this.memberValuePairs;
34         }
35         public StringBuffer printExpression(int indent, StringBuffer output) {
36                 super.printExpression(indent, output);
37                 output.append('(');
38                 if (this.memberValuePairs != null) {
39                         for (int i = 0, max = this.memberValuePairs.length; i < max; i++) {
40                                 if (i > 0) {
41                                         output.append(',');
42                                 }
43                                 this.memberValuePairs[i].print(indent, output);
44                         }
45                 }
46                 output.append(')');
47                 return output;
48         }
49         
50         public void traverse(ASTVisitor visitor, BlockScope scope) {
51                 if (visitor.visit(this, scope)) {
52                         if (this.memberValuePairs != null) {
53                                 int memberValuePairsLength = this.memberValuePairs.length;
54                                 for (int i = 0; i < memberValuePairsLength; i++)
55                                         this.memberValuePairs[i].traverse(visitor, scope);
56                         }
57                 }
58                 visitor.endVisit(this, scope);
59         }
60         public void traverse(ASTVisitor visitor, CompilationUnitScope scope) {
61                 if (visitor.visit(this, scope)) {
62                         if (this.memberValuePairs != null) {
63                                 int memberValuePairsLength = this.memberValuePairs.length;
64                                 for (int i = 0; i < memberValuePairsLength; i++)
65                                         this.memberValuePairs[i].traverse(visitor, scope);
66                         }
67                 }
68                 visitor.endVisit(this, scope);
69         }
70 }