]> git.uio.no Git - ifi-stolz-refaktor.git/blame - case-study/jdt-before/core extension/org/eclipse/jdt/internal/corext/callhierarchy/MethodCall.java
Case Study: adding data and statistics
[ifi-stolz-refaktor.git] / case-study / jdt-before / core extension / org / eclipse / jdt / internal / corext / callhierarchy / MethodCall.java
CommitLineData
1b2798f6
EK
1/*******************************************************************************
2 * Copyright (c) 2000, 2011 IBM Corporation and others.
3 * All rights reserved. This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License v1.0
5 * which accompanies this distribution, and is available at
6 * http://www.eclipse.org/legal/epl-v10.html
7 *
8 * Contributors:
9 * Jesper Kamstrup Linnet (eclipse@kamstrup-linnet.dk) - initial API and implementation
10 * (report 36180: Callers/Callees view)
11 *******************************************************************************/
12package org.eclipse.jdt.internal.corext.callhierarchy;
13
14import java.util.ArrayList;
15import java.util.Collection;
16import java.util.List;
17
18import org.eclipse.jdt.core.IMember;
19
20public class MethodCall {
21 private IMember fMember;
22 private List<CallLocation> fCallLocations;
23
24 /**
25 * @param enclosingElement
26 */
27 public MethodCall(IMember enclosingElement) {
28 this.fMember = enclosingElement;
29 }
30
31 /**
32 *
33 */
34 public Collection<CallLocation> getCallLocations() {
35 return fCallLocations;
36 }
37
38 public CallLocation getFirstCallLocation() {
39 if ((fCallLocations != null) && !fCallLocations.isEmpty()) {
40 return fCallLocations.get(0);
41 } else {
42 return null;
43 }
44 }
45
46 public boolean hasCallLocations() {
47 return fCallLocations != null && fCallLocations.size() > 0;
48 }
49
50 /**
51 * @return Object
52 */
53 public String getKey() {
54 return getMember().getHandleIdentifier();
55 }
56
57 /**
58 *
59 */
60 public IMember getMember() {
61 return fMember;
62 }
63
64 /**
65 * @param location
66 */
67 public void addCallLocation(CallLocation location) {
68 if (fCallLocations == null) {
69 fCallLocations = new ArrayList<CallLocation>();
70 }
71
72 fCallLocations.add(location);
73 }
74}