Skip to content

Commit

Permalink
Adding headers and auto-javadoc to msi.gama.lang.gaml and headless
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexisDrogoul committed Jan 29, 2022
1 parent aa944e5 commit f655e2b
Show file tree
Hide file tree
Showing 232 changed files with 16,613 additions and 900 deletions.
@@ -1,3 +1,13 @@
/*******************************************************************************************************
*
* AbstractModelLibraryRunner.java, in msi.gama.headless, is part of the source code of the
* GAMA modeling and simulation platform (v.1.8.2).
*
* (c) 2007-2022 UMI 209 UMMISCO IRD/SU & Partners (IRIT, MIAT, TLU, CTU)
*
* Visit https://github.com/gama-platform/gama for license information and contacts.
*
********************************************************************************************************/
package msi.gama.headless.batch;

import java.io.IOException;
Expand All @@ -9,24 +19,57 @@
import msi.gama.lang.gaml.validation.GamlModelBuilder;
import ummisco.gama.dev.utils.DEBUG;

/**
* The Class AbstractModelLibraryRunner.
*/
public abstract class AbstractModelLibraryRunner {

/**
* Creates the builder.
*
* @param injector the injector
* @return the gaml model builder
*/
protected GamlModelBuilder createBuilder(final Injector injector) {
return new GamlModelBuilder(injector);
}

/**
* Checks if is model.
*
* @param url the url
* @return true, if is model
*/
protected boolean isModel(final URL url) {
return isModel(url.getFile());
}

/**
* Checks if is model.
*
* @param file the file
* @return true, if is model
*/
protected boolean isModel(final String file) {
return GamlFileExtension.isGaml(file) || GamlFileExtension.isExperiment(file);
}

/**
* Checks if is test.
*
* @param url the url
* @return true, if is test
*/
protected boolean isTest(final URL url) {
final String file = url.getFile();
return isModel(file) && (file.contains("test") || file.contains("Test"));
}

/**
* Start.
*
* @return the int
* @throws IOException Signals that an I/O exception has occurred.
*/
public abstract int start() throws IOException;
}
@@ -1,3 +1,13 @@
/*******************************************************************************************************
*
* ModelLibraryTester.java, in msi.gama.headless, is part of the source code of the
* GAMA modeling and simulation platform (v.1.8.2).
*
* (c) 2007-2022 UMI 209 UMMISCO IRD/SU & Partners (IRIT, MIAT, TLU, CTU)
*
* Visit https://github.com/gama-platform/gama for license information and contacts.
*
********************************************************************************************************/
package msi.gama.headless.batch;

import java.io.IOException;
Expand Down Expand Up @@ -29,13 +39,23 @@
import msi.gaml.statements.test.TestState;
import ummisco.gama.dev.utils.DEBUG;

/**
* The Class ModelLibraryTester.
*/
public class ModelLibraryTester extends AbstractModelLibraryRunner {

/** The instance. */
private static ModelLibraryTester instance;

/** The original. */
PrintStream original;

/** The null stream. */
PrintStream nullStream;

/**
* Instantiates a new model library tester.
*/
private ModelLibraryTester() {
DEBUG.ON();
}
Expand Down Expand Up @@ -80,6 +100,14 @@ public void write(final int b) {
return code[0];
}

/**
* Test.
*
* @param builder the builder
* @param count the count
* @param code the code
* @param p the p
*/
public void test(final GamlModelBuilder builder, final int[] count, final int[] code, final URL p) {
// DEBUG.OUT(p);
final List<GamlCompilationError> errors = new ArrayList<>();
Expand Down Expand Up @@ -116,6 +144,11 @@ public void test(final GamlModelBuilder builder, final int[] count, final int[]

}

/**
* Gets the single instance of ModelLibraryTester.
*
* @return single instance of ModelLibraryTester
*/
public static ModelLibraryTester getInstance() {
if (instance == null) { instance = new ModelLibraryTester(); }
return instance;
Expand Down
@@ -1,3 +1,13 @@
/*******************************************************************************************************
*
* ModelLibraryValidator.java, in msi.gama.headless, is part of the source code of the
* GAMA modeling and simulation platform (v.1.8.2).
*
* (c) 2007-2022 UMI 209 UMMISCO IRD/SU & Partners (IRIT, MIAT, TLU, CTU)
*
* Visit https://github.com/gama-platform/gama for license information and contacts.
*
********************************************************************************************************/
package msi.gama.headless.batch;

import java.io.IOException;
Expand All @@ -18,10 +28,17 @@
import msi.gaml.compilation.kernel.GamaBundleLoader;
import ummisco.gama.dev.utils.DEBUG;

/**
* The Class ModelLibraryValidator.
*/
public class ModelLibraryValidator extends AbstractModelLibraryRunner {

/** The instance. */
private static ModelLibraryValidator instance;

/**
* Instantiates a new model library validator.
*/
private ModelLibraryValidator() {
DEBUG.ON();
}
Expand Down Expand Up @@ -51,6 +68,15 @@ public int start() throws IOException {
return code[0] + code[1];
}

/**
* Validate plugins from UR ls.
*
* @param pluginsURLs the plugins UR ls
* @param builder the builder
* @param count the count
* @param code the code
* @throws IOException Signals that an I/O exception has occurred.
*/
private void validatePluginsFromURLs(final Multimap<Bundle, String> pluginsURLs, final GamlModelBuilder builder,
final int[] count, final int[] code) throws IOException {
List<URL> allURLs = new ArrayList<>();
Expand All @@ -72,6 +98,14 @@ private void validatePluginsFromURLs(final Multimap<Bundle, String> pluginsURLs,
allURLs.forEach(u -> validate(builder, count, code, u));
}

/**
* Validate.
*
* @param builder the builder
* @param countOfModelsValidated the count of models validated
* @param returnCode the return code
* @param pathToModel the path to model
*/
private void validate(final GamlModelBuilder builder, final int[] countOfModelsValidated, final int[] returnCode,
final URL pathToModel) {
final List<GamlCompilationError> errors = new ArrayList<>();
Expand All @@ -85,6 +119,11 @@ private void validate(final GamlModelBuilder builder, final int[] countOfModelsV
});
}

/**
* Gets the single instance of ModelLibraryValidator.
*
* @return single instance of ModelLibraryValidator
*/
public static ModelLibraryValidator getInstance() {
if (instance == null) { instance = new ModelLibraryValidator(); }
return instance;
Expand Down
@@ -1,3 +1,13 @@
/*******************************************************************************************************
*
* CheckConcepts.java, in msi.gama.headless, is part of the source code of the
* GAMA modeling and simulation platform (v.1.8.2).
*
* (c) 2007-2022 UMI 209 UMMISCO IRD/SU & Partners (IRIT, MIAT, TLU, CTU)
*
* Visit https://github.com/gama-platform/gama for license information and contacts.
*
********************************************************************************************************/
package msi.gama.headless.batch.documentation;

import java.io.BufferedReader;
Expand All @@ -16,9 +26,18 @@
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;

/**
* The Class CheckConcepts.
*/
@SuppressWarnings ("unused")
public class CheckConcepts {

/**
* Execute for A website part.
*
* @param path the path
* @param websitePart the website part
*/
private static void executeForAWebsitePart(final String path, final String websitePart) {
final ArrayList<File> listFiles = new ArrayList<>();
Utils.getFilesFromFolder(path, listFiles);
Expand All @@ -42,6 +61,11 @@ private static void executeForAWebsitePart(final String path, final String websi
}
}

/**
* Browse keywords.
*
* @param path the path
*/
private static void browseKeywords(final String path) {
try {
final DocumentBuilderFactory dbFactory = DocumentBuilderFactory.newInstance();
Expand Down Expand Up @@ -71,6 +95,12 @@ private static void browseKeywords(final String path) {
}
}

/**
* Write report.
*
* @param file the file
* @throws IOException Signals that an I/O exception has occurred.
*/
private static void writeReport(final String file) throws IOException {
String result = "";

Expand Down

0 comments on commit f655e2b

Please sign in to comment.