<commit_before>package org.ow2.proactive.resourcemanager.gui.data;

import org.eclipse.swt.widgets.Display;
import org.objectweb.proactive.Body;
import org.objectweb.proactive.InitActive;
import org.objectweb.proactive.api.PAActiveObject;
import org.ow2.proactive.resourcemanager.common.event.RMEvent;
import org.ow2.proactive.resourcemanager.common.event.RMInitialState;
import org.ow2.proactive.resourcemanager.common.event.RMNodeEvent;
import org.ow2.proactive.resourcemanager.common.event.RMNodeSourceEvent;
import org.ow2.proactive.resourcemanager.frontend.RMEventListener;
import org.ow2.proactive.resourcemanager.frontend.RMMonitoring;
import org.ow2.proactive.resourcemanager.gui.data.model.RMModel;
import org.ow2.proactive.resourcemanager.gui.views.ResourceExplorerView;
import org.ow2.proactive.resourcemanager.gui.views.ResourcesTabView;
import org.ow2.proactive.resourcemanager.gui.views.StatisticsView;
import org.unicore.resources.Application;


public class EventsReceiver implements InitActive, RMEventListener {

    private RMModel model = null;
    private RMMonitoring monitor = null;

    public EventsReceiver() {
    }

    public EventsReceiver(RMMonitoring monitorStub) {
        this.monitor = monitorStub;
    }

    public void initActivity(Body body) {
        model = RMStore.getInstance().getModel();
        RMInitialState initialState = monitor.addRMEventListener((RMEventListener) PAActiveObject
                .getStubOnThis());
        for (RMNodeSourceEvent nodeSourceEvent : initialState.getNodeSource()) {
            model.addNodeSource(nodeSourceEvent);
        }
        for (RMNodeEvent nodeEvent : initialState.getBusyNodes()) {
            model.addNode(nodeEvent);
        }
        for (RMNodeEvent nodeEvent : initialState.getDownNodes()) {
            model.addNode(nodeEvent);
        }
        for (RMNodeEvent nodeEvent : initialState.getFreeNodes()) {
            model.addNode(nodeEvent);
        }
        for (RMNodeEvent nodeEvent : initialState.getToReleaseNodes()) {
            model.addNode(nodeEvent);
        }

        model.setUpdateViews(true);
        // Init opened views AFTER model's construction
        Display.getDefault().syncExec(new Runnable() {
            public void run() {
                //init Tab view if tab panel is displayed
                if (ResourcesTabView.getTabViewer() != null) {
                    ResourcesTabView.init();<commit_msg>RM Initial state structure has changed, so modified RM GUI according to this.<commit_after>package org.ow2.proactive.resourcemanager.gui.data;

import org.eclipse.swt.widgets.Display;
import org.objectweb.proactive.Body;
import org.objectweb.proactive.InitActive;
import org.objectweb.proactive.api.PAActiveObject;
import org.ow2.proactive.resourcemanager.common.event.RMEvent;
import org.ow2.proactive.resourcemanager.common.event.RMInitialState;
import org.ow2.proactive.resourcemanager.common.event.RMNodeEvent;
import org.ow2.proactive.resourcemanager.common.event.RMNodeSourceEvent;
import org.ow2.proactive.resourcemanager.frontend.RMEventListener;
import org.ow2.proactive.resourcemanager.frontend.RMMonitoring;
import org.ow2.proactive.resourcemanager.gui.data.model.RMModel;
import org.ow2.proactive.resourcemanager.gui.views.ResourceExplorerView;
import org.ow2.proactive.resourcemanager.gui.views.ResourcesTabView;
import org.ow2.proactive.resourcemanager.gui.views.StatisticsView;
import org.unicore.resources.Application;


public class EventsReceiver implements InitActive, RMEventListener {

    private RMModel model = null;
    private RMMonitoring monitor = null;

    public EventsReceiver() {
    }

    public EventsReceiver(RMMonitoring monitorStub) {
        this.monitor = monitorStub;
    }

    public void initActivity(Body body) {
        model = RMStore.getInstance().getModel();
        RMInitialState initialState = monitor.addRMEventListener((RMEventListener) PAActiveObject
                .getStubOnThis());
        for (RMNodeSourceEvent nodeSourceEvent : initialState.getNodeSource()) {
            model.addNodeSource(nodeSourceEvent);
        }

        for (RMNodeEvent nodeEvent : initialState.getNodesEvents()) {
            model.addNode(nodeEvent);
        }

        model.setUpdateViews(true);
        // Init opened views AFTER model's construction
        Display.getDefault().syncExec(new Runnable() {
            public void run() {
                //init Tab view if tab panel is displayed
                if (ResourcesTabView.getTabViewer() != null) {
                    ResourcesTabView.init();
{'fraction_non_alphanumeric': 0.09301310043668122, 'fraction_numerical': 0.00480349344978166, 'mean_word_length': 3.5582089552238805, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '6278675', 'n_tokens_mistral': 1302, 'n_tokens_neox': 1264, 'n_words': 222}