Class AbstractMetricsComputer<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 Implemented Interfaces:
    MetricsComputer<T,​O>

    @Deprecated
    public abstract class AbstractMetricsComputer<T extends QualifiableNode,​O extends QualifiableNode>
    extends Object
    implements MetricsComputer<T,​O>
    Deprecated.
    See package description
    Base class for metrics computers. These objects compute a metric and memoize it.
    Since:
    6.0.0
    Author:
    Clément Fournier
    • Constructor Detail

      • AbstractMetricsComputer

        public AbstractMetricsComputer()
        Deprecated.
    • Method Detail

      • computeForType

        public double computeForType​(MetricKey<T> key,
                                     T node,
                                     boolean force,
                                     MetricOptions options,
                                     MetricMemoizer<T> memoizer)
        Deprecated.
        Description copied from interface: MetricsComputer
        Computes the value of a metric for a class and stores the result in the ClassStats object.
        Specified by:
        computeForType in interface MetricsComputer<T extends QualifiableNode,​O extends QualifiableNode>
        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

        public double computeForOperation​(MetricKey<O> key,
                                          O node,
                                          boolean force,
                                          MetricOptions options,
                                          MetricMemoizer<O> memoizer)
        Deprecated.
        Description copied from interface: MetricsComputer
        Computes the value of a metric for an operation and stores the result in the OperationStats object.
        Specified by:
        computeForOperation in interface MetricsComputer<T extends QualifiableNode,​O extends QualifiableNode>
        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

        public double computeWithResultOption​(MetricKey<O> key,
                                              T node,
                                              boolean force,
                                              MetricOptions options,
                                              ResultOption option,
                                              ProjectMemoizer<T,​O> stats)
        Deprecated.
        Description copied from interface: MetricsComputer
        Computes an aggregate result using a ResultOption.
        Specified by:
        computeWithResultOption in interface MetricsComputer<T extends QualifiableNode,​O extends QualifiableNode>
        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
      • findOperations

        protected abstract List<O> findOperations​(T node)
        Deprecated.
        Finds the declaration nodes of all methods or constructors that are declared inside a class. This is language specific, as it depends on the AST.
        Parameters:
        node - The class in which to look for.
        Returns:
        The list of all operations declared inside the specified class.