java.lang.Object
java.lang.Enum<BlockType>
org.matwoess.jsourceprofiler.tool.model.BlockType
All Implemented Interfaces:
Serializable, Comparable<BlockType>, Constable

public enum BlockType extends Enum<BlockType>
This enum is used to represent the type for a code block.

Important to distinguish between different types of blocks for correct instrumentation and report generation.

  • Enum Constant Details

    • BLOCK

      public static final BlockType BLOCK
    • METHOD

      public static final BlockType METHOD
    • CONSTRUCTOR

      public static final BlockType CONSTRUCTOR
    • STATIC

      public static final BlockType STATIC
    • LOOP

      public static final BlockType LOOP
    • TRY

      public static final BlockType TRY
    • LAMBDA

      public static final BlockType LAMBDA
    • SWITCH_STMT

      public static final BlockType SWITCH_STMT
    • SWITCH_EXPR

      public static final BlockType SWITCH_EXPR
    • COLON_CASE

      public static final BlockType COLON_CASE
    • ARROW_CASE

      public static final BlockType ARROW_CASE
  • Method Details

    • values

      public static BlockType[] values()
      Returns an array containing the constants of this enum class, in the order they are declared.
      Returns:
      an array containing the constants of this enum class, in the order they are declared
    • valueOf

      public static BlockType valueOf(String name)
      Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (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 class has no constant with the specified name
      NullPointerException - if the argument is null
    • toString

      public String toString()
      Overrides:
      toString in class Enum<BlockType>
    • isSwitchBody

      public boolean isSwitchBody()
      Returns whether this block is a switch statement or switch expression body.
      Returns:
      true if the type is SWITCH_STMT or SWITCH_EXPR
    • isSwitchCase

      public boolean isSwitchCase()
      Returns whether this block is a switch case.
      Returns:
      true if the type is COLON_CASE or ARROW_CASE
    • isMethod

      public boolean isMethod()
      Returns whether this block is a method or constructor method.
      Returns:
      true if the type is METHOD or CONSTRUCTOR
    • hasCounter

      public boolean hasCounter()
      Returns whether this block will be instrumented with a counter.
      Returns:
      true if it is not a switch statement/expression body
    • hasNoBraces

      public boolean hasNoBraces()
      Returns whether this block has no opening and closing braces.
      Returns:
      true if the type is COLON_CASE