OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [libjava/] [classpath/] [tools/] [gnu/] [classpath/] [tools/] [gjdoc/] [PackageDocImpl.java] - Blame information for rev 779

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 779 jeremybenn
/* gnu.classpath.tools.gjdoc.PackageDocImpl
2
   Copyright (C) 2001 Free Software Foundation, Inc.
3
 
4
This file is part of GNU Classpath.
5
 
6
GNU Classpath is free software; you can redistribute it and/or modify
7
it under the terms of the GNU General Public License as published by
8
the Free Software Foundation; either version 2, or (at your option)
9
any later version.
10
 
11
GNU Classpath is distributed in the hope that it will be useful, but
12
WITHOUT ANY WARRANTY; without even the implied warranty of
13
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14
General Public License for more details.
15
 
16
You should have received a copy of the GNU General Public License
17
along with GNU Classpath; see the file COPYING.  If not, write to the
18
Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
19
02111-1307 USA.
20
 
21
Linking this library statically or dynamically with other modules is
22
making a combined work based on this library.  Thus, the terms and
23
conditions of the GNU General Public License cover the whole
24
combination.
25
 
26
As a special exception, the copyright holders of this library give you
27
permission to link this library with independent modules to produce an
28
executable, regardless of the license terms of these independent
29
modules, and to copy and distribute the resulting executable under
30
terms of your choice, provided that you also meet, for each linked
31
independent module, the terms and conditions of the license of that
32
module.  An independent module is a module which is not derived from
33
or based on this library.  If you modify this library, you may extend
34
this exception to your version of the library, but you are not
35
obligated to do so.  If you do not wish to do so, delete this
36
exception statement from your version. */
37
 
38
package gnu.classpath.tools.gjdoc;
39
 
40
import com.sun.javadoc.*;
41
import java.util.*;
42
import java.io.File;
43
 
44
class PackageDocImpl extends DocImpl implements GjdocPackageDoc {
45
 
46
   private String packageName;
47
   private File   packageDirectory;
48
 
49
   private Set    allClassesSet       = new TreeSet();
50
   private List   ordinaryClassesList = new ArrayList();
51
   private List   exceptionsList      = new ArrayList();
52
   private List   interfacesList      = new ArrayList();
53
   private List   errorsList          = new ArrayList();
54
 
55
   private ClassDoc[] allClasses;
56
   private ClassDoc[] ordinaryClasses;
57
   private ClassDoc[] exceptions;
58
   private ClassDoc[] interfaces;
59
   private ClassDoc[] errors;
60
 
61
   PackageDocImpl(String packageName) {
62
      super(null);
63
      this.packageName=packageName;
64
   }
65
 
66
   public void addClass(ClassDoc classDoc) {
67
      if (Main.getInstance().includeAccessLevel(((ClassDocImpl)classDoc).accessLevel)) {
68
         allClassesSet.add(classDoc);
69
      }
70
   }
71
 
72
   public void resolve() {
73
      for (Iterator it=allClassesSet.iterator(); it.hasNext(); ) {
74
         ClassDocImpl classDoc=(ClassDocImpl)it.next();
75
         try {
76
             classDoc.resolve();
77
         } catch (ParseException e) {
78
             System.err.println("FIXME: add try-catch to force compilation"
79
                                + e);
80
         }
81
 
82
         if (classDoc.isInterface()) {
83
            interfacesList.add(classDoc);
84
         }
85
         else if (classDoc.isException()) {
86
            exceptionsList.add(classDoc);
87
         }
88
         else if (classDoc.isError()) {
89
            errorsList.add(classDoc);
90
         }
91
         else {
92
            ordinaryClassesList.add(classDoc);
93
         }
94
      }
95
   }
96
 
97
   public void resolveComments() {
98
      if (rawDocumentation!=null) {
99
         this.tagMap=parseCommentTags(rawDocumentation.toCharArray(),
100
                                      0,
101
                                      rawDocumentation.length(),
102
                                      null,
103
                                      null,
104
                                      null,
105
                                      null);
106
      }
107
 
108
      resolveTags();
109
   }
110
 
111
   public String name() {
112
      return packageName;
113
   }
114
 
115
   public ClassDoc[] allClasses()
116
   {
117
      if (null == this.allClasses) {
118
         this.allClasses = toClassDocArray(allClassesSet);
119
      }
120
      return this.allClasses;
121
   }
122
 
123
   public ClassDoc[] ordinaryClasses()
124
   {
125
      if (null == this.ordinaryClasses) {
126
         this.ordinaryClasses = toClassDocArray(ordinaryClassesList);
127
      }
128
      return this.ordinaryClasses;
129
   }
130
 
131
 
132
   public ClassDoc[] exceptions()
133
   {
134
      if (null == this.exceptions) {
135
         this.exceptions = toClassDocArray(exceptionsList);
136
      }
137
      return this.exceptions;
138
   }
139
 
140
   public ClassDoc[] interfaces()
141
   {
142
      if (null == this.interfaces) {
143
         this.interfaces = toClassDocArray(interfacesList);
144
      }
145
      return this.interfaces;
146
   }
147
 
148
   public ClassDoc[] errors()
149
   {
150
      if (null == this.errors) {
151
         this.errors = toClassDocArray(errorsList);
152
      }
153
      return this.errors;
154
   }
155
 
156
   private ClassDoc[] toClassDocArray(Collection classDocList)
157
   {
158
      ClassDoc[] result = (ClassDoc[])classDocList.toArray(new ClassDoc[classDocList.size()]);
159
      Arrays.sort(result);
160
      return result;
161
   }
162
 
163
   public ClassDoc findClass(String name) {
164
      return Main.getRootDoc().classNamed(packageName+"."+name);
165
   }
166
 
167
   public void dump(int level) {
168
      Debug.log(level, "All classes:");
169
      Debug.dumpArray(level, allClasses());
170
 
171
      Debug.log(level, "Ordinary classes:");
172
      Debug.dumpArray(level, ordinaryClasses());
173
 
174
   }
175
 
176
   public static final PackageDocImpl DEFAULT_PACKAGE = new PackageDocImpl("");
177
 
178
   public boolean isPackage() {
179
      return true;
180
   }
181
 
182
   public boolean isIncluded() {
183
      return isIncluded;
184
   }
185
 
186
   void setIsIncluded(boolean b) {
187
      this.isIncluded=b;
188
   }
189
 
190
   private boolean isIncluded = false;
191
 
192
   public String toString() {
193
      return packageName;
194
   }
195
 
196
   public int compareTo(Object o) {
197
      if (o!=null && o instanceof PackageDocImpl)
198
         return name().compareTo(((PackageDocImpl)o).name());
199
      else
200
         return 0;
201
   }
202
 
203
   public boolean equals(Object o) {
204
      if (o!=null && o instanceof PackageDocImpl)
205
         return name().equals(((PackageDocImpl)o).name());
206
      else
207
         return false;
208
   }
209
 
210
   /**
211
    *  Sets the directory containing this package's source files.
212
    */
213
   public void setPackageDirectory(File packageDirectory) {
214
      this.packageDirectory = packageDirectory;
215
   }
216
 
217
   /**
218
    *  Gets the directory containing this package's source files.
219
    */
220
   public File packageDirectory() {
221
      return this.packageDirectory;
222
   }
223
}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.