Class ReasonCounterSet

java.lang.Object
ai.attackframework.tools.burp.utils.ReasonCounterSet

public final class ReasonCounterSet extends Object
Thread-safe map-of-counters keyed by a short reason label.

Used wherever we want a small, reason-coded event tally (silent skips, traffic drops, ...). Keys are trimmed; null, blank, or non-positive counts are ignored so that hot-path callers do not need to guard each call. Snapshots are returned in a deterministic key order so the UI can render stable rows.

  • Constructor Details

    • ReasonCounterSet

      public ReasonCounterSet()
  • Method Details

    • record

      public void record(String reason, long count)
      Adds count to the counter for reason; ignored when inputs are invalid.
    • get

      public long get(String reason)
      Returns the counter for reason, or 0 when the key is absent or invalid.
    • snapshot

      public Map<String,Long> snapshot()
      Returns a sorted-by-key snapshot of the counters. The returned map is a live copy and may be iterated without synchronization; later updates are not reflected.
    • total

      public long total()
      Returns the sum across every counter; zero when the set is empty.
    • clear

      public void clear()
      Removes all counters.