<commit_before>package org.wso2.carbon.uuf.handlebars.helpers.runtime;

import com.github.jknack.handlebars.Helper;
import com.github.jknack.handlebars.Options;

import java.io.IOException;
import java.util.ArrayList;
import java.util.List;

public class ResourceHelper implements Helper<String> {

    public static ResourceHelper JS_INSTANCE = new ResourceHelper("headJs");
    private final String resourceKey;

    private ResourceHelper(String resourceType) {
        resourceKey = ResourceHelper.class.getName() + "#" + resourceType;
    }

    @Override
    public CharSequence apply(String uri, Options options) throws IOException {
        if (uri.startsWith("/")) {
            throw new IllegalArgumentException("URI fragment relative public URI should start with '/'");
        }
        List<String> resources = options.data(resourceKey);
        if (resources == null) {
            resources = new ArrayList<>();
            options.data(resourceKey, resources);
        }
        resources.add(uri);
        return "";
    }

    public String getResourceKey() {
        return resourceKey;
    }
}<commit_msg>added get*Instance methods to get Handlebars Helper instances of 'headerCss', 'headerJs', & 'fotterJs' helpers<commit_after>package org.wso2.carbon.uuf.handlebars.helpers.runtime;

import com.github.jknack.handlebars.Helper;
import com.github.jknack.handlebars.Options;

import java.io.IOException;
import java.util.ArrayList;
import java.util.List;

public class ResourceHelper implements Helper<String> {

    private static ResourceHelper HEADER_CSS_INSTANCE = new ResourceHelper("headerCss");
    private static ResourceHelper HEADER_JS_INSTANCE = new ResourceHelper("headerJs");
    private static ResourceHelper FOOTER_JS_INSTANCE = new ResourceHelper("footerJs");
    private final String resourceKey;

    private ResourceHelper(String resourceType) {
        resourceKey = ResourceHelper.class.getName() + "#" + resourceType;
    }

    public static ResourceHelper getHeaderCssInstance() {
        return HEADER_CSS_INSTANCE;
    }

    public static ResourceHelper getHeaderJsInstance() {
        return HEADER_JS_INSTANCE;
    }

    public static ResourceHelper getFooterJsInstance() {
        return FOOTER_JS_INSTANCE;
    }

    @Override
    public CharSequence apply(String uri, Options options) throws IOException {
        if (!uri.startsWith("/")) {
            throw new IllegalArgumentException("A relative public URI should start with '/'.");
        }
        List<String> resources = options.data(resourceKey);
        if (resources == null) {
            resources = new ArrayList<>();
            options.data(resourceKey, resources);
        }
        resources.add(uri);
        return "";
    }

    public String getResourceKey() {
        return resourceKey;
    }
}
{'fraction_non_alphanumeric': 0.0952212389380531, 'fraction_numerical': 0.0007079646017699115, 'mean_word_length': 3.314503816793893, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, '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': '1699329', 'n_tokens_mistral': 738, 'n_tokens_neox': 734, 'n_words': 185}