01: package org.drools.eclipse.core;
02:
03: import java.util.HashMap;
04: import java.util.Map;
05:
06: /**
07: * This represents a rule set.
08: *
09: * @author <a href="mailto:kris_verlaenen@hotmail.com">Kris Verlaenen</a>
10: */
11: public class RuleSet extends DroolsElement {
12:
13: private Map packages = new HashMap();
14:
15: RuleSet() {
16: super (null);
17: }
18:
19: public Package getPackage(String packageName) {
20: return (Package) packages.get(packageName);
21: }
22:
23: public int getType() {
24: return RULESET;
25: }
26:
27: public DroolsElement[] getChildren() {
28: return (DroolsElement[]) packages.values().toArray(
29: new DroolsElement[packages.size()]);
30: }
31:
32: // These are helper methods for creating the model and should not
33: // be used directly. Use DroolsModelBuilder instead.
34:
35: void addPackage(Package pkg) {
36: packages.put(pkg.getPackageName(), pkg);
37: }
38:
39: void removePackage(String packageName) {
40: packages.remove(packageName);
41: }
42:
43: void clear() {
44: packages.clear();
45: }
46:
47: }
|