Skip to content

Add KDoc documentation to Cache averaging algorithm#600

Closed
gioalex07 wants to merge 2 commits intoVREMSoftwareDevelopment:mainfrom
gioalex07:docs/cache-averaging-algorithm
Closed

Add KDoc documentation to Cache averaging algorithm#600
gioalex07 wants to merge 2 commits 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.

gioalex07 and others added 2 commits April 2, 2026 18:08
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.
@VREMSoftwareDevelopment
Copy link
Copy Markdown
Owner

Thank you for the submission.

This PR will not be merged. The added comments do not improve readability, maintainability, or functionality. They restate what the code already expresses and do not clarify intent, behavior, or design decisions.

The project does not accept changes that add noise without providing a clear benefit to the UI/UX, code quality, or user experience.

@codecov
Copy link
Copy Markdown

codecov bot commented Apr 4, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 97.83%. Comparing base (bd25b4d) to head (05c6c27).

Additional details and impacted files
@@            Coverage Diff            @@
##               main     #600   +/-   ##
=========================================
  Coverage     97.83%   97.83%           
  Complexity      975      975           
=========================================
  Files           121      121           
  Lines          2581     2581           
  Branches        211      211           
=========================================
  Hits           2525     2525           
  Misses           19       19           
  Partials         37       37           
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

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.

2 participants