Skip to content

Add KDoc documentation to Cache averaging algorithm#600

Open
gioalex07 wants to merge 1 commit intoVREMSoftwareDevelopment:mainfrom
gioalex07:docs/cache-averaging-algorithm
Open

Add KDoc documentation to Cache averaging algorithm#600
gioalex07 wants to merge 1 commit intoVREMSoftwareDevelopment:mainfrom
gioalex07:docs/cache-averaging-algorithm

Conversation

@gioalex07
Copy link
Copy Markdown

Document the exponential moving average used in calculate(), the cache depth strategy in size() based on scan speed thresholds, the eviction logic in add(), and the purpose of CacheResult. No logic changes.

Summary

  • Add KDoc documentation to Cache.kt explaining the averaging algorithm and cache sizing strategy.
  • No logic changes — documentation only.

What does this implement/fix?

  • CacheResult: documents purpose of the class
  • scanResults(): documents the grouping and averaging behavior per unique access point (BSSID + SSID)
  • add(): documents eviction strategy and internal count cycle
  • size(): documents all scan speed thresholds and their effect on cache depth
  • calculate(): documents the exponential moving average formula (previous + current) / 2 and the signal penalty applied when screen size is unavailable

Does this close any issues?

  • N/A (documentation improvement)

How was this tested?

  • Platform: WSL2 / AlmaLinux 9
  • Build variant: debug
  • Toolchain: JDK 21 (Zulu), Gradle 9.3.1, Android SDK 36
./gradlew ktlintCheck       → BUILD SUCCESSFUL
./gradlew testDebugUnitTest → BUILD SUCCESSFUL

Checklist (required before marking ready)

  • I added or updated unit tests (see app/src/test/) — N/A, documentation only
  • I followed the project's coding style (ktlint) and formatting
  • I ran lint and addressed or documented any warnings
  • CI checks pass (unit tests, coverage, lint)
  • No sensitive data, keys, or secrets are included

Additional context

The calculate() method used an exponential moving average without any inline explanation,
making it non-obvious why (accumulator + element) / 2 was chosen over a true N-sample average.
The size() thresholds were also implicit. This PR makes both strategies explicit for future contributors.

Document the exponential moving average used in calculate(),
the cache depth strategy in size() based on scan speed thresholds,
the eviction logic in add(), and the purpose of CacheResult.
No logic changes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant