1
2
3
4
5 package xjavadoc;
6
7 import java.util.*;
8
9 /***
10 * Describe what this class does
11 *
12 * @author Aslak Hellesøy
13 * @created 3. januar 2002
14 * @todo-javadoc Write javadocs
15 */
16 public final class XPackage implements Comparable
17 {
18 /***
19 * @todo-javadoc Describe the field
20 */
21 private String _name;
22 /***
23 * @todo-javadoc Describe the field
24 */
25 private List _classes = new LinkedList();
26
27
28
29 /***
30 * Describe what the XPackage constructor does
31 *
32 * @param name Describe what the parameter does
33 * @todo-javadoc Write javadocs for constructor
34 * @todo-javadoc Write javadocs for method parameter
35 */
36 public XPackage( String name )
37 {
38 _name = name;
39 }
40
41 /***
42 * Gets the DefaultPackage attribute of the XPackage object
43 *
44 * @return The DefaultPackage value
45 */
46 public final boolean isDefaultPackage()
47 {
48 return getName().equals( "" );
49 }
50
51 /***
52 * Describe what the method does
53 *
54 * @return Describe the return value
55 * @todo-javadoc Write javadocs for method
56 * @todo-javadoc Write javadocs for return value
57 */
58 public final String getName()
59 {
60 return _name;
61 }
62
63 /***
64 * Describe what the method does
65 *
66 * @return Describe the return value
67 * @todo-javadoc Write javadocs for method
68 * @todo-javadoc Write javadocs for return value
69 */
70 public Collection getClasses()
71 {
72 return Collections.unmodifiableCollection( _classes );
73 }
74
75 /***
76 * Describe what the method does
77 *
78 * @return Describe the return value
79 * @todo-javadoc Write javadocs for method
80 * @todo-javadoc Write javadocs for return value
81 */
82 public String toString()
83 {
84 return getName();
85 }
86
87 /***
88 * Describe what the method does
89 *
90 * @return Describe the return value
91 * @todo-javadoc Write javadocs for method
92 * @todo-javadoc Write javadocs for return value
93 */
94 public int hashCode()
95 {
96 return getName().hashCode();
97 }
98
99 /***
100 * Describe what the method does
101 *
102 * @param o Describe what the parameter does
103 * @return Describe the return value
104 * @todo-javadoc Write javadocs for method
105 * @todo-javadoc Write javadocs for method parameter
106 * @todo-javadoc Write javadocs for return value
107 */
108 public int compareTo( Object o )
109 {
110 XPackage other = ( XPackage ) o;
111
112 return getName().compareTo( other.getName() );
113 }
114
115 /***
116 * Describe the method
117 *
118 * @param clazz Describe the method parameter
119 * @todo-javadoc Write javadocs for return value
120 * @todo-javadoc Describe the method
121 * @todo-javadoc Describe the method parameter
122 */
123 void addClass( XClass clazz )
124 {
125
126
127 _classes.remove( clazz );
128 _classes.add( clazz );
129 }
130 }