01: /*
02: * User: Michael Rettig
03: * Date: Oct 22, 2002
04: * Time: 6:17:00 PM
05: */
06: package net.sourceforge.jaxor.parser;
07:
08: import java.util.ArrayList;
09: import java.util.HashSet;
10: import java.util.Iterator;
11: import java.util.List;
12:
13: public class ImportSet {
14: private final List _imports = new ArrayList();
15:
16: public void add(Import imp) {
17: _imports.add(imp);
18: }
19:
20: public java.util.Set getSet() {
21: return new HashSet(_imports);
22: }
23:
24: public void add(ImportSet bodyGenerator) {
25: _imports.addAll(bodyGenerator._imports);
26: }
27:
28: public int size() {
29: return _imports.size();
30: }
31:
32: public void add(String aPackage) {
33: _imports.add(new Import(aPackage));
34: }
35:
36: public List findPossibleNames(String entity) {
37: List results = new ArrayList();
38: results.add(entity);
39: for (Iterator iterator = _imports.iterator(); iterator
40: .hasNext();) {
41: Import anImport = (Import) iterator.next();
42: if (anImport.isWildcard())
43: results.add(anImport.asStringNoWildcard() + "."
44: + entity);
45: }
46: return results;
47: }
48: }
|