View Javadoc

1   package org.sourceforge.jemm.client.events;
2   
3   import org.sourceforge.jemm.client.Descriptor;
4   
5   /**
6    * Describes a Method entry or exit.
7    * 
8    * @author Paul
9    *
10   */
11  public class MethodEvent {
12  	Object entity;
13  	Descriptor method;
14  	MethodEventType type;
15  	boolean hasLock;
16  	
17  	public MethodEvent(Object entity, Descriptor method, MethodEventType type,boolean hasLock) {
18  		if(entity==null || method==null || type==null)
19  			throw new IllegalArgumentException("entity nor method may be null");
20  		
21  		this.entity = entity;
22  		this.method = method;
23  		this.type = type;
24  		this.hasLock = hasLock;
25  	}
26  
27  	public Object getEntity() {
28  		return entity;
29  	}
30  
31  	public Descriptor getMethod() {
32  		return method;
33  	}
34  	
35  	public MethodEventType getType() {
36  		return type;
37  	}
38  	
39  	public boolean hasLock() {
40  		return hasLock;
41  	}
42  	
43  	public boolean equals(Object obj) {
44  		if(!(obj instanceof MethodEvent))
45  			return false;
46  		
47  		MethodEvent rhs = (MethodEvent)obj;
48  		
49  		return entity == rhs.entity && method.equals(rhs.method)
50  			&& type.equals(rhs.type);
51  	}
52  	
53  	public int hashCode() {
54  		return entity.hashCode() + method.hashCode()+type.hashCode();
55  	}
56  }