Enum Metric

  • All Implemented Interfaces:
    Serializable, Comparable<Metric>

    public enum Metric
    extends Enum<Metric>
    A coverage metric to identify the coverage result type. Note the enum order since the ordinal is used to sort the values for display purposes.
    Author:
    Ullrich Hafner
    • Enum Constant Detail

      • CONTAINER

        public static final Metric CONTAINER
        Nodes that can have children.
      • MODULE

        public static final Metric MODULE
      • PACKAGE

        public static final Metric PACKAGE
      • FILE

        public static final Metric FILE
      • CLASS

        public static final Metric CLASS
      • METHOD

        public static final Metric METHOD
      • LINE

        public static final Metric LINE
        Coverage values without children.
      • BRANCH

        public static final Metric BRANCH
      • INSTRUCTION

        public static final Metric INSTRUCTION
      • MUTATION

        public static final Metric MUTATION
        Additional metrics without children.
      • COMPLEXITY

        public static final Metric COMPLEXITY
      • COMPLEXITY_MAXIMUM

        public static final Metric COMPLEXITY_MAXIMUM
      • COMPLEXITY_DENSITY

        public static final Metric COMPLEXITY_DENSITY
      • LOC

        public static final Metric LOC
    • Method Detail

      • values

        public static Metric[] values()
        Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:
        for (Metric c : Metric.values())
            System.out.println(c);
        
        Returns:
        an array containing the constants of this enum type, in the order they are declared
      • valueOf

        public static Metric valueOf​(String name)
        Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)
        Parameters:
        name - the name of the enum constant to be returned.
        Returns:
        the enum constant with the specified name
        Throws:
        IllegalArgumentException - if this enum type has no constant with the specified name
        NullPointerException - if the argument is null
      • fromTag

        public static Metric fromTag​(String tag)
        Returns the metric that belongs to the specified tag.
        Parameters:
        tag - the tag
        Returns:
        the metric
        See Also:
        toTagName()
      • isContainer

        public boolean isContainer()
        Returns if a given metric is a node metric.
        Returns:
        if the metric is a node metric
      • toTagName

        public String toTagName()
        Returns the name of the metric as a tag, containing only lowercase characters and dashes.
        Returns:
        the metric tag name
      • getValueFor

        public Optional<Value> getValueFor​(Node node)
        Returns the aggregated value of this metric for the specified tree of nodes.
        Parameters:
        node - the root of the tree
        Returns:
        the aggregated value