<commit_before>package org.metaborg.meta.lang.spt.strategies;

import org.metaborg.core.language.ILanguage;
import org.metaborg.core.language.ILanguageImpl;
import org.metaborg.core.language.ILanguageService;
import org.metaborg.spoofax.core.analysis.AnalysisFacet;
import org.metaborg.sunshine.environment.ServiceRegistry;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.spoofax.interpreter.core.Tools;
import org.spoofax.interpreter.terms.IStrategoTerm;
import org.strategoxt.lang.Context;
import org.strategoxt.lang.Strategy;

/**
 * Retrieves the name of the Observer strategy of the given language. This can then be used by the
 * plugin-strategy-invoke strategy.
 * 
 * Assumptions: - the Sunshine analysis function is assumed to be the observer strategy
 * 
 * @author <NAME>
 *
 */
public class get_observer_0_1 extends Strategy {
    private static final Logger logger = LoggerFactory.getLogger(get_observer_0_1.class);
    public static final get_observer_0_1 instance = new get_observer_0_1();


    @Override public IStrategoTerm invoke(Context context, IStrategoTerm unused, IStrategoTerm language) {
        logger.info("Getting observer for language {}", language);
        final ILanguage lang =
            ServiceRegistry.INSTANCE().getService(ILanguageService.class).getLanguage(Tools.asJavaString(language));
        final ILanguageImpl impl = lang.activeImpl();
        return context.getFactory().makeString(impl.facet(AnalysisFacet.class).strategyName);
    }
}<commit_msg>Adapt to new core<commit_after>package org.metaborg.meta.lang.spt.strategies;

import org.metaborg.core.language.ILanguage;
import org.metaborg.core.language.ILanguageImpl;
import org.metaborg.core.language.ILanguageService;
import org.metaborg.spoofax.core.analysis.SpoofaxAnalysisFacet;
import org.metaborg.sunshine.environment.ServiceRegistry;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.spoofax.interpreter.core.Tools;
import org.spoofax.interpreter.terms.IStrategoTerm;
import org.strategoxt.lang.Context;
import org.strategoxt.lang.Strategy;

/**
 * Retrieves the name of the Observer strategy of the given language. This can then be used by the
 * plugin-strategy-invoke strategy.
 * 
 * Assumptions: - the Sunshine analysis function is assumed to be the observer strategy
 * 
 * @author <NAME>
 *
 */
public class get_observer_0_1 extends Strategy {
    private static final Logger logger = LoggerFactory.getLogger(get_observer_0_1.class);
    public static final get_observer_0_1 instance = new get_observer_0_1();


    @Override public IStrategoTerm invoke(Context context, IStrategoTerm unused, IStrategoTerm language) {
        logger.info("Getting observer for language {}", language);
        final ILanguage lang =
            ServiceRegistry.INSTANCE().getService(ILanguageService.class).getLanguage(Tools.asJavaString(language));
        final ILanguageImpl impl = lang.activeImpl();
        return context.getFactory().makeString(impl.facet(SpoofaxAnalysisFacet.class).strategyName);
    }
}
{'fraction_non_alphanumeric': 0.09180327868852459, 'fraction_numerical': 0.006557377049180328, 'mean_word_length': 4.88996138996139, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, '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': '1571334', 'n_tokens_mistral': 931, 'n_tokens_neox': 907, 'n_words': 203}