blob: 44608bed56697489bc00316e06f58b0867ecb7c9 [file] [log] [blame]
The Android Open Source Project88b60792009-03-03 19:28:42 -08001/*
2 * Copyright (C) 2008 The Android Open Source Project
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
17import org.clearsilver.HDF;
18import org.clearsilver.CS;
19import java.util.HashSet;
20
21public class ParameterInfo
22{
23 ParameterInfo(String name, String typeName, TypeInfo type, SourcePositionInfo position)
24 {
25 mName = name;
26 mTypeName = typeName;
27 mType = type;
28 mPosition = position;
29 }
30
31 TypeInfo type()
32 {
33 return mType;
34 }
35
36 String name()
37 {
38 return mName;
39 }
40
41 String typeName()
42 {
43 return mTypeName;
44 }
45
46 SourcePositionInfo position()
47 {
48 return mPosition;
49 }
50
51 public void makeHDF(HDF data, String base, boolean isLastVararg,
52 HashSet<String> typeVariables)
53 {
54 data.setValue(base + ".name", this.name());
55 type().makeHDF(data, base + ".type", isLastVararg, typeVariables);
56 }
57
58 public static void makeHDF(HDF data, String base, ParameterInfo[] params,
59 boolean isVararg, HashSet<String> typeVariables)
60 {
61 for (int i=0; i<params.length; i++) {
62 params[i].makeHDF(data, base + "." + i,
63 isVararg && (i == params.length - 1), typeVariables);
64 }
65 }
66
67 String mName;
68 String mTypeName;
69 TypeInfo mType;
70 SourcePositionInfo mPosition;
71}
72