PageRenderTime 13ms CodeModel.GetById 10ms app.highlight 1ms RepoModel.GetById 1ms app.codeStats 0ms

/testability-explorer/src/main/java/com/google/test/metric/method/op/stack/MultiANewArrayIns.java

http://testability-explorer.googlecode.com/
Java | 39 lines | 30 code | 9 blank | 0 comment | 1 complexity | faa561c3ad352cb1f83bee729d91358b MD5 | raw file
 1package com.google.test.metric.method.op.stack;
 2
 3import java.util.List;
 4
 5import com.google.test.metric.Type;
 6import com.google.test.metric.Variable;
 7import com.google.test.metric.method.Constant;
 8
 9public class MultiANewArrayIns extends StackOperation {
10
11  private final Type clazz;
12  private final int dims;
13
14  public MultiANewArrayIns(int lineNumber, Type clazz, int dims) {
15    super(lineNumber);
16    this.clazz = clazz;
17    this.dims = dims;
18  }
19
20  @Override
21  public int getOperatorCount() {
22    return dims;
23  }
24
25  @Override
26  public List<Variable> apply(List<Variable> input) {
27    Type array = clazz;
28    for (int i = 0; i < dims; i++) {
29      array = array.toArray();
30    }
31    return list(new Constant("?", array));
32  }
33
34  @Override
35  public String toString() {
36    return "MultiANewArray dims=" + dims;
37  }
38
39}