KickJava   Java API By Example, From Geeks To Geeks.

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


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 com.sun.javadoc.Doc;
25 import com.sun.javadoc.Tag;
26
27 import java.util.Locale JavaDoc;
28
29 public class TagImpl implements Tag {
30
31     private Locale JavaDoc locale;
32     private ErrPrinter err;
33     private String JavaDoc name;
34     private String JavaDoc text;
35     private Doc doc;
36
37     /**
38      * Constructs the new tag with given parameters.
39      *
40      * @param doc the new value for <code>doc</code>.
41      * @param name the new value for <code>name</code>.
42      * @param text the new value for <code>text</code>.
43      * @param locale the new value for <code>locale</code>.
44      * @param err the new value for <code>err</code>.
45      */

46     public TagImpl(Doc doc,
47                    String JavaDoc name,
48                    String JavaDoc text,
49                    Locale JavaDoc locale,
50                    ErrPrinter err) {
51         this.doc = doc;
52         this.name = name;
53         this.text = text;
54         this.locale = locale;
55         this.err = err;
56     }
57
58     /**
59      * Returns the Doc associated with this tag.
60      *
61      * @return the Doc associated with this tag.
62      */

63     protected final Doc doc() {
64         return doc;
65     }
66
67     /**
68      * Returns the ErrPrinter associated with this tag.
69      *
70      * @return the ErrPrinter associated with this tag.
71      */

72     protected final ErrPrinter err() {
73         return err == null ? ErrPrinter.instance : err;
74     }
75
76     /**
77      * Delegates to {@link Util#start(char)}.
78      *
79      * @see Util#start(char)
80      */

81     protected final static boolean start(char c) { return Util.start(c); }
82
83     /**
84      * Delegates to {@link Util#ident(char)}.
85      *
86      * @see Util#ident(char)
87      */

88     protected final static boolean ident(char c) { return Util.ident(c); }
89
90     /**
91      * Delegates to {@link Util#space(char)}.
92      *
93      * @see Util#space(char)
94      */

95     protected final static boolean space(char c) { return Util.space(c); }
96
97     /**
98      * Delegates to {@link Util#split(char)}.
99      *
100      * @see Util#split(char)
101      */

102     protected final static String JavaDoc[] split(String JavaDoc s) { return Util.split(s); }
103
104     /**
105      * Returns the name.
106      *
107      * @return the name.
108      */

109     public String JavaDoc name() {
110         return name;
111     }
112
113     /**
114      * Returns the kind followed by the String text.
115      *
116      * @return kind followed by the String text.
117      */

118     public String JavaDoc toString() {
119         return kind() + " " + text;
120     }
121
122     /**
123      * Returns the kind of tag.
124      *
125      * @return kind of the tag.
126      */

127     public String JavaDoc kind() {
128         return name;
129     }
130
131     /**
132      * Returns the String text of this tag.
133      *
134      * @return String text of this tag.
135      */

136     public String JavaDoc text() {
137         return text;
138     }
139
140     /**
141      * Sets the String text.
142      *
143      * @param text the new value for <code>text</code>.
144      */

145     protected void setText(String JavaDoc text) {
146         this.text = text;
147     }
148
149     /**
150      * Returns the locale.
151      *
152      * @return the locale.
153      */

154     public Locale JavaDoc locale() {
155         return locale;
156     }
157
158     /**
159      * Returns the inline tags in this tag.
160      *
161      * @return an array of Tag representing the inline
162      * tags in this tag.
163      * @see Util#inlineTags
164      */

165     public Tag[] inlineTags() {
166         return Util.inlineTags(doc(), text(), locale(), err()); //doc());
167
}
168
169     /**
170      * Returns the first sentence tags in this tag.
171      *
172      * @return an array of Tag representing the first sentence
173      * tags in this tag.
174      * @see Util#firstSentenceTags
175      */

176     public Tag[] firstSentenceTags() {
177         return Util.firstSentenceTags(doc(), text(), locale(), err());
178     }
179
180
181 }
182
Popular Tags