# Class Metrics::UnitMetrics

## Direct supertypes

## Indirect supertypes

## Known direct subtypes

## Predicates

getHalsteadDeliveredBugs | Get the Halstead ‘delivered bugs’ metric for this unit. This metric correlates with the complexity of the software, but is known to be an underestimate of bug counts. |

getHalsteadDifficulty | Get the Halstead difficulty value of this unit. This is proportional to the number of unique operators, and further proportional to the ratio of total operands to unique operands. |

getHalsteadEffort | Get the Halstead implementation effort for this unit. This is the product of the volume and difficulty. |

getHalsteadLength | Get the Halstead length of this unit. This is the sum of the N1 and N2 Halstead metrics. |

getHalsteadN1 | the total number of operators in this unit |

getHalsteadN2 | the total number of operators in this unit |

getHalsteadVocabulary | Get the Halstead vocabulary size of this unit. This is the sum of the n1 and n2 Halstead metrics |

getHalsteadVolume | Get the Halstead volume of this unit. This is the Halstead size multiplied by the log of the Halstead vocabulary. It represents the information content of the function. |

getHalsteadn1Distinct | the number of distinct operators in this unit |

getHalsteadn2Distinct | the number of distinct operands in this unit |

getNumberOfStmts | the number of statements in this unit |

getStatementNestingDepth | Get the maximum nesting depth of statements in this unit. |

toString |

## Inherited predicates

getASuccessor | Get any possible successor in the progam’s control flow. | from AstNode |

getEnclosingText | Get the unit containing this element. | from AstNode |

getEnclosingUnit | Get the unit containing this element. | from AstNode |

getHeader | Get the header of this | from Unit_ |

getLocation | Get this element’s location. | from Locatable |

getMetrics | Get the metrics for this unit | from Unit |

getNumLines | Get the number of lines covered by this element. | from Locatable |

getNumberOfLines | the number of lines in this file | from SourceLine |

getNumberOfLinesOfCode | the number of lines containing code in this file | from SourceLine |

getNumberOfLinesOfComments | the number of lines containing comments in this file | from SourceLine |

getNumberOfLinesOfWater | the number of lines containing water in this file | from SourceLine |

getParent | from Unit_ | |

getProgramDefinition | Get the program definition containing this unit. If the unit is a program definition, return the unit itself. | from Unit |

hasAncestor | Does this AstNode have ‘other’ as a ancestor? | from AstNode |

hasDescendant | Does this AstNode have ‘other’ as a descendant? | from AstNode |