PageRenderTime 5ms CodeModel.GetById 2ms app.highlight 1ms RepoModel.GetById 1ms app.codeStats 0ms

/testability-explorer/src/main/java/com/google/test/metric/Reason.java

http://testability-explorer.googlecode.com/
Java | 48 lines | 20 code | 5 blank | 23 comment | 0 complexity | 0a4d8160c88a067aaea7d24c9e7da249 MD5 | raw file
 1/*
 2 * Copyright 2009 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;
17
18/** This attempts to answer "What is the source of each line's cost?" */
19public enum Reason {
20  IMPLICIT_CONSTRUCTOR("implicit cost from construction", true),
21  //
22  IMPLICIT_SETTER("implicit cost calling all setters", true),
23  //
24  IMPLICIT_STATIC_INIT("implicit cost from static initialization", true),
25  //
26  NON_OVERRIDABLE_METHOD_CALL("cost from calling non-overridable method", false);
27  // TODO(jwolter): be able to tell people why this method could not be overridden:
28  // whether it is static, private or final.
29  // SOMEDAY(jwolter): it would be nice to make static methods worse than others. Because we don't
30  // want to encourage people to subclass for tests.
31
32  private final String description;
33  private final boolean isImplicit;
34
35  private Reason(String description, boolean implicit) {
36    this.description = description;
37    isImplicit = implicit;
38  }
39
40  @Override
41  public String toString() {
42    return description;
43  }
44
45  public boolean isImplicit() {
46    return isImplicit;
47  }
48}