- //\r
- // Test if one library consumes another library\r
- // \r
- private boolean consumes(ModuleIdentification lib1, ModuleIdentification lib2) {\r
- LinkedList<ModuleIdentification> stack = new LinkedList<ModuleIdentification>();\r
-\r
- stack.add(lib1);\r
- int j = 0;\r
- while (j < stack.size()) {\r
- //\r
- // get the last library instance in stack, which hasn't been checked\r
- // \r
- ModuleIdentification lib = stack.get(j++);\r
- //\r
- // get the library classes consumed by it\r
- // \r
- String[] consumedClasses = libInstanceMap.get(lib);\r
- for (int i = 0; i < consumedClasses.length; ++i) {\r
- //\r
- // for each library class, find its corresponding library instance\r
- // \r
- ModuleIdentification consumedLib = libClassMap.get(consumedClasses[i]);\r
- //\r
- // if the corresponding instance is the "lib2", we can say that\r
- // "lib1" consumes "lib2"\r
- // \r
- if (consumedLib == lib2) {\r
- EdkLog.log(EdkLog.EDK_DEBUG, lib1 + "\n consumes\n" + lib2 + "\n");\r
- return true;\r
+ String[] consumedClassList = libInstanceConsumes.get(n);\r
+ for (int i = 0; i < consumedClassList.length; ++i) {\r
+ ModuleIdentification m = libClassProducer.get(consumedClassList[i]);\r
+ if (m == null) {\r
+ continue;\r