<commit_before>package com.bitdubai.fermat_core;

import com.bitdubai.fermat_api.Addon;
import com.bitdubai.fermat_api.PlatformContext;
import com.bitdubai.fermat_api.Plugin;
import com.bitdubai.fermat_api.layer.all_definition.enums.Addons;
import com.bitdubai.fermat_api.layer.all_definition.enums.Plugins;


import java.util.Collection;
import java.util.HashMap;
import java.util.Map;

/**
 * Created by ciencias on 2/12/15.
 */
public class CorePlatformContext implements PlatformContext {

    Map<Addons, Addon> addons = new HashMap<Addons, Addon>();
    Map<Plugins, Plugin> plugins = new HashMap<Plugins, Plugin>();
    
    public void addAddon (Addon addon, Addons descriptor) {
        addons.put(descriptor,addon);
    }
    
    
    public Addon getAddon (Addons descriptor){
        return (Addon) addons.get(descriptor);
    }


    public void addPlugin (Plugin plugin, Plugins descriptor) {
        plugins.put(descriptor,plugin);
    }


    public Plugin getPlugin (Plugins descriptor){
        return (Plugin) plugins.get(descriptor);
    }


    public Collection<Addons> getRegisteredAddonsDescriptors(){
        return addons.keySet();
    }

    public Collection<Plugins> getRegisteredPluginsDescriptors(){
        return plugins.keySet();
    }


}<commit_msg>Simplify code and comment and add platformLayers to the context<commit_after>/*
 * @#CorePlatformContext.java - 2015
 * Copyright bitDubai.com., All rights reserved.
 * You may not modify, use, reproduce or distribute this software.
 * BITDUBAI/CONFIDENTIAL
 */
package com.bitdubai.fermat_core;

import com.bitdubai.fermat_api.Addon;
import com.bitdubai.fermat_api.PlatformContext;
import com.bitdubai.fermat_api.Plugin;
import com.bitdubai.fermat_api.layer.PlatformLayer;
import com.bitdubai.fermat_api.layer.all_definition.enums.Addons;
import com.bitdubai.fermat_api.layer.all_definition.enums.PlatformLayers;
import com.bitdubai.fermat_api.layer.all_definition.enums.Plugins;


import java.util.Collection;
import java.util.HashMap;
import java.util.Map;

/**
 * The Class <code>com.bitdubai.fermat_core.CorePlatformContext</code> implements
 * the core platform context and hold all references of the mains components
 * <p/>
 *
 * Created by ciencias on 2/12/15.
 * Update by <NAME> - (<EMAIL>) on 24/07/15.
 *
 * @version 1.0
 * @since Java JDK 1.7
 */
public class CorePlatformContext implements PlatformContext {

    /**
     * Hold the referent of the existing addons
     */
    Map<Addons, Addon> addons;

    /**
     * Hold the referent of the existing plugins
     */
    Map<Plugins, Plugin> plugins;

    /**
     * Hold the referent of the existing platform layers
     */
    Map<PlatformLayers, PlatformLayer> platformLayers;

    /**
     * Constructor
     */
    public CorePlatformContext(){
        super();

        this.addons = new HashMap<Addons, Addon>();
        this.plugins = new HashMap<Plugins, Plugin>();
        this.platformLayers = new HashMap<PlatformLayers, PlatformLayer>();
    }

    /**
     * (non-Javadoc)
     *
     * @see PlatformContext#registerAddon(Addon, Addons)
     */
    public void registerAddon(Addon addon, Addons key) {
        addons.put(key,addon);
    }

    /**
     * (non-Javadoc)
     *
     * @see PlatformContext#getAddon(Addons)
     */
    public Addon getAddon (Addons key){
        return (Addon) addons.get(key);
    }

    /**
     * (non-Javadoc)
     *
     * @see PlatformContext#registerPlugin(Plugin, Plugins)
     */
    public void registerPlugin(Plugin plugin, Plugins key) {
        plugins.put(key,plugin);
    }

    /**
     * (non-Javadoc)
     *
     * @see PlatformContext#getPlugin(Plugins)
     */
    public Plugin getPlugin (Plugins key){
        return (Plugin) plugins.get(key);
    }

    /**
     * (non-Javadoc)
     *
     * @see PlatformContext#registerPlatformLayer(PlatformLayer, PlatformLayers)
     */
    public void registerPlatformLayer(PlatformLayer platformLayer, PlatformLayers key) {
        platformLayers.put(key,platformLayer);
    }

    /**
     * (non-Javadoc)
     *
     * @see PlatformContext#getPlatformLayer(PlatformLayers)
     */
    public PlatformLayer getPlatformLayer (PlatformLayers key){
        return (PlatformLayer) platformLayers.get(key);
    }

    /**
     * (non-Javadoc)
     *
     * @see PlatformContext#getRegisteredAddonskeys()
     */
    public Collection<Addons> getRegisteredAddonskeys(){
        return addons.keySet();
    }

    /**
     * (non-Javadoc)
     *
     * @see PlatformContext#getRegisteredPluginskeys()
     */
    public Collection<Plugins> getRegisteredPluginskeys(){
        return plugins.keySet();
    }

    /**
     * (non-Javadoc)
     *
     * @see PlatformContext#getRegisteredPlatformLayerskeys()
     */
    public Collection<PlatformLayers> getRegisteredPlatformLayerskeys(){ return platformLayers.keySet();}


    /**
     * (non-Javadoc)
     *
     * @see PlatformContext#isRegister(Addons)
     */
    public boolean isRegister(Addons key){
        return addons.containsKey(key);
    }

    /**
     * (non-Javadoc)
     *
     * @see PlatformContext#isRegister(Plugins)
     */
    public boolean isRegister(Plugins key){
        return plugins.containsKey(key);
    }

    /**
     * (non-Javadoc)
     *
     * @see PlatformContext#isRegister(PlatformLayer)
     */
    public boolean isRegister(PlatformLayer key){
        return platformLayers.containsKey(key);
    }


}
{'fraction_non_alphanumeric': 0.11251835535976505, 'fraction_numerical': 0.004405286343612335, 'mean_word_length': 2.9715743440233235, 'pattern_counts': {'":': 0, '<': 23, '<?xml version=': 0, '>': 23, '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': '4266563', 'n_tokens_mistral': 1780, 'n_tokens_neox': 1713, 'n_words': 335}