+ @Override
+ public CHRRuleset getRuleset(String name) throws AmbiguousNameException {
+ CHRRuleset result = null, temp;
+ Module resultModule = null;
+ ArrayList<String> conflictingModules = null;
+ for(ModuleImport moduleImport : moduleImports) {
+ Module module = moduleImport.module;
+ temp = module.getRuleset(name);
+ if(temp != null) {
+ if(result != null) {
+ if(conflictingModules == null) {
+ conflictingModules = new ArrayList<String>(2);
+ conflictingModules.add(resultModule.getName());
+ }
+ conflictingModules.add(module.getName());
+ }
+ else {
+ result = temp;
+ resultModule = module;
+ }
+ }
+ }
+ if(conflictingModules != null)
+ throw new AmbiguousNameException(conflictingModules, name);
+ return result;
+ }
+