Permalink
Browse files

Follow-up on the cleansing of the warnings in GAMA code

Signed-off-by: AlexisDrogoul <alexis.drogoul@gmail.com>
  • Loading branch information...
1 parent 52b9fce commit cb31eaf8996708c1dae3777c301dbd076df20ebb @AlexisDrogoul AlexisDrogoul committed Oct 5, 2016
Showing with 5,041 additions and 4,667 deletions.
  1. +6 −6 irit.gaml.extensions.test/src/irit/gaml/extensions/test/statements/AssertStatement.java
  2. +1 −1 msi.gama.application/src/msi/gama/application/workbench/PerspectiveHelper.java
  3. +1 −0 msi.gama.core/src/msi/gama/common/util/GeometryUtils.java
  4. +1 −0 msi.gama.core/src/msi/gama/kernel/experiment/BatchAgent.java
  5. +1 −2 msi.gama.core/src/msi/gama/kernel/experiment/ExperimentAgent.java
  6. +7 −10 msi.gama.core/src/msi/gama/kernel/model/GamlModelSpecies.java
  7. +1 −1 msi.gama.core/src/msi/gama/kernel/simulation/SimulationAgent.java
  8. +1 −2 msi.gama.core/src/msi/gama/metamodel/agent/AbstractAgent.java
  9. +1 −0 msi.gama.core/src/msi/gama/metamodel/population/GamaPopulation.java
  10. +1 −3 msi.gama.core/src/msi/gama/metamodel/topology/AbstractTopology.java
  11. +1 −2 msi.gama.core/src/msi/gama/metamodel/topology/CompoundSpatialIndex.java
  12. +21 −22 msi.gama.core/src/msi/gama/metamodel/topology/graph/AStar.java
  13. +2 −2 msi.gama.core/src/msi/gama/outputs/ExperimentOutputManager.java
  14. +1 −2 msi.gama.core/src/msi/gama/outputs/display/AbstractDisplayGraphics.java
  15. +4 −6 msi.gama.core/src/msi/gama/outputs/layers/AgentLayerStatement.java
  16. +1 −2 msi.gama.core/src/msi/gama/outputs/layers/charts/ChartDataSeries.java
  17. +22 −27 msi.gama.core/src/msi/gama/outputs/layers/charts/ChartDataSet.java
  18. +3 −4 msi.gama.core/src/msi/gama/outputs/layers/charts/ChartJFreeChartOutput.java
  19. +2 −6 msi.gama.core/src/msi/gama/outputs/layers/charts/ChartJFreeChartOutputHeatmap.java
  20. +3 −7 msi.gama.core/src/msi/gama/outputs/layers/charts/ChartJFreeChartOutputScatter.java
  21. +1 −2 msi.gama.core/src/msi/gama/runtime/AbstractScope.java
  22. +10 −15 msi.gama.core/src/msi/gama/util/file/CsvReader.java
  23. +1 −2 msi.gama.core/src/msi/gama/util/file/CsvWriter.java
  24. +3 −2 msi.gama.core/src/msi/gama/util/path/GamaSpatialPath.java
  25. +5 −4 msi.gama.core/src/msi/gaml/descriptions/StatementDescription.java
  26. +12 −21 msi.gama.core/src/msi/gaml/expressions/AbstractNAryOperator.java
  27. +132 −184 msi.gama.core/src/msi/gaml/operators/Colors.java
  28. +1 −1 msi.gama.core/src/msi/gaml/operators/Spatial.java
  29. +1 −0 msi.gama.core/src/msi/gaml/operators/Stats.java
  30. +709 −551 msi.gama.core/src/msi/gaml/operators/fastmaths/CmnFastMath.java
  31. +13 −21 msi.gama.core/src/msi/gaml/operators/fastmaths/FastMath.java
  32. +2 −2 msi.gama.core/src/msi/gaml/skills/MovingSkill.java
  33. +1 −1 msi.gama.core/src/msi/gaml/statements/AbstractStatement.java
  34. +1 −1 msi.gama.core/src/msi/gaml/statements/ReleaseStatement.java
  35. +1 −3 msi.gama.core/src/msi/gaml/statements/draw/DrawingData.java
  36. +1 −2 msi.gama.documentation/src/msi/gama/doc/util/CheckConcepts.java
  37. +53 −55 msi.gama.headless/src/msi/ummisco/modelLibraryGenerator/CheckConcepts.java
  38. +524 −412 msi.gama.headless/src/msi/ummisco/modelLibraryGenerator/modelLibraryGenerator.java
  39. +404 −358 msi.gama.processor/src/msi/gama/precompiler/GamlDocProcessor.java
  40. +9 −4 msi.gaml.architecture.simplebdi/src/msi/gaml/architecture/simplebdi/ConsciousContagionStatement.java
  41. +152 −143 msi.gaml.architecture.simplebdi/src/msi/gaml/architecture/simplebdi/Emotion.java
  42. +8 −4 ...aml.architecture.simplebdi/src/msi/gaml/architecture/simplebdi/UnconsciousContagionStatement.java
  43. +18 −22 simtools.gaml.extensions.traffic/src/simtools/gaml/extensions/traffic/AdvancedDrivingSkill.java
  44. +318 −271 ummisco.gama.annotations/src/msi/gama/precompiler/doc/DocProcessorAnnotations.java
  45. +2 −2 ummisco.gama.java2d/src/ummisco/gama/java2d/swing/AwtEnvironment.java
  46. +1 −3 ummisco.gama.network/src/ummisco/gama/network/skills/NetworkSkill.java
  47. +1 −2 ummisco.gama.network/src/ummisco/gama/network/udp/MultiThreadedUDPServer.java
  48. +1 −0 ummisco.gama.opengl/src/ummisco/gama/modernOpenGL/ModernDrawer.java
  49. +47 −40 ummisco.gama.opengl/src/ummisco/gama/modernOpenGL/font/fontMeshCreator/TextMeshCreator.java
  50. +3 −6 ummisco.gama.opengl/src/ummisco/gama/opengl/files/MtlLoader.java
  51. +14 −13 ummisco.gama.opengl/src/ummisco/gama/opengl/vaoGenerator/DrawingEntityGenerator.java
  52. +632 −616 ummisco.gama.opengl/src/ummisco/gama/opengl/vaoGenerator/GeomMathUtils.java
  53. +52 −49 ummisco.gama.opengl/src/ummisco/gama/opengl/vaoGenerator/TransformationMatrix.java
  54. +30 −27 ...sco.gama.serialize/src/ummisco/gama/serializer/gamaType/converters/GamaAgentConverterNetwork.java
  55. +95 −91 ummisco.gama.serialize/src/ummisco/gama/serializer/gaml/ReverseOperators.java
  56. +1 −2 ummisco.gama.ui.experiment/src/ummisco/gama/ui/commands/ArrangeDisplayViews.java
  57. +11 −12 ummisco.gama.ui.experiment/src/ummisco/gama/ui/views/GamaViewPart.java
  58. +1 −2 ummisco.gama.ui.modeling/src/msi/gama/lang/gaml/ui/editbox/BoxSettingsImpl.java
  59. +1 −1 ummisco.gama.ui.modeling/src/msi/gama/lang/gaml/ui/labeling/GamlLabelProvider.java
  60. +59 −84 ummisco.gama.ui.navigator/src/ummisco/gama/ui/navigator/GamaNavigator.java
  61. +51 −47 ummisco.gama.ui.viewers/src/ummisco/gama/ui/viewers/csv/CSVEditorCellModifier.java
  62. +1 −3 ummisco.gama.ui.viewers/src/ummisco/gama/ui/viewers/csv/model/CSVRow.java
  63. +365 −309 ummisco.gama.ui.viewers/src/ummisco/gama/ui/viewers/gis/geotools/SwtMapPane.java
  64. +49 −84 ummisco.gama.ui.viewers/src/ummisco/gama/ui/viewers/gis/geotools/control/CRSChooser.java
  65. +1 −1 ummisco.gama.ui.viewers/src/ummisco/gama/ui/viewers/gis/geotools/control/JDataStoreWizard.java
  66. +36 −32 ummisco.gama.ui.viewers/src/ummisco/gama/ui/viewers/gis/geotools/control/JDoubleField.java
  67. +70 −73 ummisco.gama.ui.viewers/src/ummisco/gama/ui/viewers/gis/geotools/control/JField.java
  68. +165 −153 ummisco.gama.ui.viewers/src/ummisco/gama/ui/viewers/gis/geotools/control/JFileImageChooser.java
  69. +120 −110 ummisco.gama.ui.viewers/src/ummisco/gama/ui/viewers/gis/geotools/control/JParameterListWizard.java
  70. +414 −378 ummisco.gama.ui.viewers/src/ummisco/gama/ui/viewers/gis/geotools/styling/simple/SLDs.java
  71. +357 −341 ummisco.gama.ui.viewers/src/ummisco/gama/ui/viewers/gis/geotools/utils/Utils.java
@@ -83,13 +83,13 @@ public Object privateExecuteIn(final IScope scope) throws GamaRuntimeException {
+ " is not equals to " + equals.value(scope), scope);
}
return null;
- } else {
- if (equals.value(scope) != null) {
- throw GamaRuntimeException.error("Assert equals ERROR : " + value.serialize(false)
- + " is not equals to " + equals.value(scope), scope);
- }
- return null;
}
+ if (equals.value(scope) != null) {
+ throw GamaRuntimeException.error(
+ "Assert equals ERROR : " + value.serialize(false) + " is not equals to " + equals.value(scope),
+ scope);
+ }
+ return null;
}
if (isnot != null) {
@@ -87,7 +87,7 @@ public static boolean openPerspective(final String perspectiveId, final boolean
return true;
IWorkbenchPage activePage = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
- if ( activePage == null && perspectiveId != null )
+ if ( activePage == null )
try {
activePage = PlatformUI.getWorkbench().getActiveWorkbenchWindow().openPage(perspectiveId, null);
} catch (final WorkbenchException e1) {
@@ -1025,6 +1025,7 @@ public static Envelope computeEnvelopeFrom(final IScope scope, final Object obj)
distMin = dist;
}
}
+ @SuppressWarnings("null")
final Coordinate[] coords = ((LineString) geom2).getCoordinates();
final Point pt1 = FACTORY.createPoint(new GamaPoint(pt.getLocation()));
final int nb = coords.length;
@@ -95,6 +95,7 @@ public Object _init_(final IScope scope) {
return this;
}
+ @SuppressWarnings("null")
@Override
public void reset() {
// We first save the results of the various simulations
@@ -673,9 +673,8 @@ public Object getAgentVarValue(final IAgent a, final String name) {
public IGui getGui() {
if (getSpecies().isHeadless()) {
return GAMA.getHeadlessGui();
- } else {
- return GAMA.getRegularGui();
}
+ return GAMA.getRegularGui();
}
}
@@ -170,21 +170,18 @@ public ISpecies getSpecies(final String speciesName, final SpeciesDescription sp
}
// hqnghi 11/Oct/13
// get experiementSpecies in any model
- ISpecies sp = null;
+ ISpecies sp = getExperiment(speciesName);
if (sp == null) {
- sp = getExperiment(speciesName);
- if (sp == null) {
- for (final ISpecies mm : getAllSpecies().values()) {
- if (mm instanceof GamlModelSpecies && specDes.getOriginName().equals(mm.getName())) {
- sp = ((GamlModelSpecies) mm).getExperiment(speciesName);
- if (sp != null) {
- return sp;
- }
+ for (final ISpecies mm : getAllSpecies().values()) {
+ if (mm instanceof GamlModelSpecies && specDes.getOriginName().equals(mm.getName())) {
+ sp = ((GamlModelSpecies) mm).getExperiment(speciesName);
+ if (sp != null) {
+ return sp;
}
}
}
- sp = getAllSpecies().get(speciesName);
}
+ sp = getAllSpecies().get(speciesName);
return sp;
}
@@ -179,7 +179,7 @@ public SimulationAgent getSimulation() {
public void setTopology(final IScope scope, final IShape shape) {
// A topology has already been computed. We update it and updates all
// the agents present in the spatial index
- if (topology instanceof RootTopology) {
+ if (topology != null) {
topology.updateEnvironment(shape);
} else {
final IExpression expr = getSpecies().getFacet(IKeyword.TORUS);
@@ -529,9 +529,8 @@ public IType getType() {
public Object get(final IScope scope, final String index) throws GamaRuntimeException {
if (getPopulation().hasVar(index)) {
return scope.getAgentVarValue(this, index);
- } else {
- return getAttribute(index);
}
+ return getAttribute(index);
}
/**
@@ -410,6 +410,7 @@ public void createVariablesFor(final IScope scope, final List<? extends IAgent>
// }
// }
+ @SuppressWarnings("null")
public void createAndUpdateVariablesFor(final IScope scope, final List<? extends IAgent> agents,
final List<? extends Map> initialValues, final boolean update) throws GamaRuntimeException {
if (agents == null || agents.isEmpty()) {
@@ -322,10 +322,8 @@ public ILocation normalizeLocation3D(final ILocation point, final boolean nullIf
return null;
}
return point;
- } else {
- throw GamaRuntimeException.error("The environement must be a 3D environment (e.g shape <- cube(100).",
- null);
}
+ throw GamaRuntimeException.error("The environement must be a 3D environment (e.g shape <- cube(100).", null);
}
@@ -142,9 +142,8 @@ public IAgent firstAtDistance(final IScope scope, final IShape source, final dou
final int id = findSpatialIndexes(f);
if (id != -1) {
return firstAtDistance(scope, source, f, all[id]);
- } else {
- return firstAtDistance(scope, source, f);
}
+ return firstAtDistance(scope, source, f);
}
@Override
@@ -127,29 +127,28 @@ protected void aStar(final V sourceNode, final V targetNode) {
isPathFound = true;
result = buildPath(current);
return;
- } else {
- openMap.remove(current.node);
- closedMap.put(current.node, current);
- final _Vertex<V, E> node = graph.getVertex(current.node);
- final Set<E> edges = new HashSet<E>(node.getOutEdges());
- if (!graph.isDirected()) {
- edges.addAll(node.getInEdges());
+ }
+ openMap.remove(current.node);
+ closedMap.put(current.node, current);
+ final _Vertex<V, E> node = graph.getVertex(current.node);
+ final Set<E> edges = new HashSet<E>(node.getOutEdges());
+ if (!graph.isDirected()) {
+ edges.addAll(node.getInEdges());
- }
- for (final E edge : edges) {
- final _Edge<V, E> eg = graph.getEdge(edge);
- final V next = (V) (eg.getTarget().equals(current.node) ? eg.getSource() : eg.getTarget());
- if (closedMap.containsKey(next))
- continue;
-
- final double h = heuristic(next, targetNode);
- final double g = current.g + eg.getWeight();
- final ASNode openNode = openMap.get(next);
- if (openNode == null)
- openMap.put(next, new ASNode(next, edge, current, g, h));
- else if (g >= openNode.rank) {
- continue;
- }
+ }
+ for (final E edge : edges) {
+ final _Edge<V, E> eg = graph.getEdge(edge);
+ final V next = (V) (eg.getTarget().equals(current.node) ? eg.getSource() : eg.getTarget());
+ if (closedMap.containsKey(next))
+ continue;
+
+ final double h = heuristic(next, targetNode);
+ final double g = current.g + eg.getWeight();
+ final ASNode openNode = openMap.get(next);
+ if (openNode == null)
+ openMap.put(next, new ASNode(next, edge, current, g, h));
+ else if (g >= openNode.rank) {
+ continue;
}
}
}
@@ -75,8 +75,8 @@ public boolean init(final IScope scope) {
GAMA.startFrontmostExperiment();
}
return true;
- } else
- return false;
+ }
+ return false;
}
protected int getLayout() {
@@ -80,9 +80,8 @@ protected final double hFromModelUnitsToPixels(final double mu) {
public double getxRatioBetweenPixelsAndModelUnits() {
if (currentLayer == null) {
return getDisplayWidth() / data.getEnvWidth();
- } else {
- return currentLayer.getSizeInPixels().x / data.getEnvWidth();
}
+ return currentLayer.getSizeInPixels().x / data.getEnvWidth();
}
@Override
@@ -108,12 +108,10 @@ public void validate(final StatementDescription description) {
description.error(ed.toString() + " is not the description of a species", IGamlIssue.WRONG_TYPE,
ed.getTarget());
return;
- } else {
- if (description.getKeyword().equals(GRID_POPULATION) && !target.isGrid()) {
- description.error(target + " is not a grid", IGamlIssue.WRONG_TYPE, ed.getTarget());
- return;
- }
-
+ }
+ if (description.getKeyword().equals(GRID_POPULATION) && !target.isGrid()) {
+ description.error(target + " is not a grid", IGamlIssue.WRONG_TYPE, ed.getTarget());
+ return;
}
}
ed = description.getFacet(ASPECT);
@@ -227,9 +227,8 @@ private Object getlistvalue(final IScope scope, final HashMap barvalues, final S
return null;
return ol.get(listvalue);
- } else {
- return o;
}
+ return o;
}
@@ -99,22 +99,20 @@ public String getCategories(final IScope scope, final int i) {
if (Xcategories.size() > i) {
return Xcategories.get(i);
- } else {
- for (int c = Xcategories.size(); c <= i; c++) {
- this.Xcategories.add("c" + c);
- }
- return Xcategories.get(i);
}
+ for (int c = Xcategories.size(); c <= i; c++) {
+ this.Xcategories.add("c" + c);
+ }
+ return Xcategories.get(i);
}
public String getLastCategories(final IScope scope) {
if (Xcategories.size() > 0) {
return Xcategories.get(Xcategories.size() - 1);
- } else {
- this.Xcategories.add("c" + 0);
- return Xcategories.get(Xcategories.size() - 1);
}
+ this.Xcategories.add("c" + 0);
+ return Xcategories.get(Xcategories.size() - 1);
}
public void setCategories(final ArrayList<String> categories) {
@@ -537,26 +535,23 @@ public ChartDataSeries createOrGetSerie(final IScope scope, final String id, fin
// TODO Auto-generated method stub
if (series.keySet().contains(id)) {
return series.get(id);
- } else {
- if (deletedseries.keySet().contains(id)) {
- final ChartDataSeries myserie = deletedseries.get(id);
- deletedseries.remove(id);
- this.serieRemovalDate.put(id, -1);
- myserie.setMysource(source);
- myserie.setDataset(this);
- myserie.setName(id);
- addNewSerie(id, myserie, getDate(scope));
- return myserie;
- } else {
- final ChartDataSeries myserie = new ChartDataSeries();
- myserie.setMysource(source);
- myserie.setDataset(this);
- myserie.setName(id);
- addNewSerie(id, myserie, getDate(scope));
- return myserie;
- }
-
}
+ if (deletedseries.keySet().contains(id)) {
+ final ChartDataSeries myserie = deletedseries.get(id);
+ deletedseries.remove(id);
+ this.serieRemovalDate.put(id, -1);
+ myserie.setMysource(source);
+ myserie.setDataset(this);
+ myserie.setName(id);
+ addNewSerie(id, myserie, getDate(scope));
+ return myserie;
+ }
+ final ChartDataSeries myserie = new ChartDataSeries();
+ myserie.setMysource(source);
+ myserie.setDataset(this);
+ myserie.setName(id);
+ addNewSerie(id, myserie, getDate(scope));
+ return myserie;
}
@@ -160,11 +160,10 @@ public void initChart(final IScope scope, final String chartname) {
AbstractRenderer getOrCreateRenderer(final IScope scope, final String serieid) {
if (RendererSet.containsKey(serieid)) {
return RendererSet.get(serieid);
- } else {
- final AbstractRenderer newrenderer = createRenderer(scope, serieid);
- RendererSet.put(serieid, newrenderer);
- return newrenderer;
}
+ final AbstractRenderer newrenderer = createRenderer(scope, serieid);
+ RendererSet.put(serieid, newrenderer);
+ return newrenderer;
}
@@ -379,10 +379,8 @@ public StringBuffer format(final double number, final StringBuffer toAppendTo, f
final int ind = chartdataset.XSeriesValues.indexOf(number);
if (ind >= 0) {
return new StringBuffer("" + chartdataset.Xcategories.get(ind));
- } else {
- return new StringBuffer("");
-
}
+ return new StringBuffer("");
}
@@ -412,10 +410,8 @@ public StringBuffer format(final double number, final StringBuffer toAppendTo, f
final int ind = chartdataset.YSeriesValues.indexOf(number);
if (ind >= 0) {
return new StringBuffer("" + chartdataset.Ycategories.get(ind));
- } else {
- return new StringBuffer("");
-
}
+ return new StringBuffer("");
}
@@ -82,18 +82,16 @@ public Shape getItemShape(final int row, final int col) {
if (isUseSize()) {
transform.setToScale(myoutput.getScale(myid, col), myoutput.getScale(myid, col));
return transform.createTransformedShape(super.getItemShape(row, col));
- } else {
- return super.getItemShape(row, col);
}
+ return super.getItemShape(row, col);
}
}
double getScale(final String serie, final int col) {
if (MarkerScale.containsKey(serie)) {
return MarkerScale.get(serie).get(col);
- } else {
- return 1;
}
+ return 1;
}
HashMap<String, ArrayList<Double>> MarkerScale = new HashMap<String, ArrayList<Double>>();
@@ -504,10 +502,8 @@ public StringBuffer format(final double number, final StringBuffer toAppendTo, f
final int ind = chartdataset.XSeriesValues.indexOf(number);
if (ind >= 0) {
return new StringBuffer("" + chartdataset.Xcategories.get(ind));
- } else {
- return new StringBuffer("");
-
}
+ return new StringBuffer("");
}
@@ -885,9 +885,8 @@ public IGui getGui() {
}
if (experiment.getSpecies().isHeadless()) {
return GAMA.getHeadlessGui();
- } else {
- return GAMA.getRegularGui();
}
+ return GAMA.getRegularGui();
}
@Override
Oops, something went wrong.

0 comments on commit cb31eaf

Please sign in to comment.