import java.util.ArrayList;
+import com.sun.xml.internal.ws.wsdl.parser.ParserUtil;
+
public class FunctionHeader {
- public final ArrayList<VariableDeclaration> templateList;
+ private ArrayList<VariableDeclaration> templateList;
public final String returnType;
public final QualifiedName qualifiedName;
public final ArrayList<VariableDeclaration> args;
- public FunctionHeader(ArrayList<VariableDeclaration> templateList, String returnType, QualifiedName qualifiedName,
+ public FunctionHeader(String returnType, QualifiedName qualifiedName,
ArrayList<VariableDeclaration> args) {
- this.templateList = templateList;
+ this.templateList = null;
this.returnType = returnType;
this.qualifiedName = qualifiedName;
this.args = args;
}
+
+ public void setTemplateList(ArrayList<VariableDeclaration> templateList) {
+ this.templateList = templateList;
+ }
+
+ public ArrayList<VariableDeclaration> getTemplateList() {
+ return this.templateList;
+ }
+
+ public String getTemplateFullStr() {
+ String templateStr = "";
+ if (templateList.size() == 0)
+ return templateStr;
+ VariableDeclaration decl;
+ decl = templateList.get(0);
+ templateStr = "<" + decl.type + " " + decl.name;
+ for (int i = 1; i < templateList.size(); i++) {
+ decl = templateList.get(i);
+ templateStr = templateStr + ", " + decl.type + " " + decl.name;
+ }
+ templateStr = templateStr + ">";
+ return templateStr;
+ }
+
+ public String getTemplateArgStr() {
+ String templateStr = null;
+ if (templateList.size() == 0)
+ return templateStr;
+ templateStr = "<" + templateList.get(0).name;
+ for (int i = 1; i < templateList.size(); i++) {
+ templateStr = templateStr + ", " + templateList.get(i);
+ }
+ templateStr = templateStr + ">";
+ return templateStr;
+ }
+
+ public String getFuncStr() {
+ String res = returnType + " " + qualifiedName.fullName + "(";
+ if (args.size() >= 1) {
+ res = res + args.get(0);
+ }
+ for (int i = 1; i < args.size(); i++) {
+ res = res + ", " + args.get(i);
+ }
+ res = res + ")";
+ return res;
+ }
public String toString() {
String res = returnType + " " + qualifiedName.fullName + "(";
public FunctionHeader getRenamedHeader(String prefix) {
String newFullName = qualifiedName.qualifiedName + prefix + "_"
+ qualifiedName.bareName;
- FunctionHeader newHeader = new FunctionHeader(templateList, returnType,
+ FunctionHeader newHeader = new FunctionHeader(returnType,
new QualifiedName(newFullName), args);
return newHeader;
}