blob: c1468a85a804fcf2b2c741f1c6e4ecc9aad3426a (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
|
/* ____ ____ ____ ____ ______ *\
** / __// __ \/ __// __ \/ ____/ SOcos COmpiles Scala **
** __\_ \/ /_/ / /__/ /_/ /\_ \ (c) 2002, LAMP/EPFL **
** /_____/\____/\___/\____/____/ **
\* */
// $Id$
package scalac.atree;
import java.util.Map;
import java.util.LinkedHashMap;
/** This class represents a repository of attributed classes. */
public class ARepository {
//########################################################################
// Private Fields
/** The symbol to class map */
private final Map/*<Symbol,AClass>*/ classes;
//########################################################################
// Public Constructors
/** Initializes this instance. */
public ARepository() {
this.classes = new LinkedHashMap();
}
//########################################################################
// Public Methods
/** Adds the given class to this repository. */
public void addClass(AClass clasz) {
assert !classes.containsKey(clasz.symbol()): clasz;
classes.put(clasz.symbol(), clasz);
}
/** Returns the classes of this repository. */
public AClass[] classes() {
return (AClass[])classes.values().toArray(new AClass[classes.size()]);
}
/** Returns a string representation of this repository. */
public String toString() {
return new ATreePrinter().printRepository(this).toString();
}
//########################################################################
}
|