本文整理匯總了Java中com.sun.javadoc.Tag.text方法的典型用法代碼示例。如果您正苦於以下問題:Java Tag.text方法的具體用法?Java Tag.text怎麽用?Java Tag.text使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類com.sun.javadoc.Tag
的用法示例。
在下文中一共展示了Tag.text方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: toComment
import com.sun.javadoc.Tag; //導入方法依賴的package包/類
/**
* Transforms comments on the Doc object into XML.
*
* @param doc The Doc object.
* @param node The node to add the comment nodes to.
*/
private static String toComment(Tag tag) {
if (tag.text() == null || tag.text().length() == 0) return null;
StringBuilder comment = new StringBuilder();
// Analyse each token and produce comment node
for (Tag t : tag.inlineTags()) {
Taglet taglet = options.getTagletForName(t.name());
if (taglet != null) {
comment.append(taglet.toString(t));
} else {
comment.append(t.text());
}
}
return comment.toString();
}
示例2: PSOperatorDoc
import com.sun.javadoc.Tag; //導入方法依賴的package包/類
private PSOperatorDoc(ClassDoc classDoc, MethodDoc methodDoc) {
this.declaringClassDoc = classDoc;
this.methodDoc = methodDoc;
this.description = methodDoc.commentText().replace('\n', ' ');
this.paramDesc = "";
Tag[] paramTags = methodDoc.tags("param");
for (Tag paramTag : paramTags) {
String paraStr = paramTag.text();
String paraName = paraStr.substring(0, paraStr.indexOf(' ')).replace('\n', ' ');;
String paraDesc = paraStr.substring(paraStr.indexOf(' ') + 1).replace('\n', ' ');;
this.paramDesc += "<br> - `" + paraName + "`: " + paraDesc;
}
this.returnType = methodDoc.returnType();
// ParameterizedType returnType = methodDoc.returnType().asParameterizedType();
// this.inputType = returnType.typeArguments()[0];
// this.outputType = returnType.typeArguments()[1];
// this.completeSignature = "Function<" + this.inputType + ", " + this.outputType + "> " + methodDoc.toString();
String shortSignature = classDoc.name() + "." + methodDoc.name() + "(";
boolean firstParameter = true;
for (Parameter parameter : methodDoc.parameters()) {
if (firstParameter) {
shortSignature += Utils.getSimpleTypeName(parameter.type()) + " " + parameter.name();
firstParameter = false;
} else {
shortSignature += ", " + Utils.getSimpleTypeName(parameter.type()) + " " + parameter.name();
}
}
shortSignature += ")";
this.shortSignature = shortSignature;
}
示例3: getFirstSentence
import com.sun.javadoc.Tag; //導入方法依賴的package包/類
private static String getFirstSentence(Tag[] tags) {
String firstSentence = null;
if (tags.length > 0) {
Tag first = tags[0];
firstSentence = first.text();
}
return firstSentence;
}
示例4: getText
import com.sun.javadoc.Tag; //導入方法依賴的package包/類
public static String getText(Tag[] tags) {
String text = "";
for (Tag tag : tags) {
text += tag.text();
}
return text;
}
示例5: writeContents
import com.sun.javadoc.Tag; //導入方法依賴的package包/類
private static void writeContents(ClassDoc[] classes, String tagName , String outputFolder)
{
Map<String,List<String>> keywordsToAlgorithmsMap = new HashMap<String,List<String>> ();
Map<String,List<String>> algorithmToKeywordsMap = new HashMap<String,List<String>> ();
Map<String,String> algorithmToFirstSentence = new HashMap<String,String> ();
for (int i = 0; i < classes.length; i++)
{
final ClassDoc javaClass = classes [i];
final String className = javaClass.qualifiedName();
final Tag [] firstSentenceTags = javaClass.firstSentenceTags();
if (firstSentenceTags.length == 0) System.out.println("A class without first sentence!!: " + className);
final String firstSentenceThisClass = (firstSentenceTags.length == 0)? "" : javaClass.firstSentenceTags() [0].text ();
algorithmToFirstSentence.put (className , firstSentenceThisClass);
algorithmToKeywordsMap.put (className , new LinkedList<String> ());
String keywordsString = ""; for (Tag tag : javaClass.tags()) { if (tag.name().equals ("@"+tagName)) keywordsString += " " + tag.text () + " "; }
keywordsString = keywordsString.trim ();
for (String keyword : StringUtils.split(keywordsString , ","))
{
final String keywordName = keyword.trim ();
if (!keywordDescriptionMap.containsKey(keywordName)) throw new RuntimeException ("Bad: Keyword: " + keywordName + " in algorithm " + className + ", does not exist in the description");
if (!keywordsToAlgorithmsMap.containsKey(keywordName)) keywordsToAlgorithmsMap.put (keywordName , new LinkedList<String> ());
keywordsToAlgorithmsMap.get(keywordName).add (className);
algorithmToKeywordsMap.get (className).add (keywordName);
}
}
String htmlFile = createHtml(keywordsToAlgorithmsMap , algorithmToKeywordsMap , algorithmToFirstSentence , outputFolder);
try
{
File f = new File (outputFolder + "/keywords-all.html");
System.out.println ("Save in : " + f.getAbsolutePath());
PrintWriter pw = new PrintWriter (f);
pw.append(htmlFile);
pw.close ();
} catch (Exception e) { e.printStackTrace(); throw new RuntimeException ("Not possible to write in keywords-all.html"); }
}
示例6: split
import com.sun.javadoc.Tag; //導入方法依賴的package包/類
private String[] split(Tag tag) {
String[] splitted = tag.text().split("\\|");
if (splitted.length != 2) {
System.err.println("Usage: {@" + getName() + " latexref|html_human_readable_ref} (" + tag.position() + ")");
return new String[] { tag.text(), tag.text() };
} else {
return splitted;
}
}
示例7: getTagText
import com.sun.javadoc.Tag; //導入方法依賴的package包/類
public static String getTagText(final Tag[] tags, final String name) {
for (final Tag tag : tags) {
if (tag.name().equals(name)) {
return tag.text();
}
}
return null;
}
示例8: computeSpecVersion
import com.sun.javadoc.Tag; //導入方法依賴的package包/類
static SpecificationVersion computeSpecVersion(CompilationInfo info, Element el) {
if (!Utilities.isJavadocSupported(info)) return null;
Doc javaDoc = info.getElementUtilities().javaDocFor(el);
if (javaDoc == null) return null;
for (Tag since : javaDoc.tags("@since")) {
String text = since.text();
Matcher m = SPEC_VERSION.matcher(text);
if (!m.find()) {
continue;
}
return new SpecificationVersion(m.group()/*ver.toString()*/);
}
return null;
}
示例9: converter
import com.sun.javadoc.Tag; //導入方法依賴的package包/類
@Override
public DocTag converter(Tag o) {
return new DocTagImpl(o.name(), o.text());
}
示例10: processTag
import com.sun.javadoc.Tag; //導入方法依賴的package包/類
@Override
public JSONElement processTag(Tag tag) {
return new JSONElement(tag.text());
}
示例11: writeContents
import com.sun.javadoc.Tag; //導入方法依賴的package包/類
private static void writeContents(ClassDoc[] classes, String tagName , String outputFolder)
{
for (int i = 0; i < classes.length; i++)
{
final ClassDoc javaClass = classes [i];
final String className = javaClass.qualifiedName();
final Tag [] firstSentenceTags = javaClass.firstSentenceTags();
if (firstSentenceTags.length == 0) System.out.println("Create book sections: a class without first sentence class: " + className);
final String firstSentenceThisClass = (firstSentenceTags.length == 0)? "" : javaClass.firstSentenceTags() [0].text ();
algorithmToFirstSentence.put (className , firstSentenceThisClass);
algorithmToSectionsMap.put (className , new LinkedList<String> ());
algorithmToExercisesMap.put (className , new LinkedList<String> ());
String keywordsString = ""; for (Tag tag : javaClass.tags()) { if (tag.name().equals ("@"+tagName)) keywordsString += " " + tag.text () + " "; }
keywordsString = keywordsString.trim ();
for (String keyword : StringUtils.split(keywordsString , ","))
{
final String keywordName = keyword.trim ();
if (keywordName.startsWith("Section "))
{
final String sectionNumber = keywordName.substring ("Section ".length()).trim ();
if (!sectionsToAlgorithmsMap.containsKey(sectionNumber)) sectionsToAlgorithmsMap.put (sectionNumber , new LinkedList<String> ());
sectionsToAlgorithmsMap.get(sectionNumber).add (className);
algorithmToSectionsMap.get (className).add (sectionNumber);
}
else if (keywordName.startsWith("Exercise "))
{
final String exerciseNumber = keywordName.substring ("Exercise ".length()).trim ();
if (!exercisesToAlgorithmsMap.containsKey(exerciseNumber)) exercisesToAlgorithmsMap.put (exerciseNumber , new LinkedList<String> ());
exercisesToAlgorithmsMap.get(exerciseNumber).add (className);
algorithmToExercisesMap.get (className).add (exerciseNumber);
}
else throw new RuntimeException ("In the tag net2plan.ocnbooksections: wrong tag value: " + keyword + ", in class: " + className + ", keywordsString: " + keywordsString);
}
}
System.out.println ("sectionsToAlgorithmsMap: " + sectionsToAlgorithmsMap);
System.out.println ("exercisesToAlgorithmsMap: " + exercisesToAlgorithmsMap);
System.out.println ("algorithmToSectionsMap: " + algorithmToSectionsMap);
System.out.println ("sections: " + sectionsToAlgorithmsMap.keySet());
System.out.println ("exercises: " + exercisesToAlgorithmsMap.keySet());
String htmlFile = createHtml(outputFolder);
try
{
File f = new File (outputFolder + "/ocnbookSections.html");
System.out.println ("Save in : " + f.getAbsolutePath());
PrintWriter pw = new PrintWriter (f);
pw.append(htmlFile);
pw.close ();
} catch (Exception e) { e.printStackTrace(); throw new RuntimeException ("Not possible to write in ocnbookSections.html"); }
}
示例12: toString
import com.sun.javadoc.Tag; //導入方法依賴的package包/類
public String toString(Tag tag) {
return "<code>" + tag.text() + "</code>";
}
示例13: printTag
import com.sun.javadoc.Tag; //導入方法依賴的package包/類
private void printTag(Tag tag)
{
if (null != tag.text()) {
System.out.println(tag.text());
}
}
示例14: toString
import com.sun.javadoc.Tag; //導入方法依賴的package包/類
public String toString(Tag tag) {
return "<i>" + tag.text() + "</i>";
}
示例15: toTex
import com.sun.javadoc.Tag; //導入方法依賴的package包/類
public String toTex(Tag tag) {
return "$" + tag.text() + "$";
}