Refactory: remove unused classes, imports, fields and methods.
[phpeclipse.git] / net.sourceforge.phpeclipse / src / net / sourceforge / phpdt / internal / core / SourceMethodElementInfo.java
1 /*******************************************************************************
2  * Copyright (c) 2000, 2003 IBM Corporation and others.
3  * All rights reserved. This program and the accompanying materials 
4  * are made available under the terms of the Common Public License v1.0
5  * which accompanies this distribution, and is available at
6  * http://www.eclipse.org/legal/cpl-v10.html
7  * 
8  * Contributors:
9  *     IBM Corporation - initial API and implementation
10  *******************************************************************************/
11 package net.sourceforge.phpdt.internal.core;
12
13 import net.sourceforge.phpdt.core.Signature;
14 import net.sourceforge.phpdt.internal.compiler.env.ISourceMethod;
15
16 /**
17  * Element info for IMethod elements.
18  */
19 /* package */class SourceMethodElementInfo extends MemberElementInfo implements
20                 ISourceMethod {
21
22         /**
23          * For a source method (that is, a method contained in a compilation unit)
24          * this is a collection of the names of the parameters for this method, in
25          * the order the parameters are delcared. For a binary method (that is, a
26          * method declared in a binary type), these names are invented as "arg"i
27          * where i starts at 1. This is an empty array if this method has no
28          * parameters.
29          */
30         protected char[][] argumentNames;
31
32         /**
33          * Collection of type names for the arguments in this method, in the order
34          * they are declared. This is an empty array for a method with no arguments.
35          * A name is a simple name or a qualified, dot separated name. For example,
36          * Hashtable or java.util.Hashtable.
37          */
38         protected char[][] argumentTypeNames;
39
40         /**
41          * Return type name for this method. The return type of constructors is
42          * equivalent to void.
43          */
44         protected char[] returnType;
45
46         /**
47          * A collection of type names of the exceptions this method throws, or an
48          * empty collection if this method does not declare to throw any exceptions.
49          * A name is a simple name or a qualified, dot separated name. For example,
50          * Hashtable or java.util.Hashtable.
51          */
52         protected char[][] exceptionTypes;
53
54         /**
55          * Constructor flag.
56          */
57         protected boolean isConstructor = false;
58
59         public char[][] getArgumentNames() {
60                 return this.argumentNames;
61         }
62
63         public char[][] getArgumentTypeNames() {
64                 return this.argumentTypeNames;
65         }
66
67         public char[][] getExceptionTypeNames() {
68                 return this.exceptionTypes;
69         }
70
71         public char[] getReturnTypeName() {
72                 return this.returnType;
73         }
74
75         public char[] getSelector() {
76                 return this.name;
77         }
78
79         protected String getSignature() {
80
81                 String[] paramSignatures = new String[this.argumentTypeNames.length];
82                 for (int i = 0; i < this.argumentTypeNames.length; ++i) {
83                         paramSignatures[i] = Signature.createTypeSignature(
84                                         this.argumentTypeNames[i], false);
85                 }
86                 return Signature.createMethodSignature(paramSignatures, Signature
87                                 .createTypeSignature(this.returnType, false));
88         }
89
90         public boolean isConstructor() {
91                 return this.isConstructor;
92         }
93
94         protected void setArgumentNames(char[][] names) {
95                 this.argumentNames = names;
96         }
97
98         protected void setArgumentTypeNames(char[][] types) {
99                 this.argumentTypeNames = types;
100         }
101
102         protected void setConstructor(boolean isConstructor) {
103                 this.isConstructor = isConstructor;
104         }
105
106         protected void setExceptionTypeNames(char[][] types) {
107                 this.exceptionTypes = types;
108         }
109
110         protected void setReturnType(char[] type) {
111                 this.returnType = type;
112         }
113 }