23 |
import com.sun.javadoc.*; |
import com.sun.javadoc.*; |
24 |
import java.util.*; |
import java.util.*; |
25 |
import java.text.*; |
import java.text.*; |
26 |
|
import java.io.File; |
27 |
|
|
28 |
/** |
/** |
29 |
* Represents the least common denominator of all Javadoc |
* Represents the least common denominator of all Javadoc |
35 |
protected static Tag[] linkTagEmptyArr = new LinkTagImpl[0]; |
protected static Tag[] linkTagEmptyArr = new LinkTagImpl[0]; |
36 |
protected static Tag[] paramTagEmptyArr = new ParamTagImpl[0]; |
protected static Tag[] paramTagEmptyArr = new ParamTagImpl[0]; |
37 |
protected static Tag[] throwsTagEmptyArr = new ThrowsTagImpl[0]; |
protected static Tag[] throwsTagEmptyArr = new ThrowsTagImpl[0]; |
38 |
|
protected SourcePosition position; |
39 |
|
|
40 |
// Return the text of the comment for this doc item. |
// Return the text of the comment for this doc item. |
41 |
public String commentText() { |
public String commentText() { |
643 |
((AbstractTagImpl)inlineTags[i]).resolve(); |
((AbstractTagImpl)inlineTags[i]).resolve(); |
644 |
} |
} |
645 |
} |
} |
646 |
|
|
647 |
|
private static File getFile(ClassDoc classDoc) { |
648 |
|
return new File(((GjdocPackageDoc)classDoc.containingPackage()).packageDirectory(), |
649 |
|
classDoc.name() + ".java"); |
650 |
|
} |
651 |
|
|
652 |
|
public static SourcePosition getPosition(ClassDoc classDoc) |
653 |
|
{ |
654 |
|
return new SourcePositionImpl(getFile(classDoc), 0, 0); |
655 |
|
} |
656 |
|
|
657 |
|
public static SourcePosition getPosition(ClassDoc classDoc, char[] source, int startIndex) |
658 |
|
{ |
659 |
|
int column = 0; |
660 |
|
int line = 0; |
661 |
|
for (int i=0; i<startIndex; ++i) { |
662 |
|
if (10 == source[i]) { |
663 |
|
++ line; |
664 |
|
column = 0; |
665 |
|
} |
666 |
|
else if (13 != source[i]) { |
667 |
|
++ column; |
668 |
|
} |
669 |
|
} |
670 |
|
while (true) { |
671 |
|
ClassDoc containingClassDoc = classDoc.containingClass(); |
672 |
|
if (null != containingClassDoc) { |
673 |
|
classDoc = containingClassDoc; |
674 |
|
} |
675 |
|
else { |
676 |
|
break; |
677 |
|
} |
678 |
|
} |
679 |
|
|
680 |
|
File file = getFile(classDoc); |
681 |
|
|
682 |
|
return new SourcePositionImpl(file, line + 1, column + 1); |
683 |
|
} |
684 |
|
|
685 |
|
public SourcePosition position() |
686 |
|
{ |
687 |
|
return this.position; |
688 |
|
} |
689 |
|
|
690 |
|
public DocImpl(SourcePosition position) |
691 |
|
{ |
692 |
|
this.position = position; |
693 |
|
} |
694 |
} |
} |
695 |
|
|