KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > jdt > internal > corext > callhierarchy > MethodCall


1 /*******************************************************************************
2  * Copyright (c) 2000, 2005 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  *******************************************************************************/

12 package org.eclipse.jdt.internal.corext.callhierarchy;
13
14 import java.util.ArrayList JavaDoc;
15 import java.util.Collection JavaDoc;
16 import java.util.List JavaDoc;
17
18 import org.eclipse.jdt.core.IMember;
19
20 public class MethodCall {
21     private IMember fMember;
22     private List JavaDoc fCallLocations;
23
24     /**
25      * @param enclosingElement
26      */

27     public MethodCall(IMember enclosingElement) {
28         this.fMember = enclosingElement;
29     }
30
31     /**
32      *
33      */

34     public Collection JavaDoc getCallLocations() {
35         return fCallLocations;
36     }
37
38     public CallLocation getFirstCallLocation() {
39         if ((fCallLocations != null) && !fCallLocations.isEmpty()) {
40             return (CallLocation) 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 Object JavaDoc 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 JavaDoc();
70         }
71
72         fCallLocations.add(location);
73     }
74 }
75
Popular Tags