KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > de > uka > ipd > coverage > natures > TestedClass


1 /*
2  * Created on 01.09.2004
3  *
4  * written by Matthias Kempka
5  */

6 package de.uka.ipd.coverage.natures;
7
8 import org.apache.bcel.classfile.JavaClass;
9 import org.eclipse.jdt.core.IJavaProject;
10 import org.eclipse.jdt.core.IType;
11 import org.eclipse.jdt.core.JavaModelException;
12
13 import de.uka.ipd.coverage.plugin.CoveragePlugin;
14 import de.uka.ipd.coverage.recording.CoverageState;
15
16 /**
17  * Created on 01.09.2004
18  * This is a class that contains a tested class and its coverage state as
19  * a CoverageNature evaluated it.
20  * @author Matthias Kempka
21  */

22 public class TestedClass {
23
24     private JavaClass jclass;
25     private CoverageState state;
26     
27     
28     public TestedClass(JavaClass jclass, CoverageState state) {
29         this.jclass = jclass;
30         this.state = state;
31     }
32     
33     public JavaClass getTestedClass() {
34         return jclass;
35     }
36     
37     public CoverageState getState() {
38         return state;
39     }
40
41     public void setState(CoverageState state) {
42         this.state = state;
43     }
44     
45     public boolean equals(Object JavaDoc obj) {
46         if (!(obj instanceof TestedClass)) {
47             return false;
48         }
49         TestedClass compObj = (TestedClass) obj;
50         if (this.jclass.equals(compObj.jclass)
51                 && this.state == compObj.state) {
52             return true;
53         }
54         return false;
55     }
56     public int hashCode() {
57         return jclass.hashCode();
58     }
59
60     public IType getType() throws JavaModelException {
61         IJavaProject jp = CoveragePlugin.getDefault().getJavaProject();
62         IType type = jp.findType(jclass.getClassName());
63         return type;
64     }
65 }
66
Popular Tags