KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > aspectj > tools > ajdoc > DocImpl


1 /* -*- Mode: JDE; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
2  *
3  * This file is part of the debugger and core tools for the AspectJ(tm)
4  * programming language; see http://aspectj.org
5  *
6  * The contents of this file are subject to the Mozilla Public License
7  * Version 1.1 (the "License"); you may not use this file except in
8  * compliance with the License. You may obtain a copy of the License at
9  * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/.
10  *
11  * Software distributed under the License is distributed on an "AS IS" basis,
12  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
13  * for the specific language governing rights and limitations under the
14  * License.
15  *
16  * The Original Code is AspectJ.
17  *
18  * The Initial Developer of the Original Code is Xerox Corporation. Portions
19  * created by Xerox Corporation are Copyright (C) 1999-2002 Xerox Corporation.
20  * All Rights Reserved.
21  */

22 package org.aspectj.tools.ajdoc;
23
24 import org.aspectj.ajdoc.Doc;
25
26 import com.sun.javadoc.SeeTag;
27 import com.sun.javadoc.Tag;
28
29 import java.util.Locale JavaDoc;
30
31 public abstract class DocImpl
32     implements org.aspectj.ajdoc.Doc {
33
34     /** Keep track of whether this is included or not. */
35     private boolean isIncluded = true;
36
37     /** The comment for this Doc. */
38     private Comment comment;
39
40     /** The error printer for this Doc. */
41     private ErrPrinter err;
42     
43     /** Keep track of whether this is included or not. */
44     private boolean isInterface = true;
45
46     /** The locale of the object -- default to <code>Locale.US</code>. */
47     private Locale JavaDoc locale = Locale.US; //TODO
48

49     /**
50      * Returns the locale.
51      *
52      * @return the locale.
53      */

54     public Locale JavaDoc locale() { //XXX
55
return locale;
56     }
57
58     
59     public void setErr(ErrPrinter err) { this.err = err; }
60     public ErrPrinter err() { return ErrPrinter.instance; }
61
62     public void setComment(Comment comment) { this.comment = comment; }
63     public Comment getComment() { return comment; }
64
65     /**
66      * Delegates to {@link Util#compareTo(Object)} to compare
67      * with another Object.
68      *
69      * @return a negative integer, zero, or a positive integer
70      * as this object is less than, equal to, or greater
71      * than the specified object based on name.
72      * @see java.lang.Comparable.compareTo(Object)
73      */

74     public int compareTo(Object JavaDoc other) {
75         return other instanceof Doc
76             ? Util.compareTo(this, (Doc)other)
77             : -1;
78     }
79
80     /**
81      * Returns the Tags that comprise the first
82      * sentence of the comment.
83      *
84      * @return an array of Tag representing the first
85      * sentence of the comment.
86      */

87     public Tag[] firstSentenceTags() {
88         return getComment() != null
89             ? getComment().firstSentenceTags()
90             : new Tag[0];
91     }
92
93     /**
94      * Returns the full unprocessed text of the comment.
95      *
96      * @return the full unprocessed text of the comment.
97      */

98     public String JavaDoc getRawCommentText() {
99         return getComment() != null
100             ? getComment().rawCommentText()
101             : "";
102     }
103
104     /**
105      * Sets the full unprocessed text of the comment.
106      *
107      * @param rawCommentText the new full unprocessed text of the comment..
108      */

109     public void setRawCommentText(String JavaDoc rawCommentText) {
110         if (getComment() != null) {
111             getComment().setRawCommentText(rawCommentText);
112         }
113     }
114
115     /**
116      * Returns the comment as an array of Tag.
117      *
118      * @return an array of Tag representing the comment.
119      */

120     public Tag[] inlineTags() {
121         return getComment() != null
122             ? getComment().inlineTags()
123             : new Tag[0];
124     }
125     
126     /**
127      * Returns the see tags of the comment.
128      *
129      * @return an array of SeeTag representing the
130      * see tags of the comment.
131      */

132     public SeeTag[] seeTags() {
133         return getComment() != null
134             ? getComment().seeTags()
135             : new SeeTag[0];
136     }
137
138     /**
139      * Returns all tags of the comment.
140      *
141      * @return an array of Tag representing all
142      * tags of the comment.
143      */

144     public Tag[] tags() {
145         return getComment() != null
146             ? getComment().tags()
147             : new Tag[0];
148     }
149
150     /**
151      * Returns all tags of the comment whose name equals
152      * <code>tagname</code>.
153      *
154      * @return an array of Tag representing all tags of the
155      * comment whose name equals <code>tagname</code>.
156      */

157     public Tag[] tags(String JavaDoc tagname) {
158         return getComment() != null
159             ? getComment().tags(tagname)
160             : new Tag[0];
161     }
162
163     /**
164      * Returns the commext text for non-null comments,
165      * otherwise the empty String.
166      *
167      * @return non-null comment text.
168      */

169     public String JavaDoc commentText() {
170         return getComment() != null
171             ? getComment().commentText()
172             : "";
173     }
174
175     /**
176      * Sets <code>isIncluded</code>.
177      *
178      * @param isIncluded the new value of <code>isIncluded</code>.
179      */

180     public void setIncluded(boolean isIncluded) {
181         this.isIncluded = isIncluded;
182     }
183     
184     /**
185      * Returns <code>false</code> by default.
186      *
187      * @return <code>false</code> by default.
188      */

189     public boolean isClass() {
190         return false;
191     }
192     
193     /**
194      * Returns <code>false</code> by default.
195      *
196      * @return <code>false</code> by default.
197      */

198     public boolean isConstructor() {
199         return false;
200     }
201
202     /**
203      * Returns <code>false</code> by default.
204      *
205      * @return <code>false</code> by default.
206      */

207     public boolean isError() {
208         return false;
209     }
210     
211     /**
212      * Returns <code>false</code> by default.
213      *
214      * @return <code>false</code> by default.
215      */

216     public boolean isException() {
217         return false;
218     }
219     /**
220      * Returns <code>false</code> by default.
221      *
222      * @return <codealse</code> by default./
223      */

224     public boolean isField() {
225         return false;
226     }
227     /**
228      * Returns <code>isIncluded</code> by default.
229      *
230      * @return <codesIncluded</code> by default./
231      */

232     public boolean isIncluded() {
233         return isIncluded;
234     }
235     
236     /**
237      * Returns <code>false</code> by default.
238      *
239      * @return <codealse</code> by default./
240      */

241     public boolean isInterface() {
242         return false;
243     }
244     
245     /**
246      * Returns <code>false</code> by default.
247      *
248      * @return <codealse</code> by default./
249      */

250     public boolean isMethod() {
251         return false;
252     }
253     
254     /**
255      * Returns <code>false</code> by default.
256      *
257      * @return <codealse</code> by default./
258      */

259     public boolean isOrdinaryClass() {
260         return false;
261     }
262     
263     /**
264      * Returns <code>false</code> by default.
265      *
266      * @return <codealse</code> by default./
267      */

268     public boolean isPointcut() {
269         return false;
270     }
271     
272     /**
273      * Returns <code>false</code> by default.
274      *
275      * @return <codealse</code> by default./
276      */

277     public boolean isAdvice() {
278         return false;
279     }
280 }
281
Popular Tags