Class JavaMetrics


  • public final class JavaMetrics
    extends java.lang.Object
    User bound façade of the Metrics Framework. Provides a uniform interface for the calculation of metrics.
    Author:
    Clément Fournier
    • Method Summary

      All Methods Static Methods Concrete Methods Deprecated Methods 
      Modifier and Type Method Description
      static double get​(net.sourceforge.pmd.lang.metrics.MetricKey<ASTAnyTypeDeclaration> key, ASTAnyTypeDeclaration node)
      Computes the standard value of the metric identified by its code on a class AST node.
      static double get​(net.sourceforge.pmd.lang.metrics.MetricKey<ASTAnyTypeDeclaration> key, ASTAnyTypeDeclaration node, net.sourceforge.pmd.lang.metrics.MetricOptions options)
      Computes a metric identified by its code on a class AST node, possibly selecting a variant with the MetricOptions parameter.
      static double get​(net.sourceforge.pmd.lang.metrics.MetricKey<MethodLikeNode> key, ASTAnyTypeDeclaration node, net.sourceforge.pmd.lang.metrics.MetricOptions options, net.sourceforge.pmd.lang.metrics.ResultOption resultOption)
      Compute the sum, average, or highest value of the operation metric on all operations of the class node.
      static double get​(net.sourceforge.pmd.lang.metrics.MetricKey<MethodLikeNode> key, ASTAnyTypeDeclaration node, net.sourceforge.pmd.lang.metrics.ResultOption resultOption)
      Compute the sum, average, or highest value of the standard operation metric on all operations of the class node.
      static double get​(net.sourceforge.pmd.lang.metrics.MetricKey<MethodLikeNode> key, ASTMethodOrConstructorDeclaration node)
      Deprecated.
      Provided here for backwards binary compatibility with get(MetricKey, MethodLikeNode).
      static double get​(net.sourceforge.pmd.lang.metrics.MetricKey<MethodLikeNode> key, ASTMethodOrConstructorDeclaration node, net.sourceforge.pmd.lang.metrics.MetricOptions options)
      Deprecated.
      Provided here for backwards binary compatibility with get(MetricKey, MethodLikeNode, MetricOptions).
      static double get​(net.sourceforge.pmd.lang.metrics.MetricKey<MethodLikeNode> key, MethodLikeNode node)
      Computes the standard version of the metric identified by the key on a operation AST node.
      static double get​(net.sourceforge.pmd.lang.metrics.MetricKey<MethodLikeNode> key, MethodLikeNode node, net.sourceforge.pmd.lang.metrics.MetricOptions options)
      Computes a metric identified by its key on a operation AST node.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • get

        public static double get​(net.sourceforge.pmd.lang.metrics.MetricKey<ASTAnyTypeDeclaration> key,
                                 ASTAnyTypeDeclaration node)
        Computes the standard value of the metric identified by its code on a class AST node.
        Parameters:
        key - The key identifying the metric to be computed
        node - The node on which to compute the metric
        Returns:
        The value of the metric, or Double.NaN if the value couldn't be computed
      • get

        public static double get​(net.sourceforge.pmd.lang.metrics.MetricKey<ASTAnyTypeDeclaration> key,
                                 ASTAnyTypeDeclaration node,
                                 net.sourceforge.pmd.lang.metrics.MetricOptions options)
        Computes a metric identified by its code on a class AST node, possibly selecting a variant with the MetricOptions parameter.
        Parameters:
        key - The key identifying the metric to be computed
        node - The node on which to compute the metric
        options - The options of the metric
        Returns:
        The value of the metric, or Double.NaN if the value couldn't be computed
      • get

        public static double get​(net.sourceforge.pmd.lang.metrics.MetricKey<MethodLikeNode> key,
                                 MethodLikeNode node)
        Computes the standard version of the metric identified by the key on a operation AST node.
        Parameters:
        key - The key identifying the metric to be computed
        node - The node on which to compute the metric
        Returns:
        The value of the metric, or Double.NaN if the value couldn't be computed
      • get

        public static double get​(net.sourceforge.pmd.lang.metrics.MetricKey<MethodLikeNode> key,
                                 MethodLikeNode node,
                                 net.sourceforge.pmd.lang.metrics.MetricOptions options)
        Computes a metric identified by its key on a operation AST node.
        Parameters:
        key - The key identifying the metric to be computed
        node - The node on which to compute the metric
        options - The options of the metric
        Returns:
        The value of the metric, or Double.NaN if the value couldn't be computed
      • get

        public static double get​(net.sourceforge.pmd.lang.metrics.MetricKey<MethodLikeNode> key,
                                 ASTAnyTypeDeclaration node,
                                 net.sourceforge.pmd.lang.metrics.ResultOption resultOption)
        Compute the sum, average, or highest value of the standard operation metric on all operations of the class node. The type of operation is specified by the ResultOption parameter.
        Parameters:
        key - The key identifying the metric to be computed
        node - The node on which to compute the metric
        resultOption - The result option to use
        Returns:
        The value of the metric, or Double.NaN if the value couldn't be computed
      • get

        public static double get​(net.sourceforge.pmd.lang.metrics.MetricKey<MethodLikeNode> key,
                                 ASTAnyTypeDeclaration node,
                                 net.sourceforge.pmd.lang.metrics.MetricOptions options,
                                 net.sourceforge.pmd.lang.metrics.ResultOption resultOption)
        Compute the sum, average, or highest value of the operation metric on all operations of the class node. The type of operation is specified by the ResultOption parameter.
        Parameters:
        key - The key identifying the metric to be computed
        node - The node on which to compute the metric
        resultOption - The result option to use
        options - The version of the metric
        Returns:
        The value of the metric, or Double.NaN if the value couldn't be computed