Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue 6 create agent launcher #27

Merged
merged 2 commits into from
Apr 13, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
60 changes: 58 additions & 2 deletions src/launch/Launch.java
Original file line number Diff line number Diff line change
@@ -1,11 +1,67 @@
package launch;

import jade.Boot;
import jade.core.Profile;
import jade.core.ProfileImpl;
import jade.core.Runtime;
import jade.util.ExtendedProperties;
import jade.wrapper.ContainerController;

import java.util.Properties;

public class Launch extends Boot {
private static ProfileImpl simulationProfile;
private static ContainerController simulationContainerController;
private static Properties simulationProperties;

public static void main(String[] args) {
private static void createSimulationContainer(boolean gui) {
simulationProperties = new ExtendedProperties();

simulationProfile = new ProfileImpl((jade.util.leap.Properties) simulationProperties);

if(gui) {
simulationProperties.setProperty(Profile.GUI, "true");
}

Runtime.instance().setCloseVM(true);

if(simulationProfile.getBooleanProperty(Profile.MAIN,true)){
simulationContainerController = Runtime.instance().createMainContainer(simulationProfile);
} else {
simulationContainerController = Runtime.instance().createAgentContainer(simulationProfile);
}
}

/**
* Receives the map name and searches for the folder
* ./data/maps/<mapName> and reads the nodes and edges
* files inside.
* @param mapName - name of the folder where the map files are
*/
private static void loadMap(String mapName) {

System.out.println("Hello world!");
}

/**
* Receives the parameters file name and searches for it in
* ./data/simulations/.
* @param agentsFile - name of the files with agent parameters
*/
private static void loadAndStartAgents(String agentsFile) {

}

private static void checkParameters(String[] args) {
if(args.length != 3) {
System.out.println("Expected 3 arguments: <-gui?> <mapFolderName> <simulationFile>");
System.exit(0);
}
}

public static void main(String[] args) {
checkParameters(args);
createSimulationContainer(args[0].equals("-" + Profile.GUI));
loadMap(args[1]);
loadAndStartAgents(args[2]);
}
}