• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright 2018, OpenCensus Authors
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 package io.opencensus.common;
18 
19 /*>>>
20 import org.checkerframework.checker.nullness.qual.Nullable;
21 */
22 
23 /**
24  * Represents a function that produces a double-valued result. See {@link
25  * io.opencensus.metrics.MetricRegistry} for an example of its use.
26  *
27  * <p>Note: This class is based on the java.util.ToDoubleFunction class added in Java 1.8. We cannot
28  * use the Function from Java 1.8 because this library is Java 1.6 compatible.
29  *
30  * @since 0.16
31  */
32 public interface ToDoubleFunction</*@Nullable*/ T> {
33 
34   /**
35    * Applies this function to the given argument.
36    *
37    * @param value the function argument.
38    * @return the function result.
39    */
applyAsDouble( T value)40   double applyAsDouble(/*@Nullable*/ T value);
41 }
42