<commit_before>package name.abuchen.portfolio.util;

import java.text.Collator;
import java.util.ArrayList;
import java.util.EnumSet;
import java.util.HashMap;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import java.util.Set;

import de.jollyday.HolidayCalendar;
import de.jollyday.HolidayManager;
import de.jollyday.ManagerParameters;
import name.abuchen.portfolio.Messages;

public final class TradeCalendarCode implements Comparable<TradeCalendarCode>
{
    public static final TradeCalendarCode EMPTY = new TradeCalendarCode(null, Messages.LabelApplyClientCalendar);
    private static final Map<String, TradeCalendarCode> CACHE = new HashMap<>();

    static
    {
        Set<HolidayCalendar> ignoreCalendar = EnumSet.of(HolidayCalendar.DOW_JONES_STOXX,
                        HolidayCalendar.LONDON_METAL_EXCHANGE, HolidayCalendar.NYSE, HolidayCalendar.TARGET);
        for (HolidayCalendar calendar : HolidayCalendar.values())
        {
            if (!ignoreCalendar.contains(calendar))
            {
                HolidayManager tradingDayManager = HolidayManager.getInstance(ManagerParameters.create(calendar));
                String calendarCode = calendar.toString();
                CACHE.put(calendarCode, new TradeCalendarCode(calendar.toString(),
                                tradingDayManager.getCalendarHierarchy().getDescription()));
            }
        }
    }

    private String calendarCode;
    private String displayName;

    private TradeCalendarCode(String calendarCode, String displayName)
    {
        this.calendarCode = calendarCode;
        this.displayName = displayName;
    }

    public static List<TradeCalendarCode> getAvailableCalendar()
    {
        return new ArrayList<>(CACHE.values());
    }

    public static TradeCalendarCode getInstance(String calendarCode)
    {
        return CACHE.get(calendarCode);
    }

    public String getCalendarCode()
    {
        return calendarCode;
    }

    public String getDisplayName()
    {<commit_msg>Security and SecurityChart with Calendar<commit_after>package name.abuchen.portfolio.util;

import java.text.Collator;
import java.util.ArrayList;
import java.util.EnumSet;
import java.util.HashMap;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import java.util.Set;

import de.jollyday.HolidayCalendar;
import de.jollyday.HolidayManager;
import de.jollyday.ManagerParameters;
import name.abuchen.portfolio.Messages;

public final class TradeCalendarCode implements Comparable<TradeCalendarCode>
{
    public static final TradeCalendarCode EMPTY = new TradeCalendarCode(null, Messages.LabelApplyClientCalendar);
    private static final Map<String, TradeCalendarCode> CACHE = new HashMap<>();

    static
    {
        for (HolidayCalendar calendar : HolidayCalendar.values())
        {
            HolidayManager tradingDayManager = HolidayManager.getInstance(ManagerParameters.create(calendar));
            String calendarCode = calendar.toString();
            CACHE.put(calendarCode, new TradeCalendarCode(calendar.toString(),
                            tradingDayManager.getCalendarHierarchy().getDescription()));
        }
    }

    private String calendarCode;
    private String displayName;

    private TradeCalendarCode(String calendarCode, String displayName)
    {
        this.calendarCode = calendarCode;
        this.displayName = displayName;
    }

    public static List<TradeCalendarCode> getAvailableCalendar()
    {
        return new ArrayList<>(CACHE.values());
    }

    public static TradeCalendarCode getInstance(String calendarCode)
    {
        return CACHE.get(calendarCode);
    }

    public String getCalendarCode()
    {
        return calendarCode;
    }

    public String getDisplayName()
    {
{'fraction_non_alphanumeric': 0.08234362628661916, 'fraction_numerical': 0.0, 'mean_word_length': 3.346330275229358, 'pattern_counts': {'":': 0, '<': 14, '<?xml version=': 0, '>': 14, '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': '7252557', 'n_tokens_mistral': 996, 'n_tokens_neox': 973, 'n_words': 212}