java.lang.Object
org.matwoess.jsourceprofiler.tool.model.CodeRegion
All Implemented Interfaces:
Serializable, Component

public class CodeRegion extends Object implements Serializable, Component
Class for a group of statements, inside a block, sharing one hit-count value.

Used to correctly determine the hit-count for a line of code and for visualization in the report.

A list of dependent control break blocks is used to correctly calculate the effective hit-count of the current region. When a block is reentered after a control break block, we need to subtract the hits of this block to calculate the real count of the new region. This is because we do not have an actual counter after breaks, continues and returns, etc.

See Also:
  • Field Details

    • id

      public int id
    • beg

      public CodePosition beg
    • end

      public CodePosition end
    • block

      public Block block
      The block this region belongs to.
    • dependentBlocks

      public final List<Block> dependentBlocks
      The list of dependent control break blocks, used to calculate the effective hit-count of the current region.
  • Constructor Details

    • CodeRegion

      public CodeRegion()
  • Method Details

    • getHitCount

      public long getHitCount()
      Gets the effective hit-count of this region.
      Returns:
      the parent block's hits minus the sum of hits form all dependent control break blocks
    • toString

      public String toString()
      Overrides:
      toString in class Object