<commit_before>package net.bugorfeature.basket.service;

import java.math.BigDecimal;
import java.util.Collection;
import java.util.HashMap;
import java.util.Map;

import net.bugorfeature.basket.model.ShoppingItem;


/**
 * Default static implementation of config service
 *
 * @author <NAME>
 */
public class StaticConfigService implements ConfigService {

    private Map<ShoppingItem, ShoppingItemConfig> config = new HashMap<>();


    @Override
    public BigDecimal getPriceForItem(ShoppingItem item) {

        ShoppingItemConfig configItem = config.get(item);

        if (configItem == null) {
            throw new IllegalArgumentException("Cannot find item: " + item);
        }

        return configItem.getPrice();
    }

    @Override
    public int getMinimumForItem(ShoppingItem item) {
        ShoppingItemConfig configItem = config.get(item);

        if (configItem == null) {
            throw new IllegalArgumentException("Cannot find item: " + item);
        }

        return configItem.getMinCount();
    }

    @Override
    public Collection<ShoppingItem> itemList() {
        return config.keySet();
    }

    public void setConfigForItem(ShoppingItem item, BigDecimal price, int minimum) {
        ShoppingItemConfig sig = new ShoppingItemConfig();
        sig.setBasketItem(item);
        sig.setPrice(price);
        sig.setMinCount(minimum);
        config.put(item, sig);
    }


    public void buildDefault() {
        for (ShoppingItem item : ShoppingItem.values()) {
            ShoppingItemConfig sig = new ShoppingItemConfig();
            sig.setBasketItem(item);
            sig.setPrice(new BigDecimal("0.10").multiply(new BigDecimal(Integer.toString(item.ordinal() + 1)))); // just dummy data
            sig.setMinCount(1);
            config.put(item, sig);
        }
    }


    public static class ShoppingItemConfig {

        private ShoppingItem basketItem;

        private int minCount;

        private BigDecimal price;

        public ShoppingItem getBasketItem() {
            return basketItem;
        }

        public void setBasketItem(ShoppingItem basketItem) {
            this.basketItem = basketItem;
        }

        public int getMinCount() {
            return minCount;
        }

        public void setMinCount(int minCount) {
            this.minCount = minCount;
        }

        public BigDecimal getPrice() {
            return price;
        }

        public void setPrice(BigDecimal price) {
            this.price = price;
        }
    }
}
<commit_msg>Remove unnecessary reference to shopping item from config item<commit_after>package net.bugorfeature.basket.service;

import java.math.BigDecimal;
import java.util.Collection;
import java.util.HashMap;
import java.util.Map;

import net.bugorfeature.basket.model.ShoppingItem;


/**
 * Default static implementation of config service
 *
 * @author <NAME>
 */
public class StaticConfigService implements ConfigService {

    private Map<ShoppingItem, ShoppingItemConfig> config = new HashMap<>();


    @Override
    public BigDecimal getPriceForItem(ShoppingItem item) {

        ShoppingItemConfig configItem = config.get(item);

        if (configItem == null) {
            throw new IllegalArgumentException("Cannot find item: " + item);
        }

        return configItem.getPrice();
    }

    @Override
    public int getMinimumForItem(ShoppingItem item) {
        ShoppingItemConfig configItem = config.get(item);

        if (configItem == null) {
            throw new IllegalArgumentException("Cannot find item: " + item);
        }

        return configItem.getMinCount();
    }

    @Override
    public Collection<ShoppingItem> itemList() {
        return config.keySet();
    }

    public void setConfigForItem(ShoppingItem item, BigDecimal price, int minimum) {
        ShoppingItemConfig sig = new ShoppingItemConfig();
        sig.setPrice(price);
        sig.setMinCount(minimum);
        config.put(item, sig);
    }


    public void buildDefault() {
        for (ShoppingItem item : ShoppingItem.values()) {
            ShoppingItemConfig sig = new ShoppingItemConfig();
            sig.setPrice(new BigDecimal("0.10").multiply(new BigDecimal(Integer.toString(item.ordinal() + 1)))); // just dummy data
            sig.setMinCount(1);
            config.put(item, sig);
        }
    }


    public static class ShoppingItemConfig {

        private int minCount;

        private BigDecimal price;

        public int getMinCount() {
            return minCount;
        }

        public void setMinCount(int minCount) {
            this.minCount = minCount;
        }

        public BigDecimal getPrice() {
            return price;
        }

        public void setPrice(BigDecimal price) {
            this.price = price;
        }
    }
}

{'fraction_non_alphanumeric': 0.09170305676855896, 'fraction_numerical': 0.002079434393844874, 'mean_word_length': 2.4210526315789473, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 11, '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': '6001334', 'n_tokens_mistral': 1320, 'n_tokens_neox': 1264, 'n_words': 312}