/[classpath]/gjdoc/src/gnu/classpath/tools/gjdoc/DocImpl.java
ViewVC logotype

Diff of /gjdoc/src/gnu/classpath/tools/gjdoc/DocImpl.java

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.11 by julian, Sun Nov 21 16:19:16 2004 UTC revision 1.12 by julian, Tue Nov 23 12:49:55 2004 UTC
# Line 23  package gnu.classpath.tools.gjdoc; Line 23  package gnu.classpath.tools.gjdoc;
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
# Line 34  public abstract class DocImpl implements Line 35  public abstract class DocImpl implements
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() {
# Line 641  public abstract class DocImpl implements Line 643  public abstract class DocImpl implements
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    

Legend:
Removed from v.1.11  
changed lines
  Added in v.1.12

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26