<commit_before>/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package Bar;

import java.util.HashMap;
import java.util.LinkedList;
import javax.ejb.Stateful;
import org.apache.commons.collections4.queue.CircularFifoQueue;

/**
 *
 * @author wukat
 */
@Stateful(name="Barman")
public class Barman implements BarmanLocal {

    private BarLocal bar;
    private CircularFifoQueue<Order> events;
    
    @Override
    public void setBar(BarLocal bar) {
        this.bar = bar;
    }    
    
    @Override
    public LinkedList<String> placeOrder(String kind, String productName) {
        switch (kind)  {
            case "Drink":
                return listOfIngredients(bar.makeDrink(productName).getIngredients());
            case "Beer":
                return listOfIngredients(bar.makeBeer(productName).getIngredients());
            default:
                return new LinkedList<>();
        }
    }
    
    private LinkedList<String> listOfIngredients(HashMap<String, Integer> ingredients) {
        LinkedList<String> result = new LinkedList<>();
        for (String product : ingredients.keySet()) {
            result.add(product + " " + ingredients.get(product).toString() + "\n");
        }
        return result;
    }
}<commit_msg>barman order<commit_after>/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package Bar;

import java.util.HashMap;
import java.util.LinkedList;
import javax.ejb.Stateful;
import org.apache.commons.collections4.queue.CircularFifoQueue;

/**
 *
 * @author wukat
 */
@Stateful(name="Barman")
public class Barman implements BarmanLocal {

    private BarLocal bar;
    private CircularFifoQueue<Order> events;
    
    @Override
    public void setBar(BarLocal bar) {
        this.bar = bar;
    }    
    
    @Override
    public LinkedList<String> placeOrder(String kind, String productName) {
        switch (kind)  {
            case "drink":
                return listOfIngredients(bar.makeDrink(productName).getIngredients());
            case "beer":
                return listOfIngredients(bar.makeBeer(productName).getIngredients());
            default:
                return new LinkedList<>();
        }
    }
    
    private LinkedList<String> listOfIngredients(HashMap<String, Integer> ingredients) {
        LinkedList<String> result = new LinkedList<>();
        for (String product : ingredients.keySet()) {
            result.add(product + " " + ingredients.get(product).toString() + "\n");
        }
        return result;
    }
}
{'fraction_non_alphanumeric': 0.1045045045045045, 'fraction_numerical': 0.0007207207207207207, 'mean_word_length': 2.6914893617021276, 'pattern_counts': {'":': 4, '<': 17, '<?xml version=': 0, '>': 17, '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': '2122993', 'n_tokens_mistral': 793, 'n_tokens_neox': 773, 'n_words': 195}