Skip to content

Commit

Permalink
Breaking change in the hierarchy of IOutput (check experimental plugins)
Browse files Browse the repository at this point in the history
- removal of FileOutput (not used anymore in experiments)
- removal of IDisplayOutput and AbstractDisplayOutput (merged with
IOutput and AbstractOutput) with the goal of simplifying the hierarchy
of outputs
  • Loading branch information
AlexisDrogoul committed Mar 17, 2024
1 parent 911eeb6 commit 8319629
Show file tree
Hide file tree
Showing 40 changed files with 377 additions and 1,478 deletions.
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
/*******************************************************************************************************
*
* IDisplayCreator.java, in gama.core, is part of the source code of the GAMA modeling and simulation platform
* .
* (v.2024-06).
*
* (c) 2007-2024 UMI 209 UMMISCO IRD/SU & Partners (IRIT, MIAT, TLU, CTU)
* (c) 2007-2024 UMI 209 UMMISCO IRD/SU & Partners (IRIT, MIAT, ESPACE-DEV, CTU)
*
* Visit https://github.com/gama-platform/gama for license information and contacts.
*
********************************************************************************************************/
package gama.core.common.interfaces;

import gama.core.outputs.IDisplayOutput;
import gama.core.outputs.IOutput;
import gama.core.outputs.display.NullDisplaySurface;
import gama.gaml.compilation.GamlAddition;

Expand Down Expand Up @@ -64,7 +64,7 @@ public IDisplaySurface create(final Object... args) {
* the args
* @return the i display surface
*/
public IDisplaySurface create(final IDisplayOutput output, final Object... args) {
public IDisplaySurface create(final IOutput output, final Object... args) {
final Object[] params = new Object[args.length + 1];
params[0] = output;
for (int i = 0; i < args.length; i++) { params[i + 1] = args[i]; }
Expand Down
14 changes: 7 additions & 7 deletions gama.core/src/gama/core/common/interfaces/IGamaView.java
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
/*******************************************************************************************************
*
* IGamaView.java, in gama.core, is part of the source code of the GAMA modeling and simulation platform .
* IGamaView.java, in gama.core, is part of the source code of the GAMA modeling and simulation platform (v.2024-06).
*
* (c) 2007-2024 UMI 209 UMMISCO IRD/SU & Partners (IRIT, MIAT, TLU, CTU)
* (c) 2007-2024 UMI 209 UMMISCO IRD/SU & Partners (IRIT, MIAT, ESPACE-DEV, CTU)
*
* Visit https://github.com/gama-platform/gama for license information and contacts.
*
Expand All @@ -12,7 +12,7 @@
import gama.core.kernel.experiment.ITopLevelAgent;
import gama.core.kernel.simulation.SimulationAgent;
import gama.core.metamodel.shape.GamaPoint;
import gama.core.outputs.IDisplayOutput;
import gama.core.outputs.IOutput;
import gama.core.outputs.LayeredDisplayOutput;
import gama.core.runtime.IScope;
import gama.core.util.GamaColor;
Expand Down Expand Up @@ -41,30 +41,30 @@ public interface Interactive extends ITopLevelAgentChangeListener {}
* @param output
* the output
*/
void update(IDisplayOutput output);
void update(IOutput output);

/**
* Adds the output.
*
* @param output
* the output
*/
void addOutput(IDisplayOutput output);
void addOutput(IOutput output);

/**
* Removes the output.
*
* @param putput
* the putput
*/
void removeOutput(IDisplayOutput putput);
void removeOutput(IOutput putput);

/**
* Gets the output.
*
* @return the output
*/
IDisplayOutput getOutput();
IOutput getOutput();

/**
* Close.
Expand Down
8 changes: 4 additions & 4 deletions gama.core/src/gama/core/common/interfaces/IGui.java
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
/*******************************************************************************************************
*
* IGui.java, in gama.core, is part of the source code of the GAMA modeling and simulation platform (v.1.9.3).
* IGui.java, in gama.core, is part of the source code of the GAMA modeling and simulation platform (v.2024-06).
*
* (c) 2007-2024 UMI 209 UMMISCO IRD/SU & Partners (IRIT, MIAT, TLU, CTU)
* (c) 2007-2024 UMI 209 UMMISCO IRD/SU & Partners (IRIT, MIAT, ESPACE-DEV, CTU)
*
* Visit https://github.com/gama-platform/gama for license information and contacts.
*
Expand All @@ -23,7 +23,7 @@
import gama.core.metamodel.agent.IAgent;
import gama.core.metamodel.shape.GamaPoint;
import gama.core.metamodel.shape.IShape;
import gama.core.outputs.IDisplayOutput;
import gama.core.outputs.IOutput;
import gama.core.outputs.LayeredDisplayOutput;
import gama.core.runtime.GAMA;
import gama.core.runtime.IScope;
Expand Down Expand Up @@ -496,7 +496,7 @@ default void closeSimulationViews(final IScope scope, final boolean andOpenModel
* @param agent
* the agent
*/
default void updateViewTitle(final IDisplayOutput output, final SimulationAgent agent) {}
default void updateViewTitle(final IOutput output, final SimulationAgent agent) {}

/**
* Open welcome page.
Expand Down
7 changes: 2 additions & 5 deletions gama.core/src/gama/core/common/interfaces/IKeyword.java
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
/*******************************************************************************************************
*
* IKeyword.java, in gama.core, is part of the source code of the GAMA modeling and simulation platform .
* IKeyword.java, in gama.core, is part of the source code of the GAMA modeling and simulation platform (v.2024-06).
*
* (c) 2007-2024 UMI 209 UMMISCO IRD/SU & Partners (IRIT, MIAT, TLU, CTU)
* (c) 2007-2024 UMI 209 UMMISCO IRD/SU & Partners (IRIT, MIAT, ESPACE-DEV, CTU)
*
* Visit https://github.com/gama-platform/gama for license information and contacts.
*
Expand Down Expand Up @@ -872,9 +872,6 @@ public interface IKeyword {
/** The output. */
String OUTPUT = "output";

/** The output file. */
String OUTPUT_FILE = "output_file";

/** The over. */
String OVER = "over";

Expand Down
19 changes: 9 additions & 10 deletions gama.core/src/gama/core/kernel/experiment/BatchAgent.java
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
/*******************************************************************************************************
*
* BatchAgent.java, in gama.core, is part of the source code of the GAMA modeling and simulation platform .
* BatchAgent.java, in gama.core, is part of the source code of the GAMA modeling and simulation platform (v.2024-06).
*
* (c) 2007-2024 UMI 209 UMMISCO IRD/SU & Partners (IRIT, MIAT, TLU, CTU)
* (c) 2007-2024 UMI 209 UMMISCO IRD/SU & Partners (IRIT, MIAT, ESPACE-DEV, CTU)
*
* Visit https://github.com/gama-platform/gama for license information and contacts.
*
Expand Down Expand Up @@ -33,7 +33,6 @@
import gama.core.metamodel.agent.AbstractAgent;
import gama.core.metamodel.agent.IAgent;
import gama.core.metamodel.population.IPopulation;
import gama.core.outputs.FileOutput;
import gama.core.runtime.GAMA;
import gama.core.runtime.IExperimentStateListener;
import gama.core.runtime.IScope;
Expand Down Expand Up @@ -197,8 +196,8 @@ private IMap<String, Object> manageOutputAndCloseSimulation(final IAgent sim, fi
if (memorize) { fitnessValues.add(lastFitnessValue); }
}
out.put(IKeyword.FITNESS, lastFitnessValue);
final FileOutput output = getSpecies().getLog();
if (output != null) { getSpecies().getLog().doRefreshWriteAndClose(sol, out); }
// final FileOutput output = getSpecies().getLog();
// if (output != null) { getSpecies().getLog().doRefreshWriteAndClose(sol, out); }
} else {
AExplorationAlgorithm exp = (AExplorationAlgorithm) getSpecies().getExplorationAlgorithm();
final IExpression outputs = exp.getOutputs();
Expand All @@ -210,11 +209,11 @@ private IMap<String, Object> manageOutputAndCloseSimulation(final IAgent sim, fi
trackedValues.put(s, v);
out.put(s, v);
}
final FileOutput output = getSpecies().getLog();
if (output != null) {
getSpecies().getLog().doRefreshWriteAndClose(sol, out);
if (!"".equals(exp.getReport())) { getSpecies().getLog().doWriteReportAndClose(exp.getReport()); }
}
// final FileOutput output = getSpecies().getLog();
// if (output != null) {
// getSpecies().getLog().doRefreshWriteAndClose(sol, out);
// if (!"".equals(exp.getReport())) { getSpecies().getLog().doWriteReportAndClose(exp.getReport()); }
// }
}
}

Expand Down
23 changes: 13 additions & 10 deletions gama.core/src/gama/core/kernel/experiment/ExperimentPlan.java
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
/*******************************************************************************************************
*
* ExperimentPlan.java, in gama.core, is part of the source code of the GAMA modeling and simulation platform
* .
* (v.2024-06).
*
* (c) 2007-2024 UMI 209 UMMISCO IRD/SU & Partners (IRIT, MIAT, TLU, CTU)
* (c) 2007-2024 UMI 209 UMMISCO IRD/SU & Partners (IRIT, MIAT, ESPACE-DEV, CTU)
*
* Visit https://github.com/gama-platform/gama for license information and contacts.
*
Expand All @@ -20,13 +20,13 @@

import com.google.common.collect.Iterables;

import gama.annotations.precompiler.IConcept;
import gama.annotations.precompiler.ISymbolKind;
import gama.annotations.precompiler.GamlAnnotations.doc;
import gama.annotations.precompiler.GamlAnnotations.facet;
import gama.annotations.precompiler.GamlAnnotations.facets;
import gama.annotations.precompiler.GamlAnnotations.inside;
import gama.annotations.precompiler.GamlAnnotations.symbol;
import gama.annotations.precompiler.IConcept;
import gama.annotations.precompiler.ISymbolKind;
import gama.core.common.interfaces.IKeyword;
import gama.core.common.preferences.GamaPreferences;
import gama.core.kernel.batch.BatchOutput;
Expand All @@ -39,7 +39,6 @@
import gama.core.metamodel.shape.GamaPoint;
import gama.core.metamodel.topology.continuous.AmorphousTopology;
import gama.core.outputs.ExperimentOutputManager;
import gama.core.outputs.FileOutput;
import gama.core.outputs.IOutputManager;
import gama.core.outputs.LayoutStatement;
import gama.core.outputs.SimulationOutputManager;
Expand All @@ -59,7 +58,6 @@
import gama.gaml.descriptions.ExperimentDescription;
import gama.gaml.descriptions.IDescription;
import gama.gaml.expressions.IExpression;
import gama.gaml.expressions.IExpressionFactory;
import gama.gaml.interfaces.IGamlIssue;
import gama.gaml.operators.Cast;
import gama.gaml.species.GamlSpecies;
Expand Down Expand Up @@ -353,7 +351,7 @@ public void validate(final IDescription desc) {
protected IExploration exploration;

/** The log. */
private FileOutput log;
// private FileOutput log;

/** The is headless. */
private boolean isHeadless;
Expand Down Expand Up @@ -698,7 +696,7 @@ private void createOutput(final BatchOutput output) throws GamaRuntimeException
IExpression data = output.getFacet(IKeyword.DATA);
if (data == null) { data = exploration.getOutputs(); }
final String dataString = data == null ? "time" : data.serializeToGaml(false);
log = new FileOutput(output.getLiteral(IKeyword.TO), dataString, new ArrayList(parameters.keySet()), this);
// log = new FileOutput(output.getLiteral(IKeyword.TO), dataString, new ArrayList(parameters.keySet()), this);
}

/**
Expand Down Expand Up @@ -1002,8 +1000,13 @@ public Object getGlobalVarValue(final String varName) throws GamaRuntimeExceptio
@Override
public IExploration getExplorationAlgorithm() { return exploration; }

@Override
public FileOutput getLog() { return log; }
/**
* Gets the log.
*
* @return the log
*/
// @Override
// public FileOutput getLog() { return log; }

/**
* Adds the explorable parameter.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
/*******************************************************************************************************
*
* IExperimentPlan.java, in gama.core, is part of the source code of the GAMA modeling and simulation platform
* .
* (v.2024-06).
*
* (c) 2007-2024 UMI 209 UMMISCO IRD/SU & Partners (IRIT, MIAT, TLU, CTU)
* (c) 2007-2024 UMI 209 UMMISCO IRD/SU & Partners (IRIT, MIAT, ESPACE-DEV, CTU)
*
* Visit https://github.com/gama-platform/gama for license information and contacts.
*
Expand All @@ -17,7 +17,6 @@
import gama.core.kernel.experiment.IParameter.Batch;
import gama.core.kernel.model.IModel;
import gama.core.kernel.simulation.SimulationAgent;
import gama.core.outputs.FileOutput;
import gama.core.outputs.IOutputManager;
import gama.core.runtime.GAMA;
import gama.core.runtime.IScope;
Expand Down Expand Up @@ -155,7 +154,7 @@ public interface IExperimentPlan extends ISpecies {
*
* @return the log
*/
FileOutput getLog();
// FileOutput getLog();

/**
* Checks if is batch.
Expand Down
Loading

0 comments on commit 8319629

Please sign in to comment.