01: //
02: // This file is part of the prose package.
03: //
04: // The contents of this file are subject to the Mozilla Public License
05: // Version 1.1 (the "License"); you may not use this file except in
06: // compliance with the License. You may obtain a copy of the License at
07: // http://www.mozilla.org/MPL/
08: //
09: // Software distributed under the License is distributed on an "AS IS" basis,
10: // WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
11: // for the specific language governing rights and limitations under the
12: // License.
13: //
14: // The Original Code is prose.
15: //
16: // The Initial Developer of the Original Code is Andrei Popovici. Portions
17: // created by Andrei Popovici are Copyright (C) 2002 Andrei Popovici.
18: // All Rights Reserved.
19: //
20: // Contributor(s):
21: package ch.ethz.inf.iks.jvmai.jvmdi;
22:
23: import ch.ethz.jvmai.MethodEntryJoinPoint;
24: import ch.ethz.jvmai.MethodExitJoinPoint;
25: import ch.ethz.jvmai.JoinPointKinds;
26:
27: /** Class MethodExecutionJoinPointImpl is
28: * simply the implementation for the MethodEntry and MethodExit
29: * join point kinds.
30: */
31: public class MethodExecutionJoinPointImpl extends CodeJoinPointImpl
32: implements MethodEntryJoinPoint, MethodExitJoinPoint,
33: JoinPointKinds {
34:
35: private int mask;
36:
37: protected void setKind(boolean isEntryJP) {
38: isEntryJoinPoint = isEntryJP;
39: if (isEntryJoinPoint)
40: mask = MASK_CODE_JP | MASK_METHOD_ENTRY_JP;
41: else
42: mask = MASK_CODE_JP | MASK_METHOD_EXIT_JP;
43:
44: }
45:
46: private boolean isEntryJoinPoint;
47:
48: protected MethodExecutionJoinPointImpl(ControlFlow cf,
49: JoinPointContext ctx) {
50: super (cf, ctx);
51: }
52:
53: public void setArg(int position, Object value) {
54: context.setLocalValue(value, position);
55: }
56:
57: public int getMask() {
58: return mask;
59: }
60:
61: public String getKind() {
62: if (isEntryJoinPoint)
63: return MethodEntryJoinPoint.KIND;
64: else
65: return MethodExitJoinPoint.KIND;
66: }
67:
68: public Object getResult() {
69: throw new RuntimeException(
70: "MethodExit getResult not implemented");
71: }
72:
73: public void setResult(Object result) {
74: throw new RuntimeException(
75: "MethodExit setResult not implemented");
76: }
77:
78: // in a method entry/exit joinpoint, the target is actually known: THIS
79: public Object getTarget() {
80: return getThis();
81: }
82:
83: /**
84: * implements method of interface ClassSpecific
85: */
86: public Class getTargetClass() {
87: return getMethod().getDeclaringClass();
88: }
89: }
|