<commit_before>/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package agents;

import jade.core.AID;
import jade.core.Agent;
import jade.core.behaviours.CyclicBehaviour;
import jade.core.behaviours.TickerBehaviour;
import jade.core.behaviours.WakerBehaviour;
import jade.domain.DFService;
import jade.domain.FIPAAgentManagement.DFAgentDescription;
import jade.domain.FIPAAgentManagement.ServiceDescription;
import jade.domain.FIPAException;
import jade.lang.acl.ACLMessage;
import jade.lang.acl.MessageTemplate;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import java.util.logging.Level;
import java.util.logging.Logger;
import org.json.simple.JSONArray;
import org.json.simple.JSONObject;

/**
 *
 * @author sib
 */
public class ReportingAgent extends Agent {

    private final List<AID> trafficLightAgents = new ArrayList<>();
    private final ArrayList<JSONObject> trafficLightStates = new ArrayList<>();
    private int requestIndex = 0;
    private int receivedAnswersPerIndex = 0;
    private String pathToDump;
    private File dumpFile;

    @Override
    protected void setup() {
        super.setup(); //To change body of generated methods, choose Tools | Templates.

        Object[] arguments = getArguments();

        if (arguments.length > 0) {
            pathToDump = arguments[0].toString();
            dumpFile = new File(pathToDump + "/state.json");
        }

        //Find all known TrafficLights
        addBehaviour(new WakerBehaviour(this, 1000) {

            @Override
            protected void onWake() {
                super.onWake(); //To change body of generated methods, choose Tools | Templates.
                findAndAddTrafficLights();
            }
        });<commit_msg>OS independent way to merge path and file<commit_after>/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package agents;

import jade.core.AID;
import jade.core.Agent;
import jade.core.behaviours.CyclicBehaviour;
import jade.core.behaviours.TickerBehaviour;
import jade.core.behaviours.WakerBehaviour;
import jade.domain.DFService;
import jade.domain.FIPAAgentManagement.DFAgentDescription;
import jade.domain.FIPAAgentManagement.ServiceDescription;
import jade.domain.FIPAException;
import jade.lang.acl.ACLMessage;
import jade.lang.acl.MessageTemplate;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import java.util.logging.Level;
import java.util.logging.Logger;
import org.json.simple.JSONArray;
import org.json.simple.JSONObject;

/**
 *
 * @author sib
 */
public class ReportingAgent extends Agent {

    private final List<AID> trafficLightAgents = new ArrayList<>();
    private final ArrayList<JSONObject> trafficLightStates = new ArrayList<>();
    private int requestIndex = 0;
    private int receivedAnswersPerIndex = 0;
    private String pathToDump;
    private File dumpFile;

    @Override
    protected void setup() {
        super.setup(); //To change body of generated methods, choose Tools | Templates.

        Object[] arguments = getArguments();

        if (arguments.length > 0) {
            pathToDump = arguments[0].toString();
            dumpFile = new File(pathToDump, "state.json");
        }

        //Find all known TrafficLights
        addBehaviour(new WakerBehaviour(this, 1000) {

            @Override
            protected void onWake() {
                super.onWake(); //To change body of generated methods, choose Tools | Templates.
                findAndAddTrafficLights();
            }
        });
{'fraction_non_alphanumeric': 0.0948849104859335, 'fraction_numerical': 0.004092071611253197, 'mean_word_length': 3.3845291479820627, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 13, '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': '2353700', 'n_tokens_mistral': 1138, 'n_tokens_neox': 1089, 'n_words': 307}