Interface MetricsComputer<T extends QualifiableNode,​O extends QualifiableNode>

  • Type Parameters:
    T - Type of type declaration nodes of the language
    O - Type of operation declaration nodes of the language
    All Known Implementing Classes:
    AbstractMetricsComputer

    @Deprecated
    public interface MetricsComputer<T extends QualifiableNode,​O extends QualifiableNode>
    Deprecated.
    See package description
    Basic interface for metrics computers that can compute metrics for types, operations and compute aggregate results with a result option. Computers should typically be separated from the storage units (ProjectMemoizer) to split responsibilities.
    Since:
    6.0.0
    Author:
    Clément Fournier
    • Method Detail

      • computeForType

        double computeForType​(MetricKey<T> key,
                              T node,
                              boolean force,
                              MetricOptions options,
                              MetricMemoizer<T> memoizer)
        Deprecated.
        Computes the value of a metric for a class and stores the result in the ClassStats object.
        Parameters:
        key - The class metric to compute
        node - The AST node of the class
        force - Force the recomputation; if unset, we'll first check for a memoized result
        options - The options of the metric to compute
        memoizer - The object memoizing the results
        Returns:
        The result of the computation, or Double.NaN if it couldn't be performed
      • computeForOperation

        double computeForOperation​(MetricKey<O> key,
                                   O node,
                                   boolean force,
                                   MetricOptions options,
                                   MetricMemoizer<O> memoizer)
        Deprecated.
        Computes the value of a metric for an operation and stores the result in the OperationStats object.
        Parameters:
        key - The operation metric to compute
        node - The AST node of the operation
        force - Force the recomputation; if unset, we'll first check for a memoized result
        options - The options of the metric to compute
        memoizer - The object memoizing the results
        Returns:
        The result of the computation, or Double.NaN if it couldn't be performed
      • computeWithResultOption

        double computeWithResultOption​(MetricKey<O> key,
                                       T node,
                                       boolean force,
                                       MetricOptions options,
                                       ResultOption option,
                                       ProjectMemoizer<T,​O> stats)
        Deprecated.
        Computes an aggregate result using a ResultOption.
        Parameters:
        key - The class metric to compute
        node - The AST node of the class
        force - Force the recomputation; if unset, we'll first check for a memoized result
        options - The options of the metric
        option - The type of result to compute
        stats - The ClassStats storing info about the class
        Returns:
        The result of the computation, or Double.NaN if it couldn't be performed