For the complete documentation index, see llms.txt. This page is also available as Markdown.

Risk Level

RiskLevel is an enumeration class used to evaluate the risk status of system components or events. It dynamically determines and returns a risk level by analyzing a given severity value (severity) against a specific boundary limit (threshold).

Enum Constants

The class represents 4 distinct risk levels, ordered from lowest to highest:

  • SAFE: No risk detected; the system or component is operating normally.

  • LOW: Low-priority risk; requires basic monitoring.

  • MEDIUM: Moderate risk; may require mitigation planning.

  • HIGH: Critical risk; requires immediate attention or automated intervention.

Static Methods

getLevel(severity: Int, threshold: Int): RiskLevel

A factory/utility method defined inside the companion object. It can be called directly using the class name (RiskLevel.getLevel(...)) without instantiating the class.

Parameters

Parameter
Type
Description

severity

Int

The numerical representation of the current error, threat, or system load.

threshold

Int

The critical boundary limit that triggers the HIGH risk level.

Risk Level

enum class RiskLevel {
    SAFE,
    LOW,
    MEDIUM,
    HIGH;

    companion object {

        fun getLevel(severity: Int, threshold: Int): RiskLevel = when {
            severity == 0 -> SAFE
            severity >= threshold -> HIGH
            severity >= (threshold / 2) -> MEDIUM
            severity > 0 -> LOW
            else -> SAFE
        }
    }
}

Last updated