View Javadoc

1   package net.sf.jour.instrumentor;
2   
3   import java.util.List;
4   import java.util.Vector;
5   
6   public class InstrumentorResultsImpl implements InstrumentorResults {
7   
8   	private boolean modified;
9   
10  	private long countCounstructors;
11  	
12  	private long countMethods;
13  
14  	private List createdClasses;
15  	
16  	public static final InstrumentorResults NOT_MODIFIED = new InstrumentorResultsImpl();
17  	
18  	public InstrumentorResultsImpl() {
19  		
20  	}
21  
22  	public InstrumentorResultsImpl(long countCounstructors, long countMethods) {
23  		this.countCounstructors = countCounstructors;
24  		this.countMethods = countMethods;
25  		this.modified = true;
26  	}
27  
28  	public InstrumentorResultsImpl(long countCounstructors, long countMethods, List createdClasses) {
29  		this(countCounstructors, countMethods);
30  		this.createdClasses = createdClasses;
31  	}
32  
33  	public InstrumentorResultsImpl(InstrumentorResults r1, InstrumentorResults r2) {
34  		this.modified = r1.isModified() || r2.isModified();
35  		if (this.modified) {
36  			this.countCounstructors = r1.getCountCounstructors() + r2.getCountCounstructors();
37  			this.countMethods = r1.getCountMethods() + r2.getCountMethods();
38  			if ((r1.getCreatedClasses() != null) || (r2.getCreatedClasses() != null)) {
39  				this.createdClasses = new Vector();	
40  				if ((r1.getCreatedClasses() != null)) {
41  					this.createdClasses.addAll(r1.getCreatedClasses());
42  				}
43  				if ((r2.getCreatedClasses() != null)) {
44  					this.createdClasses.addAll(r2.getCreatedClasses());
45  				}
46  			}
47  		}
48  	}
49  	
50  	/**
51  	 * @return Returns true if any modification has been made to the class.
52  	 */
53  	public boolean isModified() {
54  		return modified;
55  	}
56  
57  	public long getCountCounstructors() {
58  		return countCounstructors;
59  	}
60  
61  	public long getCountMethods() {
62  		return countMethods;
63  	}
64  
65  	public List getCreatedClasses() {
66  		return createdClasses;
67  	}
68  
69  }