<commit_before>package me.devsaki.hentoid.activities.bundles;

import android.net.Uri;
import android.os.Bundle;

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

import javax.annotation.Nonnull;
import javax.annotation.Nullable;

import me.devsaki.hentoid.database.domains.Attribute;
import me.devsaki.hentoid.enums.AttributeType;
import me.devsaki.hentoid.util.AttributeMap;

public class SearchActivityBundle {
    private static final String KEY_ATTRIBUTE_TYPES = "attributeTypes";
    private static final String KEY_MODE = "mode";
    private static final String KEY_URI = "uri";

    private SearchActivityBundle() {
        throw new UnsupportedOperationException();
    }

    public static final class Builder {

        private final Bundle bundle = new Bundle();

        public void setAttributeTypes(AttributeType... attributeTypes) {
            ArrayList<Integer> attrTypes = new ArrayList<>();
            for (AttributeType type : attributeTypes) attrTypes.add(type.getCode());

            bundle.putIntegerArrayList(KEY_ATTRIBUTE_TYPES, attrTypes);
        }

        public void setMode(int mode) {
            bundle.putInt(KEY_MODE, mode);
        }

        public Builder setUri(Uri uri) {
            bundle.putString(KEY_URI, uri.toString());
            return this;
        }

        public static Uri buildSearchUri(List<Attribute> attributes) {
            AttributeMap metadataMap = new AttributeMap();
            metadataMap.addAll(attributes);

            Uri.Builder searchUri = new Uri.Builder()
                    .scheme("search")
                    .authority("hentoid");

            for (AttributeType attrType : metadataMap.keySet()) {
                List<Attribute> attrs = metadataMap.get(attrType);
                for (Attribute attr : attrs)
                    searchUri.appendQueryParameter(attrType.name(), attr.getId() + ";" + attr.getName());
            }
            return searchUri.build();
        }

        public Bundle getBundle() {
            return bundle;
        }
    }

    public static final class Parser {

        private final Bundle bundle;

        public Parser(@Nonnull Bundle bundle) {
            this.bundle = bundle;
        }

        public List<AttributeType> getAttributeTypes() {
            List<AttributeType> result = new ArrayList<>();
<commit_msg>Attempt to change keySet() to entrySet()<commit_after>package me.devsaki.hentoid.activities.bundles;

import android.net.Uri;
import android.os.Bundle;

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

import javax.annotation.Nonnull;
import javax.annotation.Nullable;

import me.devsaki.hentoid.database.domains.Attribute;
import me.devsaki.hentoid.enums.AttributeType;
import me.devsaki.hentoid.util.AttributeMap;

public class SearchActivityBundle {
    private static final String KEY_ATTRIBUTE_TYPES = "attributeTypes";
    private static final String KEY_MODE = "mode";
    private static final String KEY_URI = "uri";

    private SearchActivityBundle() {
        throw new UnsupportedOperationException();
    }

    public static final class Builder {

        private final Bundle bundle = new Bundle();

        public void setAttributeTypes(AttributeType... attributeTypes) {
            ArrayList<Integer> attrTypes = new ArrayList<>();
            for (AttributeType type : attributeTypes) attrTypes.add(type.getCode());

            bundle.putIntegerArrayList(KEY_ATTRIBUTE_TYPES, attrTypes);
        }

        public void setMode(int mode) {
            bundle.putInt(KEY_MODE, mode);
        }

        public Builder setUri(Uri uri) {
            bundle.putString(KEY_URI, uri.toString());
            return this;
        }

        public static Uri buildSearchUri(List<Attribute> attributes) {
            AttributeMap metadataMap = new AttributeMap();
            metadataMap.addAll(attributes);

            Uri.Builder searchUri = new Uri.Builder()
                    .scheme("search")
                    .authority("hentoid");
            for (Map.Entry<AttributeType,List<Attribute>> entry : metadataMap.entrySet()) {
                AttributeType attrType = entry.getKey();
                List<Attribute> list = entry.getValue();
                for (Attribute attr : list)
                    searchUri.appendQueryParameter(attrType.name(), attr.getId() + ";" + attr.getName());
            }
            return searchUri.build();
        }

        public Bundle getBundle() {
            return bundle;
        }
    }

    public static final class Parser {

        private final Bundle bundle;

        public Parser(@Nonnull Bundle bundle) {
            this.bundle = bundle;
        }

        public List<AttributeType> getAttributeTypes() {
            List<AttributeType> result = new ArrayList<>();

{'fraction_non_alphanumeric': 0.09472372247611134, 'fraction_numerical': 0.0, 'mean_word_length': 2.436830835117773, 'pattern_counts': {'":': 0, '<': 19, '<?xml version=': 0, '>': 19, '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': '1922185', 'n_tokens_mistral': 1250, 'n_tokens_neox': 1213, 'n_words': 300}