PageRenderTime 92ms CodeModel.GetById 80ms app.highlight 7ms RepoModel.GetById 1ms app.codeStats 0ms

/cpp/src/main/java/com/google/test/metric/cpp/ParameterDeclarationBuilder.java

http://testability-explorer.googlecode.com/
Java | 48 lines | 25 code | 8 blank | 15 comment | 0 complexity | 4f3625202e88adc8467c1e846b168e3f MD5 | raw file
 1/*
 2 * Copyright 2008 Google Inc.
 3 *
 4 * Licensed under the Apache License, Version 2.0 (the "License"); you may not
 5 * use this file except in compliance with the License. You may obtain a copy of
 6 * 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, WITHOUT
12 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13 * License for the specific language governing permissions and limitations under
14 * the License.
15 */
16package com.google.test.metric.cpp;
17
18import com.google.test.metric.ParameterInfo;
19
20import java.util.List;
21
22public class ParameterDeclarationBuilder extends DefaultBuilder {
23
24  private final List<ParameterInfo> parameters;
25  private List<String> typeSpecifier;
26  private String name;
27
28  public ParameterDeclarationBuilder(List<ParameterInfo> parameters) {
29    this.parameters = parameters;
30  }
31
32  @Override
33  public void simpleTypeSpecifier(List<String> sts) {
34    typeSpecifier = sts;
35  }
36
37  @Override
38  public void directDeclarator(String id) {
39    name = id;
40  }
41
42  @Override
43  public void endParameterDeclaration() {
44    parameters.add(new ParameterInfo(name,
45        CppType.fromName(typeSpecifier.get(0))));
46    finished();
47  }
48}