KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > kirkk > analyzer > framework > bcelbundle > JarRelationshipDecorator


1 package com.kirkk.analyzer.framework.bcelbundle;
2
3 import java.util.*;
4 import java.io.*;
5 import com.kirkk.analyzer.framework.*;
6
7 public class JarRelationshipDecorator extends JarCollectionDecorator {
8
9     public JarRelationshipDecorator(JarCollection jarCollection) {
10         super(jarCollection);
11         this.buildJarRelationships();
12     }
13
14     private void buildJarRelationships() {
15         while (this.jarCollection.hasNext()) {
16             Jar jar = this.jarCollection.nextJar();
17             Iterator externalImports = jar.getAllExternallyReferencedPackages().iterator();
18             while (externalImports.hasNext()) {
19                 String JavaDoc packageName = (String JavaDoc) externalImports.next();
20                 Jar dependentJar = this.jarCollection.getJarContainingPackage(packageName);
21                 if (dependentJar != null) {
22                     jar.addOutgoingDependency(dependentJar);
23                 }
24             }
25         }
26     }
27
28 }
Popular Tags