new version with WorkingCopy Management
[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 /** 
18  * Element info for IMethod elements. 
19  */
20 /* package */ class SourceMethodElementInfo extends MemberElementInfo implements 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,
25          * in the order the parameters are delcared. For a binary method (that is, 
26          * a method declared in a binary type), these names are invented as
27          * "arg"i where i starts at 1. This is an empty array if this method
28          * has no parameters.
29          */
30         protected char[][] argumentNames;
31
32         /**
33          * Collection of type names for the arguments in this
34          * method, in the order they are declared. This is an empty
35          * array for a method with no arguments. A name is a simple
36          * name or a qualified, dot separated name.
37          * For example, Hashtable or java.util.Hashtable.
38          */
39         protected char[][] argumentTypeNames;
40
41         /**
42          * Return type name for this method. The return type of
43          * constructors is equivalent to void.
44          */
45         protected char[] returnType;
46
47         /**
48          * A collection of type names of the exceptions this
49          * method throws, or an empty collection if this method
50          * does not declare to throw any exceptions. A name is a simple
51          * name or a qualified, dot separated name.
52          * For example, Hashtable or java.util.Hashtable.
53          */
54         protected char[][] exceptionTypes;
55
56         /**
57          * Constructor flag.
58          */
59         protected boolean isConstructor= false;
60 public char[][] getArgumentNames() {
61         return this.argumentNames;
62 }
63 public char[][] getArgumentTypeNames() {
64         return this.argumentTypeNames;
65 }
66 public char[][] getExceptionTypeNames() {
67         return this.exceptionTypes;
68 }
69 public char[] getReturnTypeName() {
70         return this.returnType;
71 }
72 public char[] getSelector() {
73         return this.name;
74 }
75 protected String getSignature() {
76
77         String[] paramSignatures = new String[this.argumentTypeNames.length];
78         for (int i = 0; i < this.argumentTypeNames.length; ++i) {
79                 paramSignatures[i] = Signature.createTypeSignature(this.argumentTypeNames[i], false);
80         }
81         return Signature.createMethodSignature(paramSignatures, Signature.createTypeSignature(this.returnType, false));
82 }
83 public boolean isConstructor() {
84         return this.isConstructor;
85 }
86 protected void setArgumentNames(char[][] names) {
87         this.argumentNames = names;
88 }
89 protected void setArgumentTypeNames(char[][] types) {
90         this.argumentTypeNames = types;
91 }
92 protected void setConstructor(boolean isConstructor) {
93         this.isConstructor = isConstructor;
94 }
95 protected void setExceptionTypeNames(char[][] types) {
96         this.exceptionTypes = types;
97 }
98 protected void setReturnType(char[] type) {
99         this.returnType = type;
100 }
101 }