Permalink
Browse files

Other code cleansing and adaptation to Java 7/8

Signed-off-by: AlexisDrogoul <alexis.drogoul@gmail.com>
  • Loading branch information...
1 parent 4cc05d8 commit eace5b40158b1bb4a301c166e1650821afb9056e @AlexisDrogoul AlexisDrogoul committed Oct 5, 2016
Showing with 1,536 additions and 1,585 deletions.
  1. +6 −4 irit.gaml.extensions.database/src/msi/gama/database/Activator.java
  2. +9 −10 msi.gama.application/src/msi/gama/application/workbench/PerspectiveHelper.java
  3. +1 −2 msi.gama.core/src/msi/gama/common/util/FileUtils.java
  4. +1 −1 msi.gama.core/src/msi/gama/common/util/GeometryUtils.java
  5. +8 −7 msi.gama.core/src/msi/gama/common/util/ImageUtils.java
  6. +6 −7 msi.gama.core/src/msi/gama/extensions/messaging/GamaMessage.java
  7. +1 −1 msi.gama.core/src/msi/gama/kernel/experiment/ExperimentParameter.java
  8. +1 −3 msi.gama.core/src/msi/gama/metamodel/population/MetaPopulation.java
  9. +1 −2 msi.gama.core/src/msi/gama/metamodel/shape/DynamicLineString.java
  10. +1 −3 msi.gama.core/src/msi/gama/metamodel/topology/graph/GamaSpatialGraph.java
  11. +2 −2 msi.gama.core/src/msi/gama/outputs/ExperimentOutputManager.java
  12. +6 −16 msi.gama.core/src/msi/gama/outputs/FileOutput.java
  13. +1 −2 msi.gama.core/src/msi/gama/outputs/layers/GisLayer.java
  14. +1 −1 msi.gama.core/src/msi/gama/outputs/layers/GridLayer.java
  15. +4 −3 msi.gama.core/src/msi/gama/outputs/layers/ILayerStatement.java
  16. +1 −1 msi.gama.core/src/msi/gama/outputs/layers/SpeciesLayerStatement.java
  17. +5 −6 msi.gama.core/src/msi/gama/outputs/layers/TextLayer.java
  18. +126 −166 msi.gama.core/src/msi/gama/outputs/layers/charts/ChartDataListStatement.java
  19. +4 −4 msi.gama.core/src/msi/gama/outputs/layers/charts/ChartDataSet.java
  20. +1 −1 msi.gama.core/src/msi/gama/outputs/layers/charts/ChartDataSource.java
  21. +3 −3 msi.gama.core/src/msi/gama/outputs/layers/charts/ChartDataSourceList.java
  22. +58 −73 msi.gama.core/src/msi/gama/outputs/layers/charts/ChartDataSourceUnique.java
  23. +1 −1 msi.gama.core/src/msi/gama/outputs/layers/charts/ChartDataStatement.java
  24. +6 −5 msi.gama.core/src/msi/gama/outputs/layers/charts/ChartJFreeChartOutputHistogram.java
  25. +5 −3 msi.gama.core/src/msi/gama/outputs/layers/charts/ChartJFreeChartOutputPie.java
  26. +5 −4 msi.gama.core/src/msi/gama/outputs/layers/charts/ChartJFreeChartOutputRadar.java
  27. +3 −3 msi.gama.core/src/msi/gama/util/GamaMap.java
  28. +3 −1 msi.gama.core/src/msi/gama/util/IList.java
  29. +2 −2 msi.gama.core/src/msi/gama/util/TOrderedHashMap.java
  30. +5 −4 msi.gama.core/src/msi/gama/util/file/CsvReader.java
  31. +2 −4 msi.gama.core/src/msi/gama/util/file/GamaDXFFile.java
  32. +11 −19 msi.gama.core/src/msi/gama/util/file/GamaGridFile.java
  33. +4 −6 msi.gama.core/src/msi/gama/util/file/GamaSVGFile.java
  34. +1 −1 msi.gama.core/src/msi/gama/util/file/GamaShapeFile.java
  35. +1 −1 msi.gama.core/src/msi/gama/util/graph/AbstractGraphNodeAgent.java
  36. +4 −4 msi.gama.core/src/msi/gaml/architecture/user/UserInitPanelStatement.java
  37. +1 −2 msi.gama.core/src/msi/gaml/compilation/ISymbol.java
  38. +1 −3 msi.gama.core/src/msi/gaml/descriptions/AbstractProto.java
  39. +1 −2 msi.gama.core/src/msi/gaml/descriptions/FacetProto.java
  40. +1 −2 msi.gama.core/src/msi/gaml/descriptions/IDescription.java
  41. +24 −25 msi.gama.core/src/msi/gaml/descriptions/ModelDescription.java
  42. +3 −2 msi.gama.core/src/msi/gaml/descriptions/SymbolDescription.java
  43. +1 −2 msi.gama.core/src/msi/gaml/expressions/IExpression.java
  44. +1 −1 msi.gama.core/src/msi/gaml/expressions/ListExpression.java
  45. +1 −1 msi.gama.core/src/msi/gaml/operators/Graphs.java
  46. +1 −1 msi.gama.core/src/msi/gaml/operators/Maths.java
  47. +1 −1 msi.gama.core/src/msi/gaml/statements/Facets.java
  48. +1 −1 msi.gama.core/src/msi/gaml/statements/LoopStatement.java
  49. +4 −3 msi.gama.core/src/msi/gaml/statements/SaveStatement.java
  50. +1 −2 msi.gama.core/src/msi/gaml/types/IType.java
  51. +2 −2 msi.gama.core/src/msi/gaml/variables/Variable.java
  52. +1 −1 msi.gama.documentation/src/msi/gama/doc/websiteGen/utilClasses/ConceptManager.java
  53. +2 −5 msi.gama.ext/src/msi/gama/ext/Activator.java
  54. +169 −161 msi.gama.headless/src/msi/gama/headless/util/WorkspaceManager.java
  55. +1 −1 msi.gama.headless/src/msi/ummisco/modelLibraryGenerator/ConceptManager.java
  56. +2 −2 msi.gama.lang.gaml/src/msi/gama/lang/gaml/expression/GamlExpressionCompiler.java
  57. +1 −2 msi.gama.lang.gaml/src/msi/gama/lang/gaml/indexer/GamlResourceIndexer.java
  58. +2 −2 msi.gama.lang.gaml/src/msi/gama/lang/gaml/linking/GamlLinkingErrorMessageProvider.java
  59. +32 −33 msi.gama.lang.gaml/src/msi/gama/lang/gaml/parsing/GamlSyntacticConverter.java
  60. +2 −3 msi.gama.lang.gaml/src/msi/gama/lang/gaml/parsing/GamlSyntaxErrorMessageProvider.java
  61. +12 −12 msi.gama.lang.gaml/src/msi/gama/lang/gaml/resource/GamlResource.java
  62. +2 −3 msi.gama.lang.gaml/src/msi/gama/lang/gaml/resource/GamlResourceDescriptionManager.java
  63. +1 −1 msi.gama.lang.gaml/src/msi/gama/lang/gaml/resource/GamlResourceServices.java
  64. +32 −25 simtools.gaml.extensions.traffic/src/simtools/gaml/extensions/traffic/AdvancedDrivingSkill.java
  65. +0 −8 simtools.graphanalysis.fr/src/yifanhu/AbstractGraphLayoutStatement.java
  66. +3 −3 ummisco.gama.java2d/src/ummisco/gama/java2d/swing/FocusHandler.java
  67. +3 −3 ummisco.gama.java2d/src/ummisco/gama/java2d/swing/SwingControl.java
  68. +17 −19 ummisco.gama.network/src/ummisco/gama/network/common/GamaNetworkException.java
  69. +11 −8 ummisco.gama.network/src/ummisco/gama/network/common/IConnector.java
  70. +47 −57 ummisco.gama.network/src/ummisco/gama/network/common/NetworkMessage.java
  71. +43 −44 ummisco.gama.network/src/ummisco/gama/network/test/PlayMusicSkill.java
  72. +17 −15 ummisco.gama.opengl/src/ummisco/gama/modernOpenGL/ModernDrawer.java
  73. +1 −1 ummisco.gama.opengl/src/ummisco/gama/opengl/Abstract3DRenderer.java
  74. +8 −5 ummisco.gama.opengl/src/ummisco/gama/opengl/camera/CameraArcBall.java
  75. +1 −1 ummisco.gama.opengl/src/ummisco/gama/opengl/files/Gama3DSFile.java
  76. +2 −2 ummisco.gama.opengl/src/ummisco/gama/opengl/files/GamaObjFile.java
  77. +28 −20 ummisco.gama.opengl/src/ummisco/gama/opengl/jts/JTSDrawer.java
  78. +16 −13 ummisco.gama.opengl/src/ummisco/gama/opengl/scene/FPSLayerObject.java
  79. +57 −41 ummisco.gama.opengl/src/ummisco/gama/opengl/scene/KeystoneHelperLayerObject.java
  80. +19 −18 ummisco.gama.opengl/src/ummisco/gama/opengl/scene/LightsLayerObject.java
  81. +0 −1 ummisco.gama.opengl/src/ummisco/gama/opengl/scene/SceneBuffer.java
  82. +1 −1 ummisco.gama.ui.experiment/src/ummisco/gama/ui/controls/StatusControlContribution.java
  83. +1 −1 ummisco.gama.ui.experiment/src/ummisco/gama/ui/experiment/parameters/AgentAttributesEditorsList.java
  84. +1 −2 ummisco.gama.ui.experiment/src/ummisco/gama/ui/menus/AgentsMenu.java
  85. +2 −2 ummisco.gama.ui.experiment/src/ummisco/gama/ui/views/displays/DisplaySurfaceMenu.java
  86. +305 −237 ummisco.gama.ui.experiment/src/ummisco/gama/ui/views/displays/SWTChartEditor.java
  87. +1 −2 ummisco.gama.ui.experiment/src/ummisco/gama/ui/views/inspectors/AttributesEditorsView.java
  88. +1 −2 ummisco.gama.ui.experiment/src/ummisco/gama/ui/views/inspectors/ExperimentParametersView.java
  89. +1 −2 ummisco.gama.ui.modeling/src/msi/gama/lang/gaml/ui/decorators/GamlAnnotationImageProvider.java
  90. +3 −5 ummisco.gama.ui.modeling/src/msi/gama/lang/gaml/ui/editor/toolbar/EditToolbarFindControls.java
  91. +2 −9 ...co.gama.ui.modeling/src/msi/gama/lang/gaml/ui/editor/toolbar/OpenExperimentSelectionListener.java
  92. +1 −3 ummisco.gama.ui.modeling/src/msi/gama/lang/gaml/ui/labeling/GamlLabelProvider.java
  93. +1 −1 ummisco.gama.ui.navigator/src/ummisco/gama/ui/metadata/FileMetaDataProvider.java
  94. +8 −9 ummisco.gama.ui.navigator/src/ummisco/gama/ui/metadata/ImageDataLoader.java
  95. +24 −31 ummisco.gama.ui.navigator/src/ummisco/gama/ui/navigator/NavigatorContentProvider.java
  96. +2 −2 ummisco.gama.ui.navigator/src/ummisco/gama/ui/navigator/WrappedSyntacticContent.java
  97. +1 −1 ummisco.gama.ui.shared/src/ummisco/gama/ui/controls/ParameterExpandBar.java
  98. +1 −2 ummisco.gama.ui.shared/src/ummisco/gama/ui/menus/GamaColorMenu.java
  99. +1 −1 ummisco.gama.ui.shared/src/ummisco/gama/ui/parameters/AbstractEditor.java
  100. +1 −1 ummisco.gama.ui.shared/src/ummisco/gama/ui/utils/SwtGui.java
  101. +11 −34 ummisco.gama.ui.viewers/src/ummisco/gama/ui/viewers/csv/MultiPageCSVEditor.java
  102. +19 −12 ummisco.gama.ui.viewers/src/ummisco/gama/ui/viewers/csv/text/CSVTextEditor.java
  103. +41 −33 ummisco.gama.ui.viewers/src/ummisco/gama/ui/viewers/gis/GISFileViewer.java
  104. +0 −12 ummisco.gama.ui.viewers/src/ummisco/gama/ui/viewers/gis/geotools/control/CRSChooserDialog.java
  105. +121 −116 ...i.viewers/src/ummisco/gama/ui/viewers/gis/geotools/styling/simple/AbstractSimpleConfigurator.java
  106. +1 −2 ummisco.gama.ui.viewers/src/ummisco/gama/ui/viewers/gis/geotools/tool/GridLayerHelper.java
  107. +2 −2 ummisco.gama.ui.viewers/src/ummisco/gama/ui/viewers/html/HtmlViewer.java
  108. +1 −2 ummisco.gama.ui.viewers/src/ummisco/gama/ui/viewers/image/ImageDataEditorInput.java
  109. +2 −2 ...extensions.maths/src/ummisco/gaml/extensions/maths/ode/statements/SystemOfEquationsStatement.java
  110. +4 −4 ...aml.extensions.maths/src/ummisco/gaml/extensions/maths/ode/utils/solver/AdamsBashforthSolver.java
  111. +4 −4 ....gaml.extensions.maths/src/ummisco/gaml/extensions/maths/ode/utils/solver/AdamsMoultonSolver.java
  112. +2 −3 ...ml.extensions.maths/src/ummisco/gaml/extensions/maths/ode/utils/solver/DormandPrince54Solver.java
  113. +2 −3 ...l.extensions.maths/src/ummisco/gaml/extensions/maths/ode/utils/solver/DormandPrince853Solver.java
  114. +0 −2 ummisco.gaml.extensions.maths/src/ummisco/gaml/extensions/maths/ode/utils/solver/EulerSolver.java
  115. +0 −2 ummisco.gaml.extensions.maths/src/ummisco/gaml/extensions/maths/ode/utils/solver/GillSolver.java
  116. +3 −4 ...extensions.maths/src/ummisco/gaml/extensions/maths/ode/utils/solver/GraggBulirschStoerSolver.java
  117. +3 −4 ....gaml.extensions.maths/src/ummisco/gaml/extensions/maths/ode/utils/solver/HighamHall54Solver.java
  118. +0 −2 ummisco.gaml.extensions.maths/src/ummisco/gaml/extensions/maths/ode/utils/solver/MidpointSolver.java
  119. +1 −3 ummisco.gaml.extensions.maths/src/ummisco/gaml/extensions/maths/ode/utils/solver/Rk4Solver.java
  120. +49 −51 ummisco.gaml.extensions.maths/src/ummisco/gaml/extensions/maths/ode/utils/solver/Solver.java
  121. +0 −2 ...gaml.extensions.maths/src/ummisco/gaml/extensions/maths/ode/utils/solver/ThreeEighthesSolver.java
  122. +36 −36 ummisco.gaml.extensions.rjava/src/ummisco/gaml/extensions/rjava/skill/RSkill.java
@@ -24,10 +24,12 @@ public void start(final BundleContext context) throws Exception {
return null;
}
final Map<String, Object> params = (Map<String, Object>) obj;
- final String crs = (String) params.get("crs");
- final String srid = (String) params.get("srid");
- final Boolean longitudeFirst = params.containsKey("longitudeFirst") ? (Boolean) params.get("longitudeFirst")
- : true;
+ // final String crs = (String) params.get("crs");
+ // final String srid = (String) params.get("srid");
+ // final Boolean longitudeFirst =
+ // params.containsKey("longitudeFirst") ? (Boolean)
+ // params.get("longitudeFirst")
+ // : true;
SqlConnection sqlConn;
Envelope env = null;
// create connection
@@ -7,7 +7,6 @@
import org.eclipse.swt.widgets.Display;
import org.eclipse.ui.IPerspectiveDescriptor;
import org.eclipse.ui.IPerspectiveFactory;
-import org.eclipse.ui.IPerspectiveRegistry;
import org.eclipse.ui.IWorkbenchPage;
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.WorkbenchException;
@@ -25,15 +24,15 @@
public static String currentPerspectiveId = PERSPECTIVE_MODELING_ID;
- private static void cleanPerspectives() {
- final IPerspectiveRegistry reg = PlatformUI.getWorkbench().getPerspectiveRegistry();
- for ( final IPerspectiveDescriptor desc : reg.getPerspectives() ) {
- if ( desc.getId().contains(PERSPECTIVE_SIMULATION_FRAGMENT) &&
- !desc.getId().equals(PERSPECTIVE_SIMULATION_ID) ) {
- reg.deletePerspective(desc);
- }
- }
- }
+ // private static void cleanPerspectives() {
+ // final IPerspectiveRegistry reg = PlatformUI.getWorkbench().getPerspectiveRegistry();
+ // for ( final IPerspectiveDescriptor desc : reg.getPerspectives() ) {
+ // if ( desc.getId().contains(PERSPECTIVE_SIMULATION_FRAGMENT) &&
+ // !desc.getId().equals(PERSPECTIVE_SIMULATION_ID) ) {
+ // reg.deletePerspective(desc);
+ // }
+ // }
+ // }
public static PerspectiveRegistry getPerspectiveRegistry() {
return (PerspectiveRegistry) PlatformUI.getWorkbench().getPerspectiveRegistry();
@@ -16,7 +16,6 @@
import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.net.URLDecoder;
-import java.util.List;
import com.google.common.collect.Iterables;
@@ -97,7 +96,7 @@ static public String constructAbsoluteFilePath(final IScope scope, final String
String filePath = null;
Iterable<String> baseDirectories = null;
final IExperimentAgent a = scope.getExperiment();
- final List<String> referenceDirectories = a.getWorkingPaths();
+ // final List<String> referenceDirectories = a.getWorkingPaths();
try {
baseDirectories = Iterables.transform(a.getWorkingPaths(), each -> {
@@ -1125,7 +1125,7 @@ public static Geometry changeClockWise(final Geometry geom) {
return geom;
}
final Polygon p = (Polygon) geom;
- final double sum = 0.0;
+ // final double sum = 0.0;
final Coordinate[] coords = p.getExteriorRing().getCoordinates();
final Coordinate[] coordsN = new Coordinate[coords.length];
for (int i = 0; i < coords.length; i++) {
@@ -90,13 +90,14 @@ public BufferedImage getImageFromFile(final File file) throws IOException {
if (file.getName().contains(".")) {
final String ext = file.getName().substring(file.getName().lastIndexOf("."));
if (tiffExt.contains(ext)) {
- final FileSeekableStream stream = new FileSeekableStream(file.getAbsolutePath());
- final TIFFDecodeParam decodeParam = new TIFFDecodeParam();
- decodeParam.setDecodePaletteAsShorts(true);
- final ParameterBlock params = new ParameterBlock();
- params.add(stream);
- final RenderedOp image1 = JAI.create("tiff", params);
- image = image1.getAsBufferedImage();
+ try (FileSeekableStream stream = new FileSeekableStream(file.getAbsolutePath())) {
+ final TIFFDecodeParam decodeParam = new TIFFDecodeParam();
+ decodeParam.setDecodePaletteAsShorts(true);
+ final ParameterBlock params = new ParameterBlock();
+ params.add(stream);
+ final RenderedOp image1 = JAI.create("tiff", params);
+ image = image1.getAsBufferedImage();
+ }
}
}
}
@@ -53,16 +53,17 @@
private boolean unread;
private Object sender;
-
+
private Object receivers;
protected Object contents;
protected int emissionTimeStamp;
- private int receptionTimeStamp;
+ // private int receptionTimeStamp;
- public GamaMessage(final IScope scope, final Object sender, final Object receivers, final Object content) throws GamaRuntimeException {
+ public GamaMessage(final IScope scope, final Object sender, final Object receivers, final Object content)
+ throws GamaRuntimeException {
emissionTimeStamp = scope.getClock().getCycle();
unread = true;
setSender(sender);
@@ -112,14 +113,13 @@ public void setReceivers(final Object receivers) {
this.receivers = receivers;
}
-
/**
* Gets the contents of the message.
*
* @return the contents
*/
@getter(GamaMessage.CONTENTS)
- public Object getContents(IScope scope) {
+ public Object getContents(final IScope scope) {
setUnread(false);
return contents;
}
@@ -171,7 +171,6 @@ public int getReceptionTimestamp() {
return emissionTimeStamp;
}
-
@Override
public String serialize(final boolean includingBuiltIn) {
return StringUtils.toGaml(contents, includingBuiltIn);
@@ -198,7 +197,7 @@ public IType getType() {
}
public void hasBeenReceived(final IScope scope) {
- receptionTimeStamp = scope.getClock().getCycle();
+ // receptionTimeStamp = scope.getClock().getCycle();
}
@@ -193,7 +193,7 @@ public void setEditable(final boolean editable) {
isEditable = editable;
}
- private static Object[] JunkResults = new Object[1];
+ // private static Object[] JunkResults = new Object[1];
public void setAndVerifyValue(final IScope scope, final Object val) {
Object newValue = val;
@@ -26,7 +26,6 @@
import msi.gama.metamodel.agent.IAgent;
import msi.gama.metamodel.shape.ILocation;
import msi.gama.metamodel.shape.IShape;
-import msi.gama.metamodel.topology.filter.IAgentFilter;
import msi.gama.runtime.IScope;
import msi.gama.runtime.exceptions.GamaRuntimeException;
import msi.gama.util.GamaListFactory;
@@ -49,8 +48,7 @@
*
*/
@SuppressWarnings({ "rawtypes", "unchecked" })
-public class MetaPopulation
- implements IContainer<Integer, IAgent>, IContainer.Addressable<Integer, IAgent>, IAgentFilter, IPopulationSet {
+public class MetaPopulation implements IContainer.Addressable<Integer, IAgent>, IPopulationSet {
protected final List<IPopulationSet> populationSets;
// We cache the value in case.
@@ -14,7 +14,6 @@
import com.vividsolutions.jts.geom.GeometryFactory;
import com.vividsolutions.jts.geom.GeometryFilter;
import com.vividsolutions.jts.geom.LineString;
-import com.vividsolutions.jts.geom.Lineal;
import com.vividsolutions.jts.geom.Point;
import msi.gama.common.util.GeometryUtils;
@@ -25,7 +24,7 @@
* @author drogoul
*
*/
-public class DynamicLineString extends LineString implements Lineal {
+public class DynamicLineString extends LineString {
// static {
// try {
@@ -30,7 +30,6 @@
import msi.gama.metamodel.shape.ILocation;
import msi.gama.metamodel.shape.IShape;
import msi.gama.metamodel.topology.ITopology;
-import msi.gama.metamodel.topology.filter.IAgentFilter;
import msi.gama.runtime.IScope;
import msi.gama.runtime.exceptions.GamaRuntimeException;
import msi.gama.util.GamaListFactory;
@@ -50,8 +49,7 @@
import msi.gaml.types.Types;
@SuppressWarnings({ "unchecked", "rawtypes" })
-public class GamaSpatialGraph extends GamaGraph<IShape, IShape>
- implements ISpatialGraph, IPopulation.Listener, IAgentFilter {
+public class GamaSpatialGraph extends GamaGraph<IShape, IShape> implements ISpatialGraph, IPopulation.Listener {
/*
* Own topology of the graph. Lazily instantiated, and invalidated at each
@@ -55,7 +55,7 @@ public static ExperimentOutputManager createEmpty() {
return new ExperimentOutputManager(DescriptionFactory.create(IKeyword.PERMANENT, (String[]) null));
}
- private IScope scope;
+ // private IScope scope;
private int layout = GamaPreferences.LAYOUTS.indexOf(GamaPreferences.CORE_DISPLAY_LAYOUT.getValue());
public ExperimentOutputManager(final IDescription desc) {
@@ -64,7 +64,7 @@ public ExperimentOutputManager(final IDescription desc) {
@Override
public boolean init(final IScope scope) {
- this.scope = scope;
+ // this.scope = scope;
final IExpression exp = getFacet(IKeyword.LAYOUT);
if (exp != null) {
layout = Cast.asInt(scope, exp.value(scope));
@@ -144,8 +144,8 @@ public void dispose() {
@Override
public void open() {
- try {
- setWriter(new PrintWriter(file));
+ try (PrintWriter writer = new PrintWriter(file)) {
+ setWriter(writer);
} catch (final FileNotFoundException e) {
e.printStackTrace();
}
@@ -301,18 +301,15 @@ public void doRefreshWriteAndClose(final ParametersSet sol, final Object fitness
setLastValue(fitness);
}
// compute(getOwnScope(), 0l);
- FileWriter fileWriter;
switch (type) {
case XML:
break;
case TEXT:
- try {
- fileWriter = new FileWriter(file, true);
+ try (FileWriter fileWriter = new FileWriter(file, true)) {
if (getLastValue() != null) {
fileWriter.write(getLastValue().toString());
}
fileWriter.flush();
- fileWriter.close();
} catch (final IOException e) {
e.printStackTrace();
}
@@ -331,11 +328,9 @@ public void doRefreshWriteAndClose(final ParametersSet sol, final Object fitness
s.setLength(s.length() - 1);
}
s.append(System.getProperty("line.separator"));
- try {
- fileWriter = new FileWriter(file, true);
+ try (FileWriter fileWriter = new FileWriter(file, true)) {
fileWriter.write(s.toString());
fileWriter.flush();
- fileWriter.close();
} catch (final IOException e) {
e.printStackTrace();
}
@@ -420,16 +415,13 @@ public void setSolution(final ParametersSet solution) {
}
public void writeHeaderAndClose() {
- FileWriter fileWriter;
switch (type) {
case XML:
break;
case TEXT:
- try {
- fileWriter = new FileWriter(file);
+ try (FileWriter fileWriter = new FileWriter(file)) {
fileWriter.write(getHeader());
fileWriter.flush();
- fileWriter.close();
} catch (final IOException e) {
e.printStackTrace();
}
@@ -445,11 +437,9 @@ public void writeHeaderAndClose() {
s.setLength(s.length() - 1);
}
s.append(System.getProperty("line.separator"));
- try {
- fileWriter = new FileWriter(file);
+ try (FileWriter fileWriter = new FileWriter(file)) {
fileWriter.write(s.toString());
fileWriter.flush();
- fileWriter.close();
} catch (final IOException e) {
e.printStackTrace();
}
@@ -12,7 +12,6 @@
package msi.gama.outputs.layers;
import java.awt.Color;
-import java.awt.geom.Rectangle2D;
import java.util.List;
import msi.gama.common.GamaPreferences;
@@ -57,7 +56,7 @@ public void privateDrawDisplay(final IScope scope, final IGraphics g) {
if (geom != null) {
final ShapeDrawingAttributes attributes = new ShapeDrawingAttributes(geom, color,
new GamaColor(Color.black));
- final Rectangle2D r = g.drawShape(geom, attributes);
+ g.drawShape(geom, attributes);
}
}
}
@@ -59,7 +59,7 @@ public GridLayer(final IScope scope, final ILayerStatement layer) {
super(scope, layer);
turnGridOn = ((GridLayerStatement) layer).drawLines();
final GamaSpatialMatrix m = (GamaSpatialMatrix) ((GridLayerStatement) layer).getEnvironment();
- final ILocation p = m.getDimensions();
+ // final ILocation p = m.getDimensions();
final Envelope env = scope.getRoot().getGeometry().getEnvelope();
cellSize = new GamaPoint(env.getWidth() / m.numCols, env.getHeight() / m.numRows);
}
@@ -11,18 +11,19 @@
**********************************************************************************************/
package msi.gama.outputs.layers;
-import msi.gama.common.interfaces.*;
+import msi.gama.common.interfaces.IStepable;
import msi.gama.outputs.IDisplayOutput;
import msi.gaml.compilation.ISymbol;
/**
- * The class ILayerStatement. Supports the GAML definition of layers in a display
+ * The class ILayerStatement. Supports the GAML definition of layers in a
+ * display
*
* @author drogoul
* @since 14 d�c. 2011
*
*/
-public interface ILayerStatement extends INamed, IStepable, ISymbol, Comparable<ILayerStatement> {
+public interface ILayerStatement extends IStepable, ISymbol, Comparable<ILayerStatement> {
public final static short GRID = 1;
public final static short AGENTS = 2;
@@ -269,7 +269,7 @@ private void setGridLayers(final List<GridLayerStatement> layers) {
*/
public List<AbstractLayerStatement> getSubLayers() {
if (subLayers == null) {
- subLayers = new ArrayList<AbstractLayerStatement>();
+ subLayers = new ArrayList<>();
subLayers.addAll(gridLayers);
subLayers.addAll(microSpeciesLayers);
}
@@ -11,8 +11,6 @@
**********************************************************************************************/
package msi.gama.outputs.layers;
-import java.awt.Color;
-import java.awt.Font;
import java.awt.geom.Rectangle2D;
import msi.gama.common.interfaces.IDisplaySurface;
@@ -42,10 +40,11 @@ public Rectangle2D focusOn(final IShape geometry, final IDisplaySurface s) {
@Override
public void privateDrawDisplay(final IScope scope, final IGraphics g) {
- final TextLayerStatement model = (TextLayerStatement) this.definition;
- final String text = model.getText();
- final Color color = model.getColor();
- final Font f = model.getFont();
+ // final TextLayerStatement model = (TextLayerStatement)
+ // this.definition;
+ // final String text = model.getText();
+ // final Color color = model.getColor();
+ // final Font f = model.getFont();
// Integer s = model.getStyle();
// g.drawString(text, color, null, null, f, null, true);
}
Oops, something went wrong.

0 comments on commit eace5b4

Please sign in to comment.