OSDN Git Service

implemnted toString() methods
[xerial/xerial-core.git] / src / main / java / org / xerial / silk / impl / SilkFunction.java
1 /*--------------------------------------------------------------------------
2  *  Copyright 2009 Taro L. Saito
3  *
4  *  Licensed under the Apache License, Version 2.0 (the "License");
5  *  you may not use this file except in compliance with the License.
6  *  You may obtain a copy of the License at
7  *
8  *     http://www.apache.org/licenses/LICENSE-2.0
9  *
10  *  Unless required by applicable law or agreed to in writing, software
11  *  distributed under the License is distributed on an "AS IS" BASIS,
12  *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  *  See the License for the specific language governing permissions and
14  *  limitations under the License.
15  *--------------------------------------------------------------------------*/
16 //--------------------------------------
17 // XerialJ
18 //
19 // SilkFunction.java
20 // Since: Jan 30, 2009 7:36:19 PM
21 //
22 // $URL$
23 // $Author$
24 //--------------------------------------
25 package org.xerial.silk.impl;
26
27 import java.util.ArrayList;
28 import java.util.List;
29
30 import org.xerial.util.StringUtil;
31
32 /**
33  * function data
34  * 
35  * @author leo
36  * 
37  */
38 public class SilkFunction
39 {
40     private String name;
41     private String indent;
42     private ArrayList<SilkFunctionArg> argumentList = new ArrayList<SilkFunctionArg>();
43
44     public void setName(String name)
45     {
46         this.name = name;
47     }
48
49     public String getName()
50     {
51         return name;
52     }
53
54     public void addArgument(String argument)
55     {
56         argumentList.add(SilkFunctionArg.newArgValue(argument));
57     }
58
59     public void addKeyValuePair(SilkFunctionArg argument)
60     {
61         argumentList.add(argument);
62     }
63
64     public List<SilkFunctionArg> getArgumentList()
65     {
66         return argumentList;
67     }
68
69     public String getNodeIndent()
70     {
71         return indent;
72     }
73
74     public void setNodeIndent(String indent)
75     {
76         this.indent = indent;
77     }
78
79     @Override
80     public String toString()
81     {
82         return String.format("function %s(%s)", name, StringUtil.join(argumentList, ", "));
83     }
84
85 }