<commit_before>package fr.free.nrw.commons.caching;

import android.content.Context;
import android.util.Log;

import java.util.ArrayList;
import java.util.List;

import fr.free.nrw.commons.upload.MwVolleyApi;

public class CacheController {

    private Context context;
    private double x;
    private double y;
    private QuadTree quadTree;
    private Point[] pointsFound;
    private double xMinus, xPlus, yMinus, yPlus;

    public CacheController() {
        quadTree = new QuadTree(-180, -90, +180, +90);
    }


    public void setQtPoint(double decLongitude, double decLatitude) {
        x = decLongitude;
        y = decLatitude;
        Log.d("Cache", "New QuadTree created");
        Log.d("Cache", "X (longitude) value: " + x + ", Y (latitude) value: " + y);
    }


    public void cacheCategory() {

        List<String> pointCatList = new ArrayList<String>();
        if (MwVolleyApi.GpsCatExists.getGpsCatExists() == true) {
             pointCatList.addAll(MwVolleyApi.getGpsCat());
            Log.d("Cache", "Categories being cached: " + pointCatList);
        } else {
            Log.d("Cache", "No categories found, so no categories cached");
        }
        quadTree.set(x, y, pointCatList);
    }

    public List findCategory() {

        //TODO: Convert decLatitude and decLongitude to a range with proper formula, for testing just use 10
        convertCoordRange();
        pointsFound = quadTree.searchWithin(xMinus, yMinus, xPlus, yPlus);<commit_msg>Added documentation<commit_after>package fr.free.nrw.commons.caching;

import android.content.Context;
import android.util.Log;

import java.util.ArrayList;
import java.util.List;

import fr.free.nrw.commons.upload.MwVolleyApi;

public class CacheController {

    private Context context;
    private double x;
    private double y;
    private QuadTree quadTree;
    private Point[] pointsFound;
    private double xMinus, xPlus, yMinus, yPlus;

    public CacheController() {
        quadTree = new QuadTree(-180, -90, +180, +90);
    }


    public void setQtPoint(double decLongitude, double decLatitude) {
        x = decLongitude;
        y = decLatitude;
        Log.d("Cache", "New QuadTree created");
        Log.d("Cache", "X (longitude) value: " + x + ", Y (latitude) value: " + y);
    }


    public void cacheCategory() {

        List<String> pointCatList = new ArrayList<String>();
        if (MwVolleyApi.GpsCatExists.getGpsCatExists() == true) {
             pointCatList.addAll(MwVolleyApi.getGpsCat());
            Log.d("Cache", "Categories being cached: " + pointCatList);
        } else {
            Log.d("Cache", "No categories found, so no categories cached");
        }
        quadTree.set(x, y, pointCatList);
    }

    public List findCategory() {

        //Convert decLatitude and decLongitude to a coordinate offset range 
        convertCoordRange();
        pointsFound = quadTree.searchWithin(xMinus, yMinus, xPlus, yPlus);
{'fraction_non_alphanumeric': 0.11322033898305085, 'fraction_numerical': 0.007457627118644068, 'mean_word_length': 2.8828947368421054, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1695261', 'n_tokens_mistral': 923, 'n_tokens_neox': 879, 'n_words': 233}