<commit_before>package nl.fontys.sofa.limo.view.util;

import java.awt.Image;
import java.io.File;
import java.io.IOException;
import java.util.HashMap;
import javax.imageio.ImageIO;
import nl.fontys.sofa.limo.domain.category.TimeCategory;

/**
 *
 * @author <NAME> <<EMAIL>>
 */
public class IconUtil {
    
    private static boolean isSetUp = false;
    private static HashMap<Class, IconHolder> icons;
    
    private IconUtil() {}
    
    public static Image getIcon(Class clazz, int type) {
        if (!isSetUp) {
            setUp();
        }
        
        IconHolder ih = icons.get(clazz);
        Image i = ih.getIcon(type);
        return i;
    }
    
    private static void setUp() {
        icons = new HashMap<>();
        
        icons.put(TimeCategory.class, new IconHolder("TimeCategory"));
        
        isSetUp = true;
    }
    
    /**
     * Private class for a class' different icons. Hold an Image for each possible icon.
     * Uses Lazy Loading.
     */
    private static class IconHolder {
        private static final String ICON_COLOR_16x16 = "_16x16.png";
        private static final String ICON_COLOR_32x32 = "_16x16.png";
        private static final String ICON_MONO_16x16 = "_SW_16x16.png";
        private static final String ICON_MONO_32x32 = "_SW_16x16.png";
        
        private final String filename;
        private final HashMap<Integer, Image> iconsPerType;

        /**
         * Construct new IconHolder.
         * @param filename Filename of icon without extension.
         */
        public IconHolder(String filename) {
            this.filename = filename;
            this.iconsPerType = new HashMap<>();
        }
        
        /**
         * Get Icon for specified type of BeanInfo. Used for nodes.
         * @param type BeanInfo.Type.
         * @return Image icon.<commit_msg>- Added other icons<commit_after>package nl.fontys.sofa.limo.view.util;

import java.awt.Image;
import java.io.File;
import java.io.IOException;
import java.util.HashMap;
import javax.imageio.ImageIO;
import nl.fontys.sofa.limo.domain.category.CostCategory;
import nl.fontys.sofa.limo.domain.category.TimeCategory;
import nl.fontys.sofa.limo.domain.component.Event;
import nl.fontys.sofa.limo.domain.types.HubType;
import nl.fontys.sofa.limo.domain.types.LegType;

/**
 *
 * @author <NAME> <<EMAIL>>
 */
public class IconUtil {
    
    private static boolean isSetUp = false;
    private static HashMap<Class, IconHolder> icons;
    
    private IconUtil() {}
    
    public static Image getIcon(Class clazz, int type) {
        if (!isSetUp) {
            setUp();
        }
        
        IconHolder ih = icons.get(clazz);
        Image i = ih.getIcon(type);
        return i;
    }
    
    private static void setUp() {
        icons = new HashMap<>();
        
        icons.put(TimeCategory.class, new IconHolder("TimeCategory"));
        icons.put(CostCategory.class, new IconHolder("CostCategory"));
        icons.put(LegType.class, new IconHolder("LegType"));
        icons.put(HubType.class, new IconHolder("HubType"));
        icons.put(Event.class, new IconHolder("Event"));
        
        isSetUp = true;
    }
    
    /**
     * Private class for a class' different icons. Hold an Image for each possible icon.
     * Uses Lazy Loading.
     */
    private static class IconHolder {
        private static final String ICON_COLOR_16x16 = "_16x16.png";
        private static final String ICON_COLOR_32x32 = "_16x16.png";
        private static final String ICON_MONO_16x16 = "_SW_16x16.png";
        private static final String ICON_MONO_32x32 = "_SW_16x16.png";
        
        private final String filename;
        private final HashMap<Integer, Image> iconsPerType;

        /**
         * Construct new IconHolder.
         * @param filename Filename of icon without extension.
         */
        public IconHolder(String filename) {
            this.filename = filename;
            this.iconsPerType = new HashMap<>();
        }
        
        /**
         * Get Icon for specified type of BeanInfo. Used for nodes.
         * @param type BeanInfo.Type.
         * @return Image icon.
{'fraction_non_alphanumeric': 0.10095923261390888, 'fraction_numerical': 0.015347721822541967, 'mean_word_length': 2.2560499609679936, 'pattern_counts': {'":': 0, '<': 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': '5397597', 'n_tokens_mistral': 1258, 'n_tokens_neox': 1224, 'n_words': 322}