Permalink
Browse files

Various additions to dates, prefs, @action, online documentation

Adds a Generate Processor.jar to simplify the creation of the processor
Better documents elements in a model (actions, global, etc.)
Fixes #2023, adding ?xxx to the console
Fixes #2039, better documentation of attributes declaration
Redefines preferences internal keys for a future use in 'gama' agent
Bases the execution of models on dates by default
Adds preferences for dates
Adds operators for expressing various propperties on dates
Interprets #month and #year with respect to the current date
Changes @action to only allow one type for arguments
Corrects a few models to add explicit #cycles to every(...)
Corrects some SimpleBDI glitches wrt to the argument passed to
primitives
Makes the step button unavailable while the simulation is launching or
stepping
Correctly verifies the arguments passed to primitives
Correct a number of models exhibiting warnings after this change
Signed-off-by: AlexisDrogoul <alexis.drogoul@gmail.com>
  • Loading branch information...
1 parent cf943c7 commit fbd4b1a91d01d55c12410204b41781822287a6f6 @AlexisDrogoul AlexisDrogoul committed Nov 2, 2016
Showing with 5,769 additions and 4,110 deletions.
  1. +2 −0 msi.gama.core/src/msi/gama/common/Activator.java
  2. +302 −271 msi.gama.core/src/msi/gama/common/GamaPreferences.java
  3. +52 −81 msi.gama.core/src/msi/gama/common/util/StringUtils.java
  4. +2 −0 msi.gama.core/src/msi/gama/kernel/model/GamlModelSpecies.java
  5. +156 −92 msi.gama.core/src/msi/gama/kernel/simulation/SimulationAgent.java
  6. +106 −79 msi.gama.core/src/msi/gama/kernel/simulation/SimulationClock.java
  7. +9 −12 msi.gama.core/src/msi/gama/metamodel/population/GamaPopulation.java
  8. +1 −9 msi.gama.core/src/msi/gama/metamodel/population/MetaPopulation.java
  9. +6 −13 msi.gama.core/src/msi/gama/metamodel/topology/AbstractTopology.java
  10. +1 −7 msi.gama.core/src/msi/gama/metamodel/topology/GamaQuadTree.java
  11. +4 −10 msi.gama.core/src/msi/gama/metamodel/topology/graph/GamaSpatialGraph.java
  12. +58 −106 msi.gama.core/src/msi/gama/metamodel/topology/graph/GraphTopology.java
  13. +5 −34 msi.gama.core/src/msi/gama/metamodel/topology/grid/GamaSpatialMatrix.java
  14. +29 −64 msi.gama.core/src/msi/gama/runtime/ExecutionScope.java
  15. +26 −41 msi.gama.core/src/msi/gama/runtime/IScope.java
  16. +33 −63 msi.gama.core/src/msi/gama/runtime/TemporaryScope.java
  17. +62 −63 msi.gama.core/src/msi/gama/runtime/concurrent/GamaExecutorService.java
  18. +128 −27 msi.gama.core/src/msi/gama/util/GAML.java
  19. +5 −0 msi.gama.core/src/msi/gama/util/GamaColor.java
  20. +296 −87 msi.gama.core/src/msi/gama/util/GamaDate.java
  21. +442 −0 msi.gama.core/src/msi/gama/util/GamaDateInterval.java
  22. +17 −9 msi.gama.core/src/msi/gama/util/graph/AbstractGraphNodeAgent.java
  23. +20 −22 msi.gama.core/src/msi/gaml/compilation/AbstractGamlAdditions.java
  24. +1 −1 msi.gama.core/src/msi/gaml/compilation/SymbolTracer.java
  25. +59 −4 msi.gama.core/src/msi/gaml/descriptions/ActionDescription.java
  26. +4 −23 msi.gama.core/src/msi/gaml/descriptions/IDescription.java
  27. +41 −45 msi.gama.core/src/msi/gaml/descriptions/ModelDescription.java
  28. +19 −47 msi.gama.core/src/msi/gaml/descriptions/PrimitiveDescription.java
  29. +69 −70 msi.gama.core/src/msi/gaml/descriptions/SpeciesDescription.java
  30. +9 −18 msi.gama.core/src/msi/gaml/descriptions/StatementDescription.java
  31. +15 −14 msi.gama.core/src/msi/gaml/descriptions/SymbolProto.java
  32. +48 −101 msi.gama.core/src/msi/gaml/descriptions/TypeDescription.java
  33. +87 −75 msi.gama.core/src/msi/gaml/descriptions/VariableDescription.java
  34. +15 −5 msi.gama.core/src/msi/gaml/expressions/AgentVariableExpression.java
  35. +17 −12 msi.gama.core/src/msi/gaml/expressions/GlobalVariableExpression.java
  36. +4 −5 msi.gama.core/src/msi/gaml/expressions/IExpression.java
  37. +1 −1 msi.gama.core/src/msi/gaml/expressions/NowUnitExpression.java
  38. +1 −0 msi.gama.core/src/msi/gaml/expressions/PrimitiveOperator.java
  39. +14 −0 msi.gama.core/src/msi/gaml/expressions/TimeUnitConstantExpression.java
  40. +36 −28 msi.gama.core/src/msi/gaml/expressions/UnitConstantExpression.java
  41. +77 −2 msi.gama.core/src/msi/gaml/operators/Containers.java
  42. +578 −153 msi.gama.core/src/msi/gaml/operators/Dates.java
  43. +477 −221 msi.gama.core/src/msi/gaml/operators/IUnits.java
  44. +2 −2 msi.gama.core/src/msi/gaml/operators/MapComparison.java
  45. +0 −128 msi.gama.core/src/msi/gaml/operators/Stats.java
  46. +0 −9 msi.gama.core/src/msi/gaml/operators/System.java
  47. +181 −135 msi.gama.core/src/msi/gaml/skills/MovingSkill.java
  48. +106 −86 msi.gama.core/src/msi/gaml/skills/MovingSkill3D.java
  49. +90 −24 msi.gama.core/src/msi/gaml/statements/ArgStatement.java
  50. +1 −7 msi.gama.core/src/msi/gaml/statements/ReleaseStatement.java
  51. +8 −18 msi.gama.core/src/msi/gaml/statements/draw/DrawingData.java
  52. +26 −22 msi.gama.core/src/msi/gaml/types/GamaDateType.java
  53. +12 −11 msi.gama.core/src/msi/gaml/types/GamaFontType.java
  54. +14 −13 msi.gama.core/src/msi/gaml/types/GamaStringType.java
  55. +10 −0 msi.gama.core/src/msi/gaml/variables/Variable.java
  56. +10 −10 msi.gama.lang.gaml/src/msi/gama/lang/gaml/GamlRuntimeModule.java
  57. +130 −214 msi.gama.lang.gaml/src/msi/gama/lang/gaml/expression/GamlExpressionCompiler.java
  58. +20 −33 msi.gama.lang.gaml/src/msi/gama/lang/gaml/scoping/BuiltinGlobalScopeProvider.java
  59. +1 −1 msi.gama.models/models/Features/3D Visualization/includes/Boids.gaml
  60. +1 −1 msi.gama.models/models/Features/Agent movement/models/Goto Directed Graph.gaml
  61. +1 −1 msi.gama.models/models/Features/Agent movement/models/Goto Polygon.gaml
  62. +2 −2 msi.gama.models/models/Features/Multi-Level Usage/Corridor.gaml
  63. +2 −2 msi.gama.models/models/Features/Save Statement/models/Save to Text.gaml
  64. +2 −2 msi.gama.models/models/Features/User Interaction/models/User Control Architecture.gaml
  65. +2 −2 msi.gama.models/models/Toy Models/Ants (Foraging and Sorting)/models/Ant Foraging (Simple).gaml
  66. +1 −1 msi.gama.models/models/Toy Models/Comodels/Flood and Evacuation/Adapters/Flood Adapter.gaml
  67. +1 −1 msi.gama.models/models/Toy Models/Epidemiology/models/Susceptible Infected (SI).gaml
  68. +1 −1 msi.gama.models/models/Toy Models/Epidemiology/models/Susceptible Infected Recovered (SIR).gaml
  69. +2 −2 msi.gama.models/models/Toy Models/Sugarscape/models/Sugarscape.gaml
  70. +1 −1 msi.gama.models/models/Tutorials/Incremental Model/models/Incremental Model 2.gaml
  71. +1 −1 msi.gama.models/models/Tutorials/Incremental Model/models/Incremental Model 3.gaml
  72. +1 −1 msi.gama.models/models/Tutorials/Incremental Model/models/Incremental Model 4.gaml
  73. +1 −1 msi.gama.models/models/Tutorials/Incremental Model/models/Incremental Model 5.gaml
  74. +1 −1 msi.gama.models/models/Tutorials/Incremental Model/models/Incremental Model 6.gaml
  75. +1 −1 msi.gama.models/models/Tutorials/Incremental Model/models/Incremental Model 7.gaml
  76. +1 −1 msi.gama.models/models/Tutorials/Predator Prey/models/Model 10.gaml
  77. +1 −1 msi.gama.models/models/Tutorials/Predator Prey/models/Model 11.gaml
  78. +1 −1 msi.gama.models/models/Tutorials/Predator Prey/models/Model 12.gaml
  79. +1 −1 msi.gama.models/models/Tutorials/Predator Prey/models/Model 13.gaml
  80. +1 −1 msi.gama.models/models/Tutorials/Road Traffic/models/Model 06.gaml
  81. +1 −1 msi.gama.models/models/Tutorials/Road Traffic/models/Model 07.gaml
  82. +1 −1 msi.gama.parent/pom.xml
  83. +25 −0 msi.gama.processor/processor/Generate Processor.jardesc
  84. BIN msi.gama.processor/processor/plugins/msi.gama.processor_1.4.0.jar
  85. +37 −58 msi.gama.processor/src/msi/gama/precompiler/GamaProcessor.java
  86. +61 −74 msi.gama.processor/src/msi/gama/precompiler/JavaWriter.java
  87. +1 −1 msi.gaml.architecture.simplebdi/models/BDI Architecture/models/CityEscape_BDI_Emotions.gaml
  88. +1 −1 msi.gaml.architecture.simplebdi/models/BDI Architecture/models/Firefighters_BDI.gaml
  89. +1 −1 msi.gaml.architecture.simplebdi/models/BDI Architecture/models/GoldMiner_BDI.gaml
  90. +715 −389 msi.gaml.architecture.simplebdi/src/msi/gaml/architecture/simplebdi/SimpleBdiArchitecture.java
  91. BIN simtools.gaml.extensions.traffic/models/Driving Skill/includes/nodes.dbf
  92. BIN simtools.gaml.extensions.traffic/models/Driving Skill/includes/nodes.fix
  93. BIN simtools.gaml.extensions.traffic/models/Driving Skill/includes/nodes.shp
  94. BIN simtools.gaml.extensions.traffic/models/Driving Skill/includes/nodes.shx
  95. BIN simtools.gaml.extensions.traffic/models/Driving Skill/includes/roads.dbf
  96. +2 −2 simtools.gaml.extensions.traffic/models/Driving Skill/models/Road Traffic simple (City).gaml
  97. +1 −1 simtools.gaml.extensions.traffic/src/simtools/gaml/extensions/traffic/AdvancedDrivingSkill.java
  98. +131 −53 simtools.gaml.extensions.traffic/src/simtools/gaml/extensions/traffic/DrivingSkill.java
  99. +2 −3 ummisco.gama.annotations/src/msi/gama/common/interfaces/IKeyword.java
  100. +251 −352 ummisco.gama.annotations/src/msi/gama/precompiler/GamlAnnotations.java
  101. +27 −37 ummisco.gama.annotations/src/msi/gama/precompiler/doc/DocProcessorAnnotations.java
  102. +1 −1 ummisco.gama.network/models/Network/Multi-simulation Round Trip.gaml
  103. +1 −1 ummisco.gama.network/models/Network/Multi-simulation Round Trip_reciever.gaml
  104. +1 −1 ummisco.gama.network/models/Network/Multi-simulation Round Trip_sender.gaml
  105. +1 −1 ummisco.gama.network/models/Network/TCP Battleship/TCP Client Battleship.gaml
  106. +1 −1 ummisco.gama.network/models/Network/TCP Battleship/TCP Client Battleship2.gaml
  107. +1 −1 ummisco.gama.network/models/Network/TCP/TCP Client Example.gaml
  108. +1 −1 ummisco.gama.network/models/Network/TCP/TCP Server Example .gaml
  109. +1 −1 ummisco.gama.serialize/src/ummisco/gama/serializer/gamaType/reduced/GamaSimulationAgentReducer.java
  110. +10 −3 ummisco.gama.ui.experiment/plugin.xml
  111. +17 −20 ummisco.gama.ui.experiment/src/ummisco/gama/ui/views/console/InteractiveConsoleView.java
  112. +76 −77 ummisco.gama.ui.modeling/src/msi/gama/lang/gaml/ui/AutoStartup.java
  113. +29 −23 ummisco.gama.ui.modeling/src/msi/gama/lang/gaml/ui/editor/GamlMarkOccurrenceActionContributor.java
  114. +6 −13 ummisco.gama.ui.modeling/src/msi/gama/lang/gaml/ui/editor/toolbar/EditToolbar.java
  115. +12 −12 ummisco.gama.ui.modeling/src/msi/gama/lang/gaml/ui/hover/GamlDocumentationProvider.java
  116. +23 −33 ummisco.gama.ui.modeling/src/msi/gama/lang/gaml/ui/hover/GamlHoverProvider.java
  117. +73 −91 ummisco.gama.ui.shared/src/ummisco/gama/ui/parameters/AbstractEditor.java
  118. +5 −8 ummisco.gama.ui.shared/src/ummisco/gama/ui/parameters/ColorEditor.java
  119. +106 −0 ummisco.gama.ui.shared/src/ummisco/gama/ui/parameters/DateEditor.java
  120. +42 −41 ummisco.gama.ui.shared/src/ummisco/gama/ui/parameters/EditorFactory.java
  121. +5 −5 ummisco.gama.ui.shared/src/ummisco/gama/ui/parameters/ExpressionBasedEditor.java
  122. +26 −22 ummisco.gama.ui.shared/src/ummisco/gama/ui/parameters/ExpressionControl.java
  123. +78 −79 ummisco.gama.ui.shared/src/ummisco/gama/ui/utils/PreferencesHelper.java
  124. +21 −44 ummisco.gama.ui.shared/src/ummisco/gama/ui/utils/SwtGui.java
  125. +4 −3 ummisco.gaml.extensions.stats/src/ummisco/gaml/extensions/stats/Stats2.java
@@ -5,6 +5,7 @@
import msi.gama.runtime.concurrent.GamaExecutorService;
import msi.gaml.compilation.kernel.GamaBundleLoader;
+import msi.gaml.operators.Dates;
public class Activator implements BundleActivator {
@@ -14,6 +15,7 @@ public void start(final BundleContext context) throws Exception {
new Thread(() -> {
GamaBundleLoader.preBuildContributions();
GamaExecutorService.startUp();
+ Dates.initialize();
}).start();
}
Oops, something went wrong.
@@ -1,9 +1,8 @@
/*********************************************************************************************
*
*
- * 'StringUtils.java', in plugin 'msi.gama.core', is part of the source code of the
- * GAMA modeling and simulation platform.
- * (c) 2007-2014 UMI 209 UMMISCO IRD/UPMC & Partners
+ * 'StringUtils.java', in plugin 'msi.gama.core', is part of the source code of the GAMA modeling and simulation
+ * platform. (c) 2007-2014 UMI 209 UMMISCO IRD/UPMC & Partners
*
* Visit https://code.google.com/p/gama-platform/ for license information and developers contact.
*
@@ -34,7 +33,7 @@
* @since 13 d�c. 2011
*
*/
-@SuppressWarnings({ "rawtypes", "unchecked" })
+@SuppressWarnings ({ "rawtypes", "unchecked" })
public class StringUtils {
final static String strings = "'(?:[^\\\\']+|\\\\.)*'"; // Old:
@@ -45,9 +44,7 @@
final static String regex = strings + "|" + literals + "|" + operators + "|" + ponctuation;
static public String toGamlString(final String s) {
- if (s == null) {
- return null;
- }
+ if (s == null) { return null; }
final StringBuilder sb = new StringBuilder(s.length());
sb.append('\'');
sb.append(StringEscapeUtils.escapeJava(s));
@@ -56,23 +53,15 @@ static public String toGamlString(final String s) {
}
static public String toJavaString(final String s) {
- if (s == null) {
- return null;
- }
+ if (s == null) { return null; }
final String t = s.trim();
- if (!isGamaString(t)) {
- return s;
- }
- if (t.length() >= 2) {
- return t.substring(1, t.length() - 1);
- }
+ if (!isGamaString(t)) { return s; }
+ if (t.length() >= 2) { return t.substring(1, t.length() - 1); }
return s;
}
public static List<String> tokenize(final String expression) {
- if (expression == null) {
- return Collections.EMPTY_LIST;
- }
+ if (expression == null) { return Collections.EMPTY_LIST; }
final Pattern p = Pattern.compile(regex);
final List<String> tokens = new ArrayList<String>();
final Matcher m = p.matcher(expression);
@@ -91,9 +80,7 @@ static public String toJavaString(final String s) {
* @return the string
*/
static public String unescapeJava(final String str) {
- if (str == null) {
- return null;
- }
+ if (str == null) { return null; }
final StringBuilder writer = new StringBuilder(str.length());
unescapeJava(writer, str);
@@ -117,9 +104,7 @@ static public String unescapeJava(final String str) {
* the str
*/
static private void unescapeJava(final StringBuilder writer, final String str) {
- if (str == null) {
- return;
- }
+ if (str == null) { return; }
final int sz = str.length();
boolean hadSlash = false;
@@ -149,38 +134,38 @@ static private void unescapeJava(final StringBuilder writer, final String str) {
// handle an escaped value
hadSlash = false;
switch (ch) {
- case '\\':
- writer.append('\\');
- break;
- case '\'':
- writer.append('\'');
- break;
- case '\"':
- writer.append('"');
- break;
- case 'r':
- writer.append('\r');
- break;
- case 'f':
- writer.append('\f');
- break;
- case 't':
- writer.append('\t');
- break;
- case 'n':
- writer.append('\n');
- break;
- case 'b':
- writer.append('\b');
- break;
- case 'u': {
- // uh-oh, we're in unicode country....
- inUnicode = true;
- break;
- }
- default:
- writer.append(ch);
- break;
+ case '\\':
+ writer.append('\\');
+ break;
+ case '\'':
+ writer.append('\'');
+ break;
+ case '\"':
+ writer.append('"');
+ break;
+ case 'r':
+ writer.append('\r');
+ break;
+ case 'f':
+ writer.append('\f');
+ break;
+ case 't':
+ writer.append('\t');
+ break;
+ case 'n':
+ writer.append('\n');
+ break;
+ case 'b':
+ writer.append('\b');
+ break;
+ case 'u': {
+ // uh-oh, we're in unicode country....
+ inUnicode = true;
+ break;
+ }
+ default:
+ writer.append(ch);
+ break;
}
continue;
} else if (ch == '\\') {
@@ -196,19 +181,11 @@ static private void unescapeJava(final StringBuilder writer, final String str) {
}
static public boolean isGamaString(final String s) {
- if (s == null) {
- return false;
- }
+ if (s == null) { return false; }
final int n = s.length();
- if (n == 0 || n == 1) {
- return false;
- }
- if (s.charAt(0) != '\'') {
- return false;
- }
- if (s.charAt(n - 1) != '\'') {
- return false;
- }
+ if (n == 0 || n == 1) { return false; }
+ if (s.charAt(0) != '\'') { return false; }
+ if (s.charAt(n - 1) != '\'') { return false; }
return true;
}
@@ -218,22 +195,16 @@ static public boolean isGamaString(final String s) {
static {
SYMBOLS = new DecimalFormatSymbols();
SYMBOLS.setDecimalSeparator('.');
+ SYMBOLS.setInfinity("#infinity");
+ SYMBOLS.setNaN("#nan");
DEFAULT_DECIMAL_FORMAT = new DecimalFormat("##0.0################", SYMBOLS);
}
public static String toGaml(final Object val, final boolean includingBuiltIn) {
- if (val == null) {
- return "nil";
- }
- if (val instanceof IGamlable) {
- return ((IGamlable) val).serialize(includingBuiltIn);
- }
- if (val instanceof String) {
- return toGamlString((String) val);
- }
- if (val instanceof Double) {
- return DEFAULT_DECIMAL_FORMAT.format(val);
- }
+ if (val == null) { return "nil"; }
+ if (val instanceof IGamlable) { return ((IGamlable) val).serialize(includingBuiltIn); }
+ if (val instanceof String) { return toGamlString((String) val); }
+ if (val instanceof Double) { return DEFAULT_DECIMAL_FORMAT.format(val); }
if (val instanceof Collection) {
final IList l = GamaListFactory.create(Types.STRING);
l.addAll((Collection) val);
@@ -213,8 +213,10 @@ public void setChildren(final Iterable<? extends ISymbol> children) {
final List forExperiment = new ArrayList<>();
final List<IExperimentPlan> experiments = new ArrayList<>();
+
for (final Iterator<? extends ISymbol> it = children.iterator(); it.hasNext();) {
final ISymbol s = it.next();
+
if (s instanceof IExperimentPlan) {
experiments.add((IExperimentPlan) s);
it.remove();
Oops, something went wrong.

0 comments on commit fbd4b1a

Please sign in to comment.