You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

TagImpl.java 4.5KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181
  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. import com.sun.javadoc.Doc;
  24. import com.sun.javadoc.Tag;
  25. import java.util.Locale;
  26. public class TagImpl implements Tag {
  27. private Locale locale;
  28. private ErrPrinter err;
  29. private String name;
  30. private String text;
  31. private Doc doc;
  32. /**
  33. * Constructs the new tag with given parameters.
  34. *
  35. * @param doc the new value for <code>doc</code>.
  36. * @param name the new value for <code>name</code>.
  37. * @param text the new value for <code>text</code>.
  38. * @param locale the new value for <code>locale</code>.
  39. * @param err the new value for <code>err</code>.
  40. */
  41. public TagImpl(Doc doc,
  42. String name,
  43. String text,
  44. Locale locale,
  45. ErrPrinter err) {
  46. this.doc = doc;
  47. this.name = name;
  48. this.text = text;
  49. this.locale = locale;
  50. this.err = err;
  51. }
  52. /**
  53. * Returns the Doc associated with this tag.
  54. *
  55. * @return the Doc associated with this tag.
  56. */
  57. protected final Doc doc() {
  58. return doc;
  59. }
  60. /**
  61. * Returns the ErrPrinter associated with this tag.
  62. *
  63. * @return the ErrPrinter associated with this tag.
  64. */
  65. protected final ErrPrinter err() {
  66. return err == null ? ErrPrinter.instance : err;
  67. }
  68. /**
  69. * Delegates to {@link Util#start(char)}.
  70. *
  71. * @see Util#start(char)
  72. */
  73. protected final static boolean start(char c) { return Util.start(c); }
  74. /**
  75. * Delegates to {@link Util#ident(char)}.
  76. *
  77. * @see Util#ident(char)
  78. */
  79. protected final static boolean ident(char c) { return Util.ident(c); }
  80. /**
  81. * Delegates to {@link Util#space(char)}.
  82. *
  83. * @see Util#space(char)
  84. */
  85. protected final static boolean space(char c) { return Util.space(c); }
  86. /**
  87. * Delegates to {@link Util#split(char)}.
  88. *
  89. * @see Util#split(char)
  90. */
  91. protected final static String[] split(String s) { return Util.split(s); }
  92. /**
  93. * Returns the name.
  94. *
  95. * @return the name.
  96. */
  97. public String name() {
  98. return name;
  99. }
  100. /**
  101. * Returns the kind followed by the String text.
  102. *
  103. * @return kind followed by the String text.
  104. */
  105. public String toString() {
  106. return kind() + " " + text;
  107. }
  108. /**
  109. * Returns the kind of tag.
  110. *
  111. * @return kind of the tag.
  112. */
  113. public String kind() {
  114. return name;
  115. }
  116. /**
  117. * Returns the String text of this tag.
  118. *
  119. * @return String text of this tag.
  120. */
  121. public String text() {
  122. return text;
  123. }
  124. /**
  125. * Sets the String text.
  126. *
  127. * @param text the new value for <code>text</code>.
  128. */
  129. protected void setText(String text) {
  130. this.text = text;
  131. }
  132. /**
  133. * Returns the locale.
  134. *
  135. * @return the locale.
  136. */
  137. public Locale locale() {
  138. return locale;
  139. }
  140. /**
  141. * Returns the inline tags in this tag.
  142. *
  143. * @return an array of Tag representing the inline
  144. * tags in this tag.
  145. * @see Util#inlineTags
  146. */
  147. public Tag[] inlineTags() {
  148. return Util.inlineTags(doc(), text(), locale(), err()); //doc());
  149. }
  150. /**
  151. * Returns the first sentence tags in this tag.
  152. *
  153. * @return an array of Tag representing the first sentence
  154. * tags in this tag.
  155. * @see Util#firstSentenceTags
  156. */
  157. public Tag[] firstSentenceTags() {
  158. return Util.firstSentenceTags(doc(), text(), locale(), err());
  159. }
  160. }