From 9c098691cda018245cef3d8e50a478b5a062608f Mon Sep 17 00:00:00 2001 From: AlexisDrogoul Date: Sat, 15 Apr 2023 12:35:49 +0700 Subject: [PATCH 1/2] Bumped a number of things to 1.9.1 --- msi.gama.application/plugin.xml | 2 +- msi.gama.core/src/msi/gama/runtime/GAMA.java | 2 +- .../concurrent/GamaExecutorService.java | 6 +- .../files/input/toc/toc1.9.0.xml | 2 +- .../src/msi/gama/ext/webb/Request.java | 84 +++++-- .../src/msi/gama/ext/webb/Response.java | 78 ++++--- msi.gama.ext/src/msi/gama/ext/webb/Webb.java | 205 +++++++++++++----- .../src/msi/gama/ext/webb/WebbException.java | 31 ++- .../src/msi/gama/ext/webb/WebbUtils.java | 183 ++++++++++++---- .../GAML Syntax/System/Preferences.gaml | 200 ++++++++++++----- msi.gama.parent/pom.xml | 6 +- msi.gama.parent/tiny_pom.xml | 8 +- msi.gama.processor/pom.xml | 6 +- ummisco.gama.annotations/pom.xml | 6 +- .../gama/precompiler/doc/utils/Constants.java | 2 +- ummisco.gama.feature.audio/feature.xml | 6 +- .../feature.xml | 8 +- ummisco.gama.feature.core.ui/feature.xml | 2 +- ummisco.gama.feature.core/feature.xml | 6 +- .../feature.xml | 4 +- ummisco.gama.feature.dependencies/feature.xml | 2 +- .../feature.xml | 4 +- ummisco.gama.feature.image/feature.xml | 4 +- ummisco.gama.feature.modeling.ui/feature.xml | 4 +- ummisco.gama.feature.models/feature.xml | 2 +- ummisco.gama.feature.stats/feature.xml | 4 +- .../extraresources/Info.plist | 6 +- .../headless/osx/gama-headless.sh | 2 +- .../headless/unix/gama-headless.sh | 2 +- ummisco.gama.product/gama.product | 1 + .../META-INF/MANIFEST.MF | 4 +- 31 files changed, 613 insertions(+), 269 deletions(-) diff --git a/msi.gama.application/plugin.xml b/msi.gama.application/plugin.xml index cae571b23a..4c02d5dfbd 100644 --- a/msi.gama.application/plugin.xml +++ b/msi.gama.application/plugin.xml @@ -15,7 +15,7 @@ + value="GAMA Platform - V1.9.1 http://gama-platform.org (c) 2007-2008 IRD-UR GEODES (France) & IFI-MSI (Vietnam) (c) 2009-2011 UMI 209 UMMISCO IRD/UPMC - MSI (Vietnam) (c) 2012-2017 UMI 209 UMMISCO IRD/UPMC & Partners (c) 2018-2023 UMI 209 UMMISCO IRD/SU & Partners"> CONCURRENCY_SIMULATIONS_ALL = create("pref_parallel_simulations_all", - "In batch mode, allows to run as many simulations as possible with available threads/core " - + "\n[WARNING: if true, disabled reflexes and permanent displays of batch experiments]", false, IType.BOOL, - true).in(GamaPreferences.Runtime.NAME, GamaPreferences.Runtime.CONCURRENCY); + "In batch, allows to run simulations with all available processors" + + "[WARNING: disables reflexes and permanent displays of batch experiments]", + false, IType.BOOL, true).in(GamaPreferences.Runtime.NAME, GamaPreferences.Runtime.CONCURRENCY); /** The Constant CONCURRENCY_GRID. */ public static final Pref CONCURRENCY_GRID = create("pref_parallel_grids", diff --git a/msi.gama.documentation/files/input/toc/toc1.9.0.xml b/msi.gama.documentation/files/input/toc/toc1.9.0.xml index b829e687c6..2db1559a55 100644 --- a/msi.gama.documentation/files/input/toc/toc1.9.0.xml +++ b/msi.gama.documentation/files/input/toc/toc1.9.0.xml @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/msi.gama.ext/src/msi/gama/ext/webb/Request.java b/msi.gama.ext/src/msi/gama/ext/webb/Request.java index 64773435ed..88ea8ffff2 100644 --- a/msi.gama.ext/src/msi/gama/ext/webb/Request.java +++ b/msi.gama.ext/src/msi/gama/ext/webb/Request.java @@ -1,9 +1,8 @@ /******************************************************************************************************* * - * msi.gama.util.file.http.Request.java, in plugin msi.gama.core, is part of the source code of the GAMA modeling and - * simulation platform (v. 1.8.1) + * Request.java, in msi.gama.ext, is part of the source code of the GAMA modeling and simulation platform (v.1.9.1). * - * (c) 2007-2020 UMI 209 UMMISCO IRD/SU & Partners + * (c) 2007-2023 UMI 209 UMMISCO IRD/SU & Partners (IRIT, MIAT, TLU, CTU) * * Visit https://github.com/gama-platform/gama for license information and contacts. * @@ -23,29 +22,83 @@ * @author hgoebl */ public class Request { + + /** + * The Enum Method. + */ public enum Method { - GET, POST, PUT, DELETE + + /** The get. */ + GET, + /** The post. */ + POST, + /** The put. */ + PUT, + /** The delete. */ + DELETE } + /** The webb. */ private final Webb webb; + + /** The method. */ final Method method; + + /** The uri. */ final String uri; + /** The params. */ Map params; + + /** The multiple values. */ boolean multipleValues; + + /** The headers. */ Map headers; + + /** The payload. */ Object payload; + + /** The stream payload. */ boolean streamPayload; + + /** The use caches. */ boolean useCaches; + + /** The connect timeout. */ Integer connectTimeout; + + /** The read timeout. */ Integer readTimeout; + + /** The if modified since. */ Long ifModifiedSince; + + /** The follow redirects. */ Boolean followRedirects; + + /** The ensure success. */ boolean ensureSuccess; + + /** The compress. */ boolean compress; + + /** The retry count. */ int retryCount; + + /** The wait exponential. */ boolean waitExponential; + /** + * Instantiates a new request. + * + * @param webb + * the webb + * @param method + * the method + * @param uri + * the uri + */ Request(final Webb webb, final Method method, final String uri) { this.webb = webb; this.method = method; @@ -58,9 +111,7 @@ public enum Method { * * @return URI */ - public String getUri() { - return uri; - } + public String getUri() { return uri; } /** * Set (or overwrite) a HTTP header value.
@@ -83,9 +134,7 @@ public String getUri() { * @return this for method chaining (fluent API) */ public Request header(final String name, final Object value) { - if (headers == null) { - headers = new LinkedHashMap<>(); - } + if (headers == null) { headers = new LinkedHashMap<>(); } headers.put(name, value); return this; } @@ -119,9 +168,8 @@ public Request header(final String name, final Object value) { * @return this for method chaining (fluent API) */ public Request body(final Object body) { - if (method == Method.GET || method == Method.DELETE) { + if (method == Method.GET || method == Method.DELETE) throw new IllegalStateException("body not allowed for request method " + method); - } this.payload = body; this.streamPayload = body instanceof File || body instanceof InputStream; return this; @@ -183,15 +231,9 @@ public Request ensureSuccess() { */ public Request retry(final int rc, final boolean waitExponential) { int retryCount = rc; - if (retryCount < 0) { - retryCount = 0; - } - if (retryCount > 10) { - retryCount = 10; - } - if (retryCount > 3 && !waitExponential) { - throw new IllegalArgumentException("retries > 3 only valid with wait"); - } + if (retryCount < 0) { retryCount = 0; } + if (retryCount > 10) { retryCount = 10; } + if (retryCount > 3 && !waitExponential) throw new IllegalArgumentException("retries > 3 only valid with wait"); this.retryCount = retryCount; this.waitExponential = waitExponential; return this; diff --git a/msi.gama.ext/src/msi/gama/ext/webb/Response.java b/msi.gama.ext/src/msi/gama/ext/webb/Response.java index 06128683ac..a3ad7dcc4a 100644 --- a/msi.gama.ext/src/msi/gama/ext/webb/Response.java +++ b/msi.gama.ext/src/msi/gama/ext/webb/Response.java @@ -1,9 +1,8 @@ /******************************************************************************************************* * - * msi.gama.util.file.http.Response.java, in plugin msi.gama.core, is part of the source code of the GAMA modeling and - * simulation platform (v. 1.8.1) + * Response.java, in msi.gama.ext, is part of the source code of the GAMA modeling and simulation platform (v.1.9.1). * - * (c) 2007-2020 UMI 209 UMMISCO IRD/SU & Partners + * (c) 2007-2023 UMI 209 UMMISCO IRD/SU & Partners (IRIT, MIAT, TLU, CTU) * * Visit https://github.com/gama-platform/gama for license information and contacts. * @@ -18,40 +17,57 @@ * @author hgoebl */ public class Response { + + /** The request. */ final Request request; + /** The status code. */ int statusCode; + + /** The response message. */ String responseMessage; + + /** The body. */ T body; + + /** The error body. */ Object errorBody; + + /** The connection. */ HttpURLConnection connection; + /** + * Instantiates a new response. + * + * @param request + * the request + */ Response(final Request request) { this.request = request; } + /** + * Sets the body. + * + * @param body + * the new body + */ @SuppressWarnings ("unchecked") - void setBody(final Object body) { - this.body = (T) body; - } + void setBody(final Object body) { this.body = (T) body; } /** * Access to the Request object (which will not be very useful in most cases). * * @return the request object which was responsible for creating this response. */ - public Request getRequest() { - return request; - } + public Request getRequest() { return request; } /** * Returns the payload of the response converted to the given type. * * @return the converted payload (can be null). */ - public T getBody() { - return body; - } + public T getBody() { return body; } /** * Get the body which was returned in case of error (HTTP-Code >= 400).
@@ -67,9 +83,7 @@ public T getBody() { * * @return the error body converted to an object (see above) or null if there is no body or no error. */ - public Object getErrorBody() { - return errorBody; - } + public Object getErrorBody() { return errorBody; } /** * See @@ -77,18 +91,14 @@ public Object getErrorBody() { * * @return An int representing the three digit HTTP Status-Code. */ - public int getStatusCode() { - return statusCode; - } + public int getStatusCode() { return statusCode; } /** * The first line returned by the web-server, like "HTTP/1.1 200 OK". * * @return first header */ - public String getStatusLine() { - return connection.getHeaderField(null); - } + public String getStatusLine() { return connection.getHeaderField(null); } /** * Was the request successful (returning a 2xx status code)? @@ -104,9 +114,7 @@ public boolean isSuccess() { * * @return e.g. "Moved Permanently", "Created", ... */ - public String getResponseMessage() { - return responseMessage; - } + public String getResponseMessage() { return responseMessage; } /** * Returns the MIME-type of the response body.
@@ -115,9 +123,7 @@ public String getResponseMessage() { * * @return e.g. "application/json", "text/plain", ... */ - public String getContentType() { - return connection.getContentType(); - } + public String getContentType() { return connection.getContentType(); } /** * Returns the date when the request was created (server-time).
@@ -126,9 +132,7 @@ public String getContentType() { * * @return the parsed "Date" header as millis or 0 if this header was not set. */ - public long getDate() { - return connection.getDate(); - } + public long getDate() { return connection.getDate(); } /** * Returns the value of the expires header field.
@@ -137,9 +141,7 @@ public long getDate() { * * @return the expiration date of the resource, or 0 if not known. */ - public long getExpiration() { - return connection.getExpiration(); - } + public long getExpiration() { return connection.getExpiration(); } /** * Returns the value of the last-modified header field.
@@ -148,18 +150,14 @@ public long getExpiration() { * * @return the date the resource was last modified, or 0 if not known. */ - public long getLastModified() { - return connection.getLastModified(); - } + public long getLastModified() { return connection.getLastModified(); } /** * Get the "real" connection, typically to call some getters which are not provided by this Response object. * * @return the connection object (many methods throw IllegalStateException depending on the internal state). */ - public HttpURLConnection getConnection() { - return connection; - } + public HttpURLConnection getConnection() { return connection; } /** * A shortcut to check for successful status codes and throw exception in case of non-2xx status codes.
@@ -168,6 +166,6 @@ public HttpURLConnection getConnection() { * exit where the response-code is not suitable for further normal processing. */ public void ensureSuccess() { - if (!isSuccess()) { throw new WebbException("Request failed: " + statusCode + " " + responseMessage, this); } + if (!isSuccess()) throw new WebbException("Request failed: " + statusCode + " " + responseMessage, this); } } diff --git a/msi.gama.ext/src/msi/gama/ext/webb/Webb.java b/msi.gama.ext/src/msi/gama/ext/webb/Webb.java index e4a30c032c..0581c9ea59 100644 --- a/msi.gama.ext/src/msi/gama/ext/webb/Webb.java +++ b/msi.gama.ext/src/msi/gama/ext/webb/Webb.java @@ -1,9 +1,8 @@ /******************************************************************************************************* * - * msi.gama.util.file.http.Webb.java, in plugin msi.gama.core, is part of the source code of the GAMA modeling and - * simulation platform (v. 1.8.1) + * Webb.java, in msi.gama.ext, is part of the source code of the GAMA modeling and simulation platform (v.1.9.1). * - * (c) 2007-2020 UMI 209 UMMISCO IRD/SU & Partners + * (c) 2007-2023 UMI 209 UMMISCO IRD/SU & Partners (IRIT, MIAT, TLU, CTU) * * Visit https://github.com/gama-platform/gama for license information and contacts. * @@ -36,38 +35,87 @@ * @author hgoebl */ public class Webb { + + /** The Constant DEFAULT_USER_AGENT. */ static final String DEFAULT_USER_AGENT = "gama-platform.org/1.0"; + + /** The Constant APP_FORM. */ static final String APP_FORM = "application/x-www-form-urlencoded"; + + /** The Constant APP_JSON. */ static final String APP_JSON = "application/json"; + + /** The Constant APP_BINARY. */ static final String APP_BINARY = "application/octet-stream"; + + /** The Constant TEXT_PLAIN. */ static final String TEXT_PLAIN = "text/plain"; + + /** The Constant HDR_CONTENT_TYPE. */ public static final String HDR_CONTENT_TYPE = "Content-Type"; + + /** The Constant HDR_CONTENT_ENCODING. */ static final String HDR_CONTENT_ENCODING = "Content-Encoding"; + + /** The Constant HDR_ACCEPT_ENCODING. */ static final String HDR_ACCEPT_ENCODING = "Accept-Encoding"; + + /** The Constant HDR_ACCEPT. */ static final String HDR_ACCEPT = "Accept"; + + /** The Constant HDR_USER_AGENT. */ static final String HDR_USER_AGENT = "User-Agent"; + + /** The Constant UTF8. */ static final String UTF8 = "utf-8"; - static final byte[] EMPTY_BYTE_ARRAY = new byte[0]; + /** The Constant EMPTY_BYTE_ARRAY. */ + static final byte[] EMPTY_BYTE_ARRAY = {}; + + /** The Constant BYTE_ARRAY_CLASS. */ @SuppressWarnings ("rawtypes") static final Class BYTE_ARRAY_CLASS = EMPTY_BYTE_ARRAY.getClass(); /** Minimal number of bytes the compressed content must be smaller than uncompressed */ static final int MIN_COMPRESSED_ADVANTAGE = 80; + /** The Constant globalHeaders. */ static final Map globalHeaders = new LinkedHashMap<>(); + + /** The global base uri. */ static String globalBaseUri; + /** The connect timeout. */ static Integer connectTimeout = 10000; // 10 seconds + + /** The read timeout. */ static Integer readTimeout = 3 * 60000; // 5 minutes + + /** The json indent factor. */ static int jsonIndentFactor = -1; + /** The follow redirects. */ Boolean followRedirects = true; + + /** The base uri. */ String baseUri; + + /** The default headers. */ Map defaultHeaders; + + /** The ssl socket factory. */ SSLSocketFactory sslSocketFactory; + + /** The hostname verifier. */ HostnameVerifier hostnameVerifier; + + /** The retry manager. */ RetryManager retryManager; + + /** The proxy. */ Proxy proxy; + /** + * Instantiates a new webb. + */ protected Webb() {} /** @@ -90,9 +138,7 @@ public static Webb create() { * true to automatically follow redirects (HTTP status code 3xx). Default value comes from * HttpURLConnection and should be true. */ - public void setFollowRedirects(final boolean auto) { - this.followRedirects = auto; - } + public void setFollowRedirects(final boolean auto) { this.followRedirects = auto; } /** * Set a custom {@link javax.net.ssl.SSLSocketFactory}, most likely to relax Certification checking. @@ -120,9 +166,7 @@ public void setHostnameVerifier(final HostnameVerifier hostnameVerifier) { * @param proxy * the proxy to be used or null for no proxy. */ - public void setProxy(final Proxy proxy) { - this.proxy = proxy; - } + public void setProxy(final Proxy proxy) { this.proxy = proxy; } /** * Set the base URI for all requests created from this instance.
@@ -133,18 +177,14 @@ public void setProxy(final Proxy proxy) { * the prefix for all URIs of new Requests. * @see #setGlobalBaseUri(String) */ - public void setBaseUri(final String baseUri) { - this.baseUri = baseUri; - } + public void setBaseUri(final String baseUri) { this.baseUri = baseUri; } /** * Returns the base URI of this instance. * * @return base URI */ - public String getBaseUri() { - return baseUri; - } + public String getBaseUri() { return baseUri; } /** * Registers an alternative {@link com.goebl.david.RetryManager}. @@ -152,9 +192,7 @@ public String getBaseUri() { * @param retryManager * the new manager for deciding whether it makes sense to retry a request. */ - public void setRetryManager(final RetryManager retryManager) { - this.retryManager = retryManager; - } + public void setRetryManager(final RetryManager retryManager) { this.retryManager = retryManager; } /** * Creates a GET HTTP request with the specified absolute or relative URI. @@ -192,13 +230,31 @@ public Request delete(final String pathOrUri) { return new Request(this, Request.Method.DELETE, buildPath(pathOrUri)); } + /** + * Builds the path. + * + * @param pathOrUri + * the path or uri + * @return the string + */ private String buildPath(final String pathOrUri) { - if (pathOrUri == null) { throw new IllegalArgumentException("pathOrUri must not be null"); } - if (pathOrUri.startsWith("http://") || pathOrUri.startsWith("https://")) { return pathOrUri; } + if (pathOrUri == null) throw new IllegalArgumentException("pathOrUri must not be null"); + if (pathOrUri.startsWith("http://") || pathOrUri.startsWith("https://")) return pathOrUri; final String myBaseUri = baseUri != null ? baseUri : globalBaseUri; return myBaseUri == null ? pathOrUri : myBaseUri + pathOrUri; } + /** + * Execute. + * + * @param + * the generic type + * @param request + * the request + * @param clazz + * the clazz + * @return the response + */ Response execute(final Request request, final Class clazz) { Response response = null; @@ -206,34 +262,35 @@ Response execute(final Request request, final Class clazz) { // no retry -> just delegate to inner method response = _execute(request, clazz); } else { - if (retryManager == null) { - retryManager = RetryManager.DEFAULT; - } + if (retryManager == null) { retryManager = RetryManager.DEFAULT; } for (int tries = 0; tries <= request.retryCount; ++tries) { try { response = _execute(request, clazz); - if (tries >= request.retryCount || !retryManager.isRetryUseful(response)) { - break; - } + if (tries >= request.retryCount || !retryManager.isRetryUseful(response)) { break; } } catch (final WebbException we) { // analyze: is exception recoverable? - if (tries >= request.retryCount || !retryManager.isRecoverable(we)) { throw we; } - } - if (request.waitExponential) { - retryManager.wait(tries); + if (tries >= request.retryCount || !retryManager.isRecoverable(we)) throw we; } + if (request.waitExponential) { retryManager.wait(tries); } } } - if (response == null) { - throw new IllegalStateException(); // should never reach this line - } - if (request.ensureSuccess) { - response.ensureSuccess(); - } + if (response == null) throw new IllegalStateException(); // should never reach this line + if (request.ensureSuccess) { response.ensureSuccess(); } return response; } + /** + * Execute. + * + * @param + * the generic type + * @param request + * the request + * @param clazz + * the clazz + * @return the response + */ private Response _execute(final Request request, final Class clazz) { final Response response = new Response<>(request); @@ -256,14 +313,10 @@ private Response _execute(final Request request, final Class clazz) { prepareSslConnection(connection); connection.setRequestMethod(request.method.name()); - if (request.followRedirects != null) { - connection.setInstanceFollowRedirects(request.followRedirects); - } + if (request.followRedirects != null) { connection.setInstanceFollowRedirects(request.followRedirects); } connection.setUseCaches(request.useCaches); setTimeouts(request, connection); - if (request.ifModifiedSince != null) { - connection.setIfModifiedSince(request.ifModifiedSince); - } + if (request.ifModifiedSince != null) { connection.setIfModifiedSince(request.ifModifiedSince); } WebbUtils.addRequestProperties(connection, mergeHeaders(request.headers)); if (clazz == JSONObject.class || clazz == JSONArray.class) { @@ -296,17 +349,13 @@ private Response _execute(final Request request, final Class clazz) { is = response.isSuccess() ? connection.getInputStream() : connection.getErrorStream(); is = WebbUtils.wrapStream(connection.getContentEncoding(), is); - if (clazz == InputStream.class) { - is = new AutoDisconnectInputStream(connection, is); - } + if (clazz == InputStream.class) { is = new AutoDisconnectInputStream(connection, is); } if (response.isSuccess()) { WebbUtils.parseResponseBody(clazz, response, is); } else { WebbUtils.parseErrorResponse(clazz, response, is); } - if (clazz == InputStream.class) { - closeStream = false; - } + if (clazz == InputStream.class) { closeStream = false; } return response; @@ -334,6 +383,14 @@ private Response _execute(final Request request, final Class clazz) { } } + /** + * Sets the timeouts. + * + * @param request + * the request + * @param connection + * the connection + */ private void setTimeouts(final Request request, final HttpURLConnection connection) { if (request.connectTimeout != null || connectTimeout != null) { connection.setConnectTimeout(request.connectTimeout != null ? request.connectTimeout : connectTimeout); @@ -343,6 +400,16 @@ private void setTimeouts(final Request request, final HttpURLConnection connecti } } + /** + * Write body. + * + * @param connection + * the connection + * @param body + * the body + * @throws IOException + * Signals that an I/O exception has occurred. + */ private void writeBody(final HttpURLConnection connection, final byte[] body) throws IOException { // Android StrictMode might complain about not closing the connection: // "E/StrictMode﹕ A resource was acquired at attached stack trace but never released" @@ -356,6 +423,18 @@ private void writeBody(final HttpURLConnection connection, final byte[] body) th } } + /** + * Stream body. + * + * @param connection + * the connection + * @param body + * the body + * @param compress + * the compress + * @throws IOException + * Signals that an I/O exception has occurred. + */ private void streamBody(final HttpURLConnection connection, final Object body, final boolean compress) throws IOException { InputStream is; @@ -384,18 +463,26 @@ private void streamBody(final HttpURLConnection connection, final Object body, f } } + /** + * Prepare ssl connection. + * + * @param connection + * the connection + */ private void prepareSslConnection(final HttpURLConnection connection) { - if ((hostnameVerifier != null || sslSocketFactory != null) && connection instanceof HttpsURLConnection) { - final HttpsURLConnection sslConnection = (HttpsURLConnection) connection; - if (hostnameVerifier != null) { - sslConnection.setHostnameVerifier(hostnameVerifier); - } - if (sslSocketFactory != null) { - sslConnection.setSSLSocketFactory(sslSocketFactory); - } + if ((hostnameVerifier != null || sslSocketFactory != null) && connection instanceof HttpsURLConnection sslConnection) { + if (hostnameVerifier != null) { sslConnection.setHostnameVerifier(hostnameVerifier); } + if (sslSocketFactory != null) { sslConnection.setSSLSocketFactory(sslSocketFactory); } } } + /** + * Merge headers. + * + * @param requestHeaders + * the request headers + * @return the map + */ Map mergeHeaders(final Map requestHeaders) { Map headers = null; if (!globalHeaders.isEmpty()) { @@ -403,9 +490,7 @@ Map mergeHeaders(final Map requestHeaders) { headers.putAll(globalHeaders); } if (defaultHeaders != null) { - if (headers == null) { - headers = new LinkedHashMap<>(); - } + if (headers == null) { headers = new LinkedHashMap<>(); } headers.putAll(defaultHeaders); } if (requestHeaders != null) { diff --git a/msi.gama.ext/src/msi/gama/ext/webb/WebbException.java b/msi.gama.ext/src/msi/gama/ext/webb/WebbException.java index d5b32d14b1..84f00e616c 100644 --- a/msi.gama.ext/src/msi/gama/ext/webb/WebbException.java +++ b/msi.gama.ext/src/msi/gama/ext/webb/WebbException.java @@ -1,9 +1,9 @@ /******************************************************************************************************* * - * msi.gama.util.file.http.WebbException.java, in plugin msi.gama.core, is part of the source code of the GAMA modeling - * and simulation platform (v. 1.8.1) + * WebbException.java, in msi.gama.ext, is part of the source code of the GAMA modeling and simulation platform + * (v.1.9.1). * - * (c) 2007-2020 UMI 209 UMMISCO IRD/SU & Partners + * (c) 2007-2023 UMI 209 UMMISCO IRD/SU & Partners (IRIT, MIAT, TLU, CTU) * * Visit https://github.com/gama-platform/gama for license information and contacts. * @@ -17,17 +17,38 @@ */ public class WebbException extends RuntimeException { + /** The response. */ private Response response; + /** + * Instantiates a new webb exception. + * + * @param message + * the message + */ public WebbException(final String message) { super(message); } + /** + * Instantiates a new webb exception. + * + * @param message + * the message + * @param response + * the response + */ public WebbException(final String message, final Response response) { super(message); this.response = response; } + /** + * Instantiates a new webb exception. + * + * @param cause + * the cause + */ public WebbException(final Throwable cause) { super(cause); } @@ -38,7 +59,5 @@ public WebbException(final Throwable cause) { * * @return the Response object filled with error information like statusCode and errorBody. */ - public Response getResponse() { - return response; - } + public Response getResponse() { return response; } } diff --git a/msi.gama.ext/src/msi/gama/ext/webb/WebbUtils.java b/msi.gama.ext/src/msi/gama/ext/webb/WebbUtils.java index 900fec45c6..dc52e519ec 100644 --- a/msi.gama.ext/src/msi/gama/ext/webb/WebbUtils.java +++ b/msi.gama.ext/src/msi/gama/ext/webb/WebbUtils.java @@ -1,9 +1,8 @@ /******************************************************************************************************* * - * msi.gama.util.file.http.WebbUtils.java, in plugin msi.gama.core, is part of the source code of the GAMA modeling and - * simulation platform (v. 1.8.1) + * WebbUtils.java, in msi.gama.ext, is part of the source code of the GAMA modeling and simulation platform (v.1.9.1). * - * (c) 2007-2020 UMI 209 UMMISCO IRD/SU & Partners + * (c) 2007-2023 UMI 209 UMMISCO IRD/SU & Partners (IRIT, MIAT, TLU, CTU) * * Visit https://github.com/gama-platform/gama for license information and contacts. * @@ -37,6 +36,9 @@ */ public class WebbUtils { + /** + * Instantiates a new webb utils. + */ protected WebbUtils() {} /** @@ -72,6 +74,18 @@ public static String queryString(final Map values) { return sbuf.toString(); } + /** + * Append param. + * + * @param sbuf + * the sbuf + * @param separator + * the separator + * @param entryKey + * the entry key + * @param value + * the value + */ private static void appendParam(final StringBuilder sbuf, final String separator, final String entryKey, final Object value) { final String sValue = value == null ? "" : String.valueOf(value); @@ -135,7 +149,7 @@ private static void appendParam(final StringBuilder sbuf, final String separator * when read or write operation fails */ public static byte[] readBytes(final InputStream is) throws IOException { - if (is == null) { return null; } + if (is == null) return null; final ByteArrayOutputStream baos = new ByteArrayOutputStream(); copyStream(is, baos); return baos.toByteArray(); @@ -155,9 +169,7 @@ public static byte[] readBytes(final InputStream is) throws IOException { public static void copyStream(final InputStream input, final OutputStream output) throws IOException { final byte[] buffer = new byte[1024]; int count; - while ((count = input.read(buffer)) != -1) { - output.write(buffer, 0, count); - } + while ((count = input.read(buffer)) != -1) { output.write(buffer, 0, count); } } /** @@ -175,6 +187,13 @@ public static DateFormat getRfc1123DateFormat() { return format; } + /** + * Url encode. + * + * @param value + * the value + * @return the string + */ static String urlEncode(final String value) { try { return URLEncoder.encode(value, "UTF-8"); @@ -183,17 +202,34 @@ static String urlEncode(final String value) { } } + /** + * Adds the request properties. + * + * @param connection + * the connection + * @param map + * the map + */ static void addRequestProperties(final HttpURLConnection connection, final Map map) { - if (map == null || map.isEmpty()) { return; } + if (map == null || map.isEmpty()) return; for (final Map.Entry entry : map.entrySet()) { addRequestProperty(connection, entry.getKey(), entry.getValue()); } } + /** + * Adds the request property. + * + * @param connection + * the connection + * @param name + * the name + * @param value + * the value + */ static void addRequestProperty(final HttpURLConnection connection, final String name, final Object value) { - if (name == null || name.length() == 0 || value == null) { + if (name == null || name.length() == 0 || value == null) throw new IllegalArgumentException("name and value must not be empty"); - } String valueAsString; if (value instanceof Date) { @@ -207,12 +243,35 @@ static void addRequestProperty(final HttpURLConnection connection, final String connection.addRequestProperty(name, valueAsString); } + /** + * Ensure request property. + * + * @param connection + * the connection + * @param name + * the name + * @param value + * the value + */ static void ensureRequestProperty(final HttpURLConnection connection, final String name, final Object value) { - if (!connection.getRequestProperties().containsKey(name)) { - addRequestProperty(connection, name, value); - } + if (!connection.getRequestProperties().containsKey(name)) { addRequestProperty(connection, name, value); } } + /** + * Gets the payload as bytes and set content type. + * + * @param connection + * the connection + * @param request + * the request + * @param compress + * the compress + * @param jsonIndentFactor + * the json indent factor + * @return the payload as bytes and set content type + * @throws UnsupportedEncodingException + * the unsupported encoding exception + */ static byte[] getPayloadAsBytesAndSetContentType(final HttpURLConnection connection, final Request request, final boolean compress, final int jsonIndentFactor) throws UnsupportedEncodingException { @@ -222,20 +281,18 @@ static byte[] getPayloadAsBytesAndSetContentType(final HttpURLConnection connect if (request.params != null) { WebbUtils.ensureRequestProperty(connection, Webb.HDR_CONTENT_TYPE, Webb.APP_FORM); bodyStr = WebbUtils.queryString(request.params); - } else if (request.payload == null) { + } else if (request.payload == null) return null; - } else if (request.payload instanceof byte[]) { + else if (request.payload instanceof byte[]) { WebbUtils.ensureRequestProperty(connection, Webb.HDR_CONTENT_TYPE, Webb.APP_BINARY); requestBody = (byte[]) request.payload; } else { WebbUtils.ensureRequestProperty(connection, Webb.HDR_CONTENT_TYPE, Webb.TEXT_PLAIN); bodyStr = request.payload.toString(); } - if (bodyStr != null) { - requestBody = bodyStr.getBytes(Webb.UTF8); - } + if (bodyStr != null) { requestBody = bodyStr.getBytes(Webb.UTF8); } - if (requestBody == null) { throw new IllegalStateException(); } + if (requestBody == null) throw new IllegalStateException(); // only compress if the new body is smaller than uncompressed body if (compress && requestBody.length > Webb.MIN_COMPRESSED_ADVANTAGE) { @@ -251,6 +308,16 @@ static byte[] getPayloadAsBytesAndSetContentType(final HttpURLConnection connect return requestBody; } + /** + * Sets the content type and length for streaming. + * + * @param connection + * the connection + * @param request + * the request + * @param compress + * the compress + */ static void setContentTypeAndLengthForStreaming(final HttpURLConnection connection, final Request request, final boolean compress) { @@ -260,9 +327,8 @@ static void setContentTypeAndLengthForStreaming(final HttpURLConnection connecti length = compress ? -1L : ((File) request.payload).length(); } else if (request.payload instanceof InputStream) { length = -1L; - } else { + } else throw new IllegalStateException(); - } if (length > Integer.MAX_VALUE) { length = -1L; // use chunked streaming mode @@ -271,14 +337,19 @@ static void setContentTypeAndLengthForStreaming(final HttpURLConnection connecti WebbUtils.ensureRequestProperty(connection, Webb.HDR_CONTENT_TYPE, Webb.APP_BINARY); if (length < 0) { connection.setChunkedStreamingMode(-1); // use default chunk size - if (compress) { - connection.setRequestProperty(Webb.HDR_CONTENT_ENCODING, "gzip"); - } + if (compress) { connection.setRequestProperty(Webb.HDR_CONTENT_ENCODING, "gzip"); } } else { connection.setFixedLengthStreamingMode((int) length); } } + /** + * Gzip. + * + * @param input + * the input + * @return the byte[] + */ static byte[] gzip(final byte[] input) { try (final ByteArrayOutputStream byteArrayOS = new ByteArrayOutputStream(); GZIPOutputStream gzipOS = new GZIPOutputStream(byteArrayOS);) { @@ -290,21 +361,46 @@ static byte[] gzip(final byte[] input) { } } + /** + * Wrap stream. + * + * @param contentEncoding + * the content encoding + * @param inputStream + * the input stream + * @return the input stream + * @throws IOException + * Signals that an I/O exception has occurred. + */ static InputStream wrapStream(final String contentEncoding, final InputStream inputStream) throws IOException { - if (contentEncoding == null || "identity".equalsIgnoreCase(contentEncoding)) { return inputStream; } - if ("gzip".equalsIgnoreCase(contentEncoding)) { return new GZIPInputStream(inputStream); } - if ("deflate".equalsIgnoreCase(contentEncoding)) { + if (contentEncoding == null || "identity".equalsIgnoreCase(contentEncoding)) return inputStream; + if ("gzip".equalsIgnoreCase(contentEncoding)) return new GZIPInputStream(inputStream); + if ("deflate".equalsIgnoreCase(contentEncoding)) return new InflaterInputStream(inputStream, new Inflater(false), 512); - } throw new WebbException("unsupported content-encoding: " + contentEncoding); } + /** + * Parses the response body. + * + * @param + * the generic type + * @param clazz + * the clazz + * @param response + * the response + * @param responseBodyStream + * the response body stream + * @throws UnsupportedEncodingException + * the unsupported encoding exception + * @throws IOException + * Signals that an I/O exception has occurred. + */ static void parseResponseBody(final Class clazz, final Response response, final InputStream responseBodyStream) throws UnsupportedEncodingException, IOException { - if (responseBodyStream == null || clazz == Void.class) { - return; - } else if (clazz == InputStream.class) { + if (responseBodyStream == null || clazz == Void.class) return; + if (clazz == InputStream.class) { response.setBody(responseBodyStream); return; } @@ -314,9 +410,7 @@ static void parseResponseBody(final Class clazz, final Response respon // try to force the content based on the type the client is expecting it (clazz) if (clazz == String.class) { response.setBody(new String(responseBody, Webb.UTF8)); - } else if (clazz == Webb.BYTE_ARRAY_CLASS) { - response.setBody(responseBody); - } + } else if (clazz == Webb.BYTE_ARRAY_CLASS) { response.setBody(responseBody); } // else if (clazz == JSONObject.class) { // response.setBody(WebbUtils.toJsonObject(responseBody)); // } else if (clazz == JSONArray.class) { @@ -325,12 +419,27 @@ static void parseResponseBody(final Class clazz, final Response respon } + /** + * Parses the error response. + * + * @param + * the generic type + * @param clazz + * the clazz + * @param response + * the response + * @param responseBodyStream + * the response body stream + * @throws UnsupportedEncodingException + * the unsupported encoding exception + * @throws IOException + * Signals that an I/O exception has occurred. + */ static void parseErrorResponse(final Class clazz, final Response response, final InputStream responseBodyStream) throws UnsupportedEncodingException, IOException { - if (responseBodyStream == null) { - return; - } else if (clazz == InputStream.class) { + if (responseBodyStream == null) return; + if (clazz == InputStream.class) { response.errorBody = responseBodyStream; return; } diff --git a/msi.gama.models/models/GAML Syntax/System/Preferences.gaml b/msi.gama.models/models/GAML Syntax/System/Preferences.gaml index c1a8fc5bb9..db7914631e 100644 --- a/msi.gama.models/models/GAML Syntax/System/Preferences.gaml +++ b/msi.gama.models/models/GAML Syntax/System/Preferences.gaml @@ -1,4 +1,4 @@ -// GAMA 1.8 Preferences saved on 2018-08-03T10:54:14.609 +// GAMA 1.9.1 Preferences saved on 2023-04-15T12:30:39.234417 model preferences @@ -10,6 +10,9 @@ init { //Display grid lines write sample(gama.pref_chart_display_gridlines); + //Resolution of the charts (from 0, small but fast, to 1, best but resource consuming) + write sample(gama.pref_chart_quality); + //Monitor memory and emit a warning if it is low write sample(gama.pref_check_memory); @@ -40,10 +43,16 @@ init { //Default background color ('background' facet of 'display') write sample(gama.pref_display_background_color); + //Default camera to use when none is specified + write sample(gama.pref_display_camera); + + //Limit the number of frames per second + write sample(gama.pref_display_cap_fps); + //Continue to draw displays when in Modeling perspective write sample(gama.pref_display_continue_drawing); - //Default rendering method (Java2D for 2D, OpenGL for 3D) + //Default rendering method write sample(gama.pref_display_default); //Default color of agents @@ -67,6 +76,12 @@ init { //Default highlight color write sample(gama.pref_display_highlight_color); + //Set the sensitivity of the keyboard movements (0 for slow, 1 for fast) + write sample(gama.pref_display_keyboard_factor); + + //Set the default intensity of the ambient and default lights (from 0, completely dark, to 255, completely light) + write sample(gama.pref_display_light_intensity); + //Default line width (facet 'width' of 'draw') write sample(gama.pref_display_line_width); @@ -76,11 +91,11 @@ init { //Keep values in memory (to save them as CSV) write sample(gama.pref_display_memorize_charts); - //Disable acceleration for Java2D (necessary on some configurations) - write sample(gama.pref_display_no_java2d_acceleration); + //Set the sensitivity of the mouse/trackpad movements (0 for slow, 1 fast) + write sample(gama.pref_display_mouse_factor); - //Forces textures dimensions to a power of 2 (e.g. 16x16. Necessary on some configurations) - write sample(gama.pref_display_power_of_2); + //Use Numeric Keypad (2,4,6,8) for camera interaction + write sample(gama.pref_display_numkeyscam); //Display a border around display views write sample(gama.pref_display_show_border); @@ -106,6 +121,9 @@ init { //Synchronize outputs with the simulation write sample(gama.pref_display_synchronized); + //Use GAMA image cache when building textures in OpenGL (potentially faster when running several simulations, but uses more memory) + write sample(gama.pref_display_use_cache); + //Default layout of display views write sample(gama.pref_display_view_layout); @@ -115,12 +133,18 @@ init { //Set the zoom factor (0 for slow, 1 fast) write sample(gama.pref_display_zoom_factor); + //Highlight in yellow the title of value editors when they change + write sample(gama.pref_editors_highligth); + //Text color of errors write sample(gama.pref_error_text_color); //Show execution errors write sample(gama.pref_errors_display); + //Automatically open an editor and point at the faulty part of the model if an error or a warning is thrown + write sample(gama.pref_errors_in_editor); + //Number of errors to display write sample(gama.pref_errors_number); @@ -139,13 +163,19 @@ init { //Auto-run experiments when they are launched write sample(gama.pref_experiment_auto_run); + //Automatically expand the parameters categories + write sample(gama.pref_experiment_expand_params); + + //Set the step duration slider incrementation to linear. If false set to logarithmic + write sample(gama.pref_experiment_type_slider); + //Only display (in the UI and in headless runs) failed and aborted tests write sample(gama.pref_failed_tests); - //Let GAMA decide which CRS to use to project GIS data + //Let GAMA find which CRS to use to project GIS data write sample(gama.pref_gis_auto_crs); - //...or use the following CRS (EPSG code) + //...or use the following EPSG code (the one that will also be used if no projection information is found) write sample(gama.pref_gis_default_crs); //...or use the following CRS (EPSG code) @@ -181,28 +211,34 @@ init { //Trigger warnings when the percentage of available memory is below write sample(gama.pref_memory_threshold); + //Display monitors in the parameters view + write sample(gama.pref_monitors_in_parameters); + + //Add a small increment to the z ordinate of objects to fight visual artefacts + write sample(gama.pref_opengl_z_fighting); + //Optimize the 'at_distance' operator write sample(gama.pref_optimize_at_distance); - //Optimize constant expressions (experimental) - write sample(gama.pref_optimize_constant_expressions); - //Optimize the path computation operators and goto action (but with possible 'jump' issues) write sample(gama.pref_optimize_path_computation); //Optimize spatial queries: add agents only when necessary in the quadtree (still experimental) write sample(gama.pref_optimize_quadtree); - //Make grids schedule their agents in parallel + //Make grids schedule their agents in parallel (beware that setting this to true no longer allows GAMA to ensure the reproducibility of simulations) write sample(gama.pref_parallel_grids); //Make experiments run simulations in parallel write sample(gama.pref_parallel_simulations); - //Make species schedule their agents in parallel + //In batch, allows to run simulations with all available processors[WARNING: disables reflexes and permanent displays of batch experiments] + write sample(gama.pref_parallel_simulations_all); + + //Make species schedule their agents in parallel (beware that setting this to true no longer allows GAMA to ensure the reproducibility of simulations) write sample(gama.pref_parallel_species); - //Max. number of threads to use (available processors: 8) + //Max. number of threads to use (available processors: 10) write sample(gama.pref_parallel_threads); //Number under which agents are executed sequentially @@ -217,12 +253,15 @@ init { //Define a default seed write sample(gama.pref_rng_define_seed); - //Include in the parameters + //Include random number generation parameters in the parameters view write sample(gama.pref_rng_in_parameters); //Default random number generator write sample(gama.pref_rng_name); + //In-memory shapefile mapping (optimizes access to shapefile data in exchange for increased memory usage) + write sample(gama.pref_shapefiles_in_memory); + //Color of Simulation 0 in the UI (console, view tabs) write sample(gama.pref_simulation_color_0); @@ -238,6 +277,12 @@ init { //Color of Simulation 4 in the UI (console, view tabs) write sample(gama.pref_simulation_color_4); + //Forces the spatial index to synchronize its operations. Useful for interactive models where the users interfere or parallel models with concurrency errors. Note that it may slow down simulations with a lot of mobile agents + write sample(gama.pref_synchronize_quadtree); + + //Orient the textures according to the geometry on which they are displayed (may create visual oddities) + write sample(gama.pref_texture_orientation); + //Text color of warnings write sample(gama.pref_warning_text_color); @@ -251,7 +296,10 @@ init { gama.pref_append_simulation_name <- false; //Display grid lines - gama.pref_chart_display_gridlines <- true; + gama.pref_chart_display_gridlines <- false; + + //Resolution of the charts (from 0, small but fast, to 1, best but resource consuming) + gama.pref_chart_quality <- 0.865; //Monitor memory and emit a warning if it is low gama.pref_check_memory <- true; @@ -260,7 +308,7 @@ init { gama.pref_console_buffer <- 20000; //Max. number of characters to display (-1 = unlimited) - gama.pref_console_size <- 20000; + gama.pref_console_size <- 5000; //Wrap long lines (can slow down output) gama.pref_console_wrap <- false; @@ -278,22 +326,28 @@ init { gama.pref_date_time_step <- 1.0; //Apply antialiasing - gama.pref_display_antialias <- false; + gama.pref_display_antialias <- true; //Default background color ('background' facet of 'display') gama.pref_display_background_color <- #white; + //Default camera to use when none is specified + gama.pref_display_camera <- 'From above'; + + //Limit the number of frames per second + gama.pref_display_cap_fps <- true; + //Continue to draw displays when in Modeling perspective gama.pref_display_continue_drawing <- false; - //Default rendering method (Java2D for 2D, OpenGL for 3D) - gama.pref_display_default <- 'Java2D'; + //Default rendering method + gama.pref_display_default <- '3d'; //Default color of agents gama.pref_display_default_color <- #yellow; //Default font to use in 'draw' - gama.pref_display_default_font <- font('Helvetica',12.0,#plain); + gama.pref_display_default_font <- font('Andale Mono',12.0,#plain); //Defaut shape of agents gama.pref_display_default_shape <- 'shape'; @@ -305,31 +359,37 @@ init { gama.pref_display_fast_snapshot <- false; //Display 'flat' histograms - gama.pref_display_flat_charts <- false; + gama.pref_display_flat_charts <- true; //Default highlight color - gama.pref_display_highlight_color <- rgb (0, 200, 200,255); + gama.pref_display_highlight_color <- rgb (0, 200, 200, 255); + + //Set the sensitivity of the keyboard movements (0 for slow, 1 for fast) + gama.pref_display_keyboard_factor <- 0.6900000000000001; + + //Set the default intensity of the ambient and default lights (from 0, completely dark, to 255, completely light) + gama.pref_display_light_intensity <- 160; //Default line width (facet 'width' of 'draw') - gama.pref_display_line_width <- 1.2; + gama.pref_display_line_width <- 0.7999999999999999; //Max. number of frames per second - gama.pref_display_max_fps <- 20; + gama.pref_display_max_fps <- 50; //Keep values in memory (to save them as CSV) - gama.pref_display_memorize_charts <- true; + gama.pref_display_memorize_charts <- false; - //Disable acceleration for Java2D (necessary on some configurations) - gama.pref_display_no_java2d_acceleration <- false; + //Set the sensitivity of the mouse/trackpad movements (0 for slow, 1 fast) + gama.pref_display_mouse_factor <- 0.2; - //Forces textures dimensions to a power of 2 (e.g. 16x16. Necessary on some configurations) - gama.pref_display_power_of_2 <- false; + //Use Numeric Keypad (2,4,6,8) for camera interaction + gama.pref_display_numkeyscam <- false; //Display a border around display views gama.pref_display_show_border <- false; //Show errors thrown in displays and outputs - gama.pref_display_show_errors <- false; + gama.pref_display_show_errors <- true; //Show the display bottom overlay gama.pref_display_show_overlay <- false; @@ -338,17 +398,20 @@ init { gama.pref_display_show_referential <- true; //Draw rotation axes - gama.pref_display_show_rotation <- true; + gama.pref_display_show_rotation <- false; //Show the display top toolbar gama.pref_display_show_toolbar <- true; //Number of slices of circular geometries - gama.pref_display_slice_number <- 16; + gama.pref_display_slice_number <- 12; //Synchronize outputs with the simulation gama.pref_display_synchronized <- false; + //Use GAMA image cache when building textures in OpenGL (potentially faster when running several simulations, but uses more memory) + gama.pref_display_use_cache <- true; + //Default layout of display views gama.pref_display_view_layout <- 'None'; @@ -356,16 +419,22 @@ init { gama.pref_display_visible_agents <- false; //Set the zoom factor (0 for slow, 1 fast) - gama.pref_display_zoom_factor <- 0.5; + gama.pref_display_zoom_factor <- 0.68; + + //Highlight in yellow the title of value editors when they change + gama.pref_editors_highligth <- true; //Text color of errors - gama.pref_error_text_color <- rgb (210, 155, 156,255); + gama.pref_error_text_color <- rgb (210, 155, 156, 255); //Show execution errors gama.pref_errors_display <- true; + //Automatically open an editor and point at the faulty part of the model if an error or a warning is thrown + gama.pref_errors_in_editor <- true; + //Number of errors to display - gama.pref_errors_number <- 10; + gama.pref_errors_number <- 2; //Display most recent first gama.pref_errors_recent_first <- true; @@ -382,13 +451,19 @@ init { //Auto-run experiments when they are launched gama.pref_experiment_auto_run <- false; + //Automatically expand the parameters categories + gama.pref_experiment_expand_params <- true; + + //Set the step duration slider incrementation to linear. If false set to logarithmic + gama.pref_experiment_type_slider <- true; + //Only display (in the UI and in headless runs) failed and aborted tests gama.pref_failed_tests <- false; - //Let GAMA decide which CRS to use to project GIS data + //Let GAMA find which CRS to use to project GIS data gama.pref_gis_auto_crs <- true; - //...or use the following CRS (EPSG code) + //...or use the following EPSG code (the one that will also be used if no projection information is found) gama.pref_gis_default_crs <- 32648; //...or use the following CRS (EPSG code) @@ -407,7 +482,7 @@ init { gama.pref_http_connect_timeout <- 20000; //Empty the local cache of files downloaded from the web - gama.pref_http_empty_cache <- false; + gama.pref_http_empty_cache <- true; //Read timeout (in ms) gama.pref_http_read_timeout <- 20000; @@ -424,32 +499,38 @@ init { //Trigger warnings when the percentage of available memory is below gama.pref_memory_threshold <- 20; + //Display monitors in the parameters view + gama.pref_monitors_in_parameters <- true; + + //Add a small increment to the z ordinate of objects to fight visual artefacts + gama.pref_opengl_z_fighting <- true; + //Optimize the 'at_distance' operator gama.pref_optimize_at_distance <- true; - //Optimize constant expressions (experimental) - gama.pref_optimize_constant_expressions <- false; - //Optimize the path computation operators and goto action (but with possible 'jump' issues) gama.pref_optimize_path_computation <- false; //Optimize spatial queries: add agents only when necessary in the quadtree (still experimental) gama.pref_optimize_quadtree <- false; - //Make grids schedule their agents in parallel + //Make grids schedule their agents in parallel (beware that setting this to true no longer allows GAMA to ensure the reproducibility of simulations) gama.pref_parallel_grids <- false; //Make experiments run simulations in parallel gama.pref_parallel_simulations <- true; - //Make species schedule their agents in parallel + //In batch, allows to run simulations with all available processors[WARNING: disables reflexes and permanent displays of batch experiments] + gama.pref_parallel_simulations_all <- false; + + //Make species schedule their agents in parallel (beware that setting this to true no longer allows GAMA to ensure the reproducibility of simulations) gama.pref_parallel_species <- false; - //Max. number of threads to use (available processors: 8) - gama.pref_parallel_threads <- 4; + //Max. number of threads to use (available processors: 10) + gama.pref_parallel_threads <- 16; //Number under which agents are executed sequentially - gama.pref_parallel_threshold <- 20; + gama.pref_parallel_threshold <- 4; //Tolerance for the comparison of points gama.pref_point_tolerance <- 0.0; @@ -460,29 +541,38 @@ init { //Define a default seed gama.pref_rng_define_seed <- false; - //Include in the parameters + //Include random number generation parameters in the parameters view gama.pref_rng_in_parameters <- false; //Default random number generator - gama.pref_rng_name <- 'mersenne'; + gama.pref_rng_name <- 'parallel'; + + //In-memory shapefile mapping (optimizes access to shapefile data in exchange for increased memory usage) + gama.pref_shapefiles_in_memory <- true; //Color of Simulation 0 in the UI (console, view tabs) - gama.pref_simulation_color_0 <- rgb (74, 97, 144,255); + gama.pref_simulation_color_0 <- rgb (74, 97, 144, 255); //Color of Simulation 1 in the UI (console, view tabs) - gama.pref_simulation_color_1 <- rgb (66, 119, 42,255); + gama.pref_simulation_color_1 <- rgb (66, 119, 42, 255); //Color of Simulation 2 in the UI (console, view tabs) - gama.pref_simulation_color_2 <- rgb (83, 95, 107,255); + gama.pref_simulation_color_2 <- rgb (83, 95, 107, 255); //Color of Simulation 3 in the UI (console, view tabs) - gama.pref_simulation_color_3 <- rgb (195, 98, 43,255); + gama.pref_simulation_color_3 <- rgb (195, 98, 43, 255); //Color of Simulation 4 in the UI (console, view tabs) - gama.pref_simulation_color_4 <- rgb (150, 132, 106,255); + gama.pref_simulation_color_4 <- rgb (150, 132, 106, 255); + + //Forces the spatial index to synchronize its operations. Useful for interactive models where the users interfere or parallel models with concurrency errors. Note that it may slow down simulations with a lot of mobile agents + gama.pref_synchronize_quadtree <- true; + + //Orient the textures according to the geometry on which they are displayed (may create visual oddities) + gama.pref_texture_orientation <- true; //Text color of warnings - gama.pref_warning_text_color <- rgb (255, 201, 162,255); + gama.pref_warning_text_color <- rgb (255, 201, 162, 255); } } diff --git a/msi.gama.parent/pom.xml b/msi.gama.parent/pom.xml index fb1fae4816..3acbcc7789 100644 --- a/msi.gama.parent/pom.xml +++ b/msi.gama.parent/pom.xml @@ -13,12 +13,12 @@ true p2Repo - scp://51.255.46.42/./var/www/gama_updates/1.9.0 + scp://51.255.46.42/./var/www/gama_updates/1.9.1 true p2Repo - scp://51.255.46.42/./var/www/gama_updates/1.9.0 + scp://51.255.46.42/./var/www/gama_updates/1.9.1 @@ -51,7 +51,7 @@ scp://51.255.46.42 - ./var/www/gama_updates/1.9.0 + ./var/www/gama_updates/1.9.1 ${project.build.directory}/repository/ diff --git a/msi.gama.parent/tiny_pom.xml b/msi.gama.parent/tiny_pom.xml index 1c54456abc..87df6d104d 100644 --- a/msi.gama.parent/tiny_pom.xml +++ b/msi.gama.parent/tiny_pom.xml @@ -12,12 +12,12 @@ false p2Repo - scp://51.255.46.42/./var/www/gama_updates/1.9.0 + scp://51.255.46.42/./var/www/gama_updates/1.9.1 false p2Repo - scp://51.255.46.42/./var/www/gama_updates/1.9.0 + scp://51.255.46.42/./var/www/gama_updates/1.9.1 @@ -39,7 +39,7 @@ scp://51.255.46.42 - ./var/www/gama_updates/1.9.0 + ./var/www/gama_updates/1.9.1 ${project.build.directory}/repository/ @@ -245,7 +245,7 @@ 1.2.0-SNAPSHOT 8.1.5.v20120716 0.25.0 - 1.8.1-SNAPSHOT + 1.9.1-SNAPSHOT UTF-8 14.5 3.1.1 diff --git a/msi.gama.processor/pom.xml b/msi.gama.processor/pom.xml index 2d02de4fe0..e85da9a843 100644 --- a/msi.gama.processor/pom.xml +++ b/msi.gama.processor/pom.xml @@ -13,12 +13,12 @@ true p2Repo - scp://51.255.46.42/./var/www/gama_updates/1.9.0 + scp://51.255.46.42/./var/www/gama_updates/1.9.1 true p2Repo - scp://51.255.46.42/./var/www/gama_updates/1.9.0 + scp://51.255.46.42/./var/www/gama_updates/1.9.1 @@ -45,7 +45,7 @@ scp://51.255.46.42 - ./var/www/gama_updates/1.9.0 + ./var/www/gama_updates/1.9.1 ${project.build.directory}/repository/ diff --git a/ummisco.gama.annotations/pom.xml b/ummisco.gama.annotations/pom.xml index 00b3e2e91c..03311c4571 100644 --- a/ummisco.gama.annotations/pom.xml +++ b/ummisco.gama.annotations/pom.xml @@ -11,12 +11,12 @@ true p2Repo - scp://51.255.46.42/./var/www/gama_updates/1.9.0 + scp://51.255.46.42/./var/www/gama_updates/1.9.1 true p2Repo - scp://51.255.46.42/./var/www/gama_updates/1.9.0 + scp://51.255.46.42/./var/www/gama_updates/1.9.1 @@ -43,7 +43,7 @@ scp://51.255.46.42 - ./var/www/gama_updates/1.9.0 + ./var/www/gama_updates/1.9.1 ${project.build.directory}/repository/ diff --git a/ummisco.gama.annotations/src/msi/gama/precompiler/doc/utils/Constants.java b/ummisco.gama.annotations/src/msi/gama/precompiler/doc/utils/Constants.java index d944adc442..ff251f4709 100644 --- a/ummisco.gama.annotations/src/msi/gama/precompiler/doc/utils/Constants.java +++ b/ummisco.gama.annotations/src/msi/gama/precompiler/doc/utils/Constants.java @@ -18,7 +18,7 @@ public class Constants { /** The Constant GAMA_VERSION. */ - public final static String GAMA_VERSION = "1.9.0"; + public final static String GAMA_VERSION = "1.9.1"; /** The Constant CMD_PANDOC. */ // Commandes diff --git a/ummisco.gama.feature.audio/feature.xml b/ummisco.gama.feature.audio/feature.xml index 2cf8bba0cf..8d1d97f7ea 100644 --- a/ummisco.gama.feature.audio/feature.xml +++ b/ummisco.gama.feature.audio/feature.xml @@ -19,12 +19,12 @@ - + - - + + - + - - - + + + diff --git a/ummisco.gama.feature.core.ui/feature.xml b/ummisco.gama.feature.core.ui/feature.xml index a6e674f9f9..44cc5c7b02 100644 --- a/ummisco.gama.feature.core.ui/feature.xml +++ b/ummisco.gama.feature.core.ui/feature.xml @@ -19,7 +19,7 @@ - + diff --git a/ummisco.gama.feature.core/feature.xml b/ummisco.gama.feature.core/feature.xml index 0d9c425f2b..d6ddefaa31 100644 --- a/ummisco.gama.feature.core/feature.xml +++ b/ummisco.gama.feature.core/feature.xml @@ -19,7 +19,7 @@ - + @@ -40,8 +40,8 @@ - - + + - + - + - + - + @@ -41,7 +41,7 @@ - + - - + + - + - + diff --git a/ummisco.gama.feature.models/feature.xml b/ummisco.gama.feature.models/feature.xml index 96a09f1415..db6c0c12dc 100644 --- a/ummisco.gama.feature.models/feature.xml +++ b/ummisco.gama.feature.models/feature.xml @@ -20,7 +20,7 @@ - + - - + + CFBundleExecutable Gama CFBundleGetInfoString - Gama 1.9.0, modeling and simulation platform + Gama 1.9.1, modeling and simulation platform CFBundleIconFile icon.icns CFBundleIdentifier @@ -60,11 +60,11 @@ CFBundlePackageType APPL CFBundleShortVersionString - 1.9.0 + 1.9.1 CFBundleSignature GAMA CFBundleVersion - 1.9.0 + 1.9.1 NSRequiresAquaSystemAppearance True NSHighResolutionCapable diff --git a/ummisco.gama.product/extraresources/headless/osx/gama-headless.sh b/ummisco.gama.product/extraresources/headless/osx/gama-headless.sh index ae54168401..c7b7cbec94 100755 --- a/ummisco.gama.product/extraresources/headless/osx/gama-headless.sh +++ b/ummisco.gama.product/extraresources/headless/osx/gama-headless.sh @@ -38,7 +38,7 @@ esac echo "******************************************************************" -echo "* GAMA version 1.9.0 *" +echo "* GAMA version 1.9.1 *" echo "* http://gama-platform.org *" echo "* (c) 2007-2023 UMI 209 UMMISCO IRD/SU & Partners *" echo "******************************************************************" diff --git a/ummisco.gama.product/extraresources/headless/unix/gama-headless.sh b/ummisco.gama.product/extraresources/headless/unix/gama-headless.sh index dd391455c4..f0b8881305 100755 --- a/ummisco.gama.product/extraresources/headless/unix/gama-headless.sh +++ b/ummisco.gama.product/extraresources/headless/unix/gama-headless.sh @@ -38,7 +38,7 @@ esac echo "******************************************************************" -echo "* GAMA version 1.9.0 *" +echo "* GAMA version 1.9.1 *" echo "* http://gama-platform.org *" echo "* (c) 2007-2023 UMI 209 UMMISCO IRD/SU & Partners *" echo "******************************************************************" diff --git a/ummisco.gama.product/gama.product b/ummisco.gama.product/gama.product index e62391b1da..7cb076ca24 100644 --- a/ummisco.gama.product/gama.product +++ b/ummisco.gama.product/gama.product @@ -77,6 +77,7 @@ + diff --git a/ummisco.gaml.extensions.image/META-INF/MANIFEST.MF b/ummisco.gaml.extensions.image/META-INF/MANIFEST.MF index c67adc16cc..2529a64783 100644 --- a/ummisco.gaml.extensions.image/META-INF/MANIFEST.MF +++ b/ummisco.gaml.extensions.image/META-INF/MANIFEST.MF @@ -7,8 +7,8 @@ Export-Package: ummisco.gaml.extensions.image Bundle-Activator: ummisco.gaml.extensions.image.Activator Bundle-Vendor: UMMISCO Require-Bundle: org.eclipse.core.runtime, - msi.gama.core;bundle-version="1.9.0", - msi.gama.ext;bundle-version="1.9.0" + msi.gama.core, + msi.gama.ext Bundle-ClassPath: . Bundle-RequiredExecutionEnvironment: JavaSE-17 Automatic-Module-Name: ummisco.gaml.extensions.image From 33681ab29cbc89666f1284c871556dddf0cdd82c Mon Sep 17 00:00:00 2001 From: AlexisDrogoul Date: Sat, 15 Apr 2023 13:45:13 +0700 Subject: [PATCH 2/2] Bumps again some things to 1.9 (.1) -- except one. --- msi.gama.core/src/msi/gama/util/GamaColor.java | 2 +- msi.gama.core/src/msi/gaml/operators/Maths.java | 2 +- ummisco.gama.feature.models/feature.xml | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/msi.gama.core/src/msi/gama/util/GamaColor.java b/msi.gama.core/src/msi/gama/util/GamaColor.java index c658a51845..054031fd3a 100644 --- a/msi.gama.core/src/msi/gama/util/GamaColor.java +++ b/msi.gama.core/src/msi/gama/util/GamaColor.java @@ -98,7 +98,7 @@ public static GamaColor getNamed(final String rgb) { colors.put((String) array[i], color); int_colors.put(color.getRGB(), color); } - // A.G add the GAMA Color corresponding to the GAMA1.7 Logo + // A.G add the GAMA Color corresponding to the GAMA 1.9 Logo final GamaColor orange = new NamedGamaColor("gamaorange", new int[] { 244, 165, 40, 1 }); colors.put("gamaorange", orange); int_colors.put(orange.getRGB(), orange); diff --git a/msi.gama.core/src/msi/gaml/operators/Maths.java b/msi.gama.core/src/msi/gaml/operators/Maths.java index 8ca00e375d..7004c5f3fe 100644 --- a/msi.gama.core/src/msi/gaml/operators/Maths.java +++ b/msi.gama.core/src/msi/gaml/operators/Maths.java @@ -153,7 +153,7 @@ public static Double pow(final Double a, final Double b) { examples = { @example ( value = "abs (200 * -1 + 0.5)", equals = "199.5") }) }) - @test ("abs(1.7) = 1.7") + @test ("abs(1.9) = 1.9") @test ("abs(-2.0) = 2.0") @test ("abs(0.0) = 0.0") @test ("abs(-0.0) = 0.0") diff --git a/ummisco.gama.feature.models/feature.xml b/ummisco.gama.feature.models/feature.xml index db6c0c12dc..16b6ee53c9 100644 --- a/ummisco.gama.feature.models/feature.xml +++ b/ummisco.gama.feature.models/feature.xml @@ -8,7 +8,7 @@ colocation-affinity="ummisco.gama.feature.core"> - The library of models of GAMA 1.7.x + The library of models of GAMA 1.9.1