Interface Metric<N extends Node>

  • Type Parameters:
    N - Type of nodes the metric can be computed on
    All Known Implementing Classes:
    AbstractMetric

    public interface Metric<N extends Node>
    Object computing a metric on a node. Metric objects are stateless, which means that instances of the same metric are all equal.
    Since:
    6.0.0
    Author:
    Clément Fournier
    • Method Detail

      • supports

        boolean supports​(N node)
        Checks if the metric can be computed on the node.
        Parameters:
        node - The node to check
        Returns:
        True if the metric can be computed
      • computeFor

        double computeFor​(N node,
                          MetricOptions options)
        Actually computes the value of a metric for an AST node.
        Parameters:
        node - The node
        options - The options of the metric
        Returns:
        The value of the metric, or Double.NaN if it could not be computed.