KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > hammurapi > inspectors > metrics > JarFileList


1 /*
2  * Created on Dec 19, 2004
3  *
4  */

5 package org.hammurapi.inspectors.metrics;
6
7 import java.util.Hashtable JavaDoc;
8 import java.util.Vector JavaDoc;
9
10 import org.w3c.dom.Document JavaDoc;
11 import org.w3c.dom.Element JavaDoc;
12
13 /**
14  * @author 111001082
15  *
16  */

17 public class JarFileList extends Vector JavaDoc {
18
19     public void markUsedJarFiles(Vector JavaDoc techEntityList,
20             Hashtable JavaDoc allTechStackEntitiesTable) {
21         for (int i = 0; i < this.size(); i++) {
22             int j = 0;
23             boolean notFound = true;
24             JarFile jarFile = (JarFile) this.elementAt(i);
25             while (notFound && j < techEntityList.size()) {
26
27                 TechStackEntity tse = (TechStackEntity) techEntityList.elementAt(j);
28                 if (tse != null) {
29                     
30                     // side effect in markIfPartOfJarFileList: tse Jars isUsed flag will be set
31
if (tse.markIfPartOfJarFileList(jarFile.getJarNameWithoutPath())) {
32                         jarFile.setIsUsed(true);
33                         // System.out.println( "TRUE " + jarFile);
34
}
35                 }
36                 j++;
37             }
38         }
39     }
40     
41     public Element JavaDoc toDom(Document JavaDoc document){
42         
43         Element JavaDoc jarFileListE =document.createElement("ClasspathFileLicense");
44         
45         for (int i = 0; i < this.size(); i++) {
46             int j = 0;
47             boolean notFound = true;
48             JarFile jarFile = (JarFile) this.elementAt(i);
49             jarFileListE.appendChild(jarFile.toDom(document));
50             //System.out.println( jarFile.toString());
51
}
52         return jarFileListE;
53     }
54 }
Popular Tags