Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Code cleanup #133

Merged
merged 91 commits into from
May 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
91 commits
Select commit Hold shift + click to select a range
dc21b12
Clean SimpleBdiArchitecture
lesquoyb Mar 12, 2024
293b868
Fullow up on bdi
lesquoyb Mar 12, 2024
8600b28
Throw forgotten exceptions
lesquoyb Mar 12, 2024
41f9950
Fixes wrong Math.round uses
lesquoyb Mar 12, 2024
7dfeea5
Fixes comparison to state name
lesquoyb Mar 12, 2024
7ad842b
Fixes very probable NPE in gamaserver command execution
lesquoyb Mar 12, 2024
1ff60bb
Fixes equalsInAgent for SimpleBdi
lesquoyb Mar 12, 2024
996989c
Fixes potential NPE in case of error in operator creation
lesquoyb Mar 12, 2024
1637eb4
Fixes comparisons between Double + cleanup horrible stream use
lesquoyb Mar 12, 2024
79cb9d7
Removes useless null check
lesquoyb Mar 12, 2024
070fab7
Removes useless condition in BdiEnforcementStatement
lesquoyb Mar 12, 2024
456bb53
Removes unused receiver in ServerService
lesquoyb Mar 12, 2024
8add5ce
Actually sets the vertexSpecies value in a graph
lesquoyb Mar 12, 2024
027ebcf
Follow up on the fix for vertexSpecies
lesquoyb Mar 13, 2024
8a72ed1
Removes unused currentSelection in ImportProjectWizard
lesquoyb Mar 13, 2024
d7deada
Fixes PSO by updating currentVal of the particle
lesquoyb Mar 13, 2024
e9ff4e3
Adds Cloneable to the implemented interfaces of GamaPoint
lesquoyb Mar 13, 2024
ea2d467
Adds Cloneable to the implemented interfaces of DynamicLineString
lesquoyb Mar 13, 2024
276b75e
Fixes possible bug in CSVTableSorter compare in case of descending order
lesquoyb Mar 13, 2024
3d5dd66
Removes unused variables and methods in shaders used for Keystone
lesquoyb Mar 13, 2024
266c0ee
Replace string comparison operators == and != by equals
lesquoyb Mar 13, 2024
1bba0b1
tentative replacement class by a record in MtlLoader
lesquoyb Mar 13, 2024
b4ab341
Deleting unused GridDiffuser
lesquoyb Mar 13, 2024
95e0199
Unify code
lesquoyb Mar 13, 2024
7d5c6d9
Simplifies some operation in SamplingUtils
lesquoyb Mar 14, 2024
bddfcbc
Rework of MtlLoader
lesquoyb Mar 14, 2024
5db5585
Removes redundant toString calls
lesquoyb Mar 14, 2024
477b998
Small String optimization
lesquoyb Mar 14, 2024
ce15b43
Removes unused fields
lesquoyb Mar 14, 2024
f0d696d
Replaces XX.valueOf() by parseXX() when it was used only to parse the…
lesquoyb Mar 15, 2024
822ef19
Improves MtlLoader code by removing useless tmp variables
lesquoyb Mar 15, 2024
0877dc3
Switches StringBuffer to StringBuilder where thread-safety is not needed
lesquoyb Mar 15, 2024
d7ae588
Adds final modifier where it's needed
lesquoyb Mar 15, 2024
d3e7e2d
Follow up on final modifiers
lesquoyb Mar 15, 2024
74a6e5c
Safer string comparisons
lesquoyb Mar 15, 2024
f2d4010
Removes unused code and redundancies
lesquoyb Mar 15, 2024
ca30993
Removes useless variables
lesquoyb Mar 20, 2024
74bcc66
Uses StringBuilder to build string
lesquoyb Mar 20, 2024
9cf99c1
Multiple small fixes
lesquoyb Mar 20, 2024
dda918b
Removes useless code + some warnings
lesquoyb Mar 26, 2024
bfcf862
Refreshing keywords
lesquoyb Mar 28, 2024
3e87dcc
Removes unused code pieces
lesquoyb Mar 29, 2024
aca6b0e
Removes deprecated internal code + facets + operators
lesquoyb Mar 29, 2024
d5d0483
Merge branch '2024-06' into code-cleanup
lesquoyb Mar 29, 2024
ea297d1
fixes traffic plugin model
ptaillandier Mar 29, 2024
ddc766b
Follow up on removing deprecated facets/properties/operators (not pro…
lesquoyb Apr 1, 2024
a3677d0
fixes parameters in models from library
lesquoyb Apr 2, 2024
e3520c0
Follow up on parameter fixes
lesquoyb Apr 2, 2024
352341a
Fixing warnings in library models
lesquoyb Apr 2, 2024
cd9cf5e
Split Spatial subclasses into separate classes in a package
lesquoyb Apr 4, 2024
2dcba96
Merge branch '2024-06' into code-cleanup
lesquoyb Apr 4, 2024
3139b33
Fixes explicit import strings in gama.processor for the new spatial c…
lesquoyb Apr 4, 2024
58a3232
Starts refactoring BDI
lesquoyb Apr 5, 2024
a710adc
Follow up on refactoring BDI
lesquoyb Apr 5, 2024
b0c56eb
Introduces the intensity constant in keyword and use it
lesquoyb Apr 10, 2024
bfe65c5
Adds new methods in scope to simplify getting arguments
lesquoyb Apr 10, 2024
7e36d78
Follow up on bdi rework
lesquoyb Apr 10, 2024
69b44fe
Removes useless getArg functions in IScope
lesquoyb Apr 10, 2024
8d934d9
Follow up refactoring BDI
lesquoyb Apr 10, 2024
1777050
Finishes RuleStatement
lesquoyb Apr 11, 2024
3fcc88e
Adds getBoolArgIfExists on the model of getTypedArgIfExists
lesquoyb Apr 11, 2024
c67b67e
Follow up on refactoring BDI
lesquoyb Apr 11, 2024
8b850f9
[BDI] fixes compilation, one curly bracket was forgotten
lesquoyb Apr 12, 2024
71a3d1e
[BDI] finishes focusstatement + misc
lesquoyb Apr 12, 2024
5b8ba74
[BDI] follow up
lesquoyb Apr 12, 2024
9976890
[BDI] last cleaning
lesquoyb Apr 16, 2024
db8489e
Safer strings comparisons + misc
lesquoyb Apr 16, 2024
94fc5b3
Misc changes
lesquoyb Apr 17, 2024
a9c20ca
Various fixes
lesquoyb Apr 17, 2024
092bd35
Test spotbug workflow
lesquoyb Apr 23, 2024
e689320
Misc
lesquoyb Apr 24, 2024
305bf25
Fixes weird exploration code + forgotten files for previous misc commit
lesquoyb Apr 25, 2024
48bf1a4
Fixes compilation by regenerating gama.processor.jar
lesquoyb May 7, 2024
4e03f64
Adds a GamlCompilationErrorType enum to replace booleans
lesquoyb May 7, 2024
bac34a1
Fixes clamp issue for older jdk + split SimpleBdiArchitecture in 2 to…
lesquoyb May 7, 2024
2d6d487
Merge branch '2024-06' into code-cleanup
lesquoyb May 8, 2024
c342dd0
Finishes making the code compatible with jdk17 + suppress some warnings
lesquoyb May 8, 2024
789dd5c
Testing PR workflow
lesquoyb May 8, 2024
bc947d4
Testing PR workflow 2
RoiArthurB May 8, 2024
d9a089d
Testing PR workflow 3
RoiArthurB May 8, 2024
44dbcb8
test PR workflow
lesquoyb May 8, 2024
58305f3
Compiles gama.processor.jar with jdk17
lesquoyb May 8, 2024
69a0b83
Adds fake issue to test spotbugs workflow
lesquoyb May 8, 2024
4b478f3
test PR workflow
lesquoyb May 9, 2024
25c0ecc
test PR workflow
lesquoyb May 9, 2024
c06ca4b
[spotbugs] switch fake error to another one that is not in fb-contrib
lesquoyb May 9, 2024
dee93e3
Updates gama.processor again
lesquoyb May 13, 2024
e8bfe57
Fixes library models compilation problems
lesquoyb May 13, 2024
0c4d255
Fixes some last spotbugs issues
lesquoyb May 13, 2024
0f602fe
Minor improvements
lesquoyb May 14, 2024
3b91eed
Adds a comment for later refactoring
lesquoyb May 14, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
Original file line number Diff line number Diff line change
Expand Up @@ -444,27 +444,6 @@ boolean internal()
doc[] doc() default {};
}

// /**
// * The Interface args. Describes the names of the arguments passed to an action.
// *
// * @deprecated use action.args() instead
// * @see action
// */
// @Retention (RetentionPolicy.RUNTIME)
// @Target (ElementType.METHOD)
// @Deprecated
// public static @interface args {
//
// /**
// * Value.
// *
// *
// * @return an Array of strings, each representing an argument that can be passed to a action. Used to tag the
// * method that will implement the action.
// */
// String[] names();
//
// }

/**
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
*/
public enum Reason {
/**
* The test on this specific artefact are actually made somewhere else, usually in custom test files written by hand
* The test on this specific artifact are actually made somewhere else, usually in custom test files written by hand
*/
ALREADY_TESTED,
/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ public static org.w3c.dom.Element getDocElt(final doc docAnnot, final Document d
// Parse result
final String value = docAnnot.value();
final boolean masterDoc = docAnnot.masterDoc();
if (value != "") {
if ( !"".equals(value)) {
if (docElt.getElementsByTagName(XMLElements.RESULT).getLength() != 0) {
final org.w3c.dom.Element resultElt =
(org.w3c.dom.Element) docElt.getElementsByTagName(XMLElements.RESULT).item(0);
Expand Down Expand Up @@ -346,10 +346,21 @@ public static org.w3c.dom.Element getConstantElt(final constant constant, final
final String valCstStr = valCst == null ? "No Default Value" : valCst.toString();
constantElt.setAttribute(XMLElements.ATT_CST_VALUE, valCstStr);

String names = "";
StringBuilder strBuilder = new StringBuilder();
boolean firstPass = true;
for (final String n : constant.altNames()) {
names = "".equals(names) ? PREFIX_CONSTANT + n : names + "," + PREFIX_CONSTANT + n;

if (firstPass) {
firstPass = false;
}
else {
strBuilder.append(",");
}
strBuilder.append(PREFIX_CONSTANT);
strBuilder.append(n);
}
final String names = strBuilder.toString();

if (!"".equals(names))
constantElt.setAttribute(XMLElements.ATT_CST_NAMES, names);

Expand All @@ -376,30 +387,36 @@ public static org.w3c.dom.Element getConstantElt(final constant constant, final
*/
public static org.w3c.dom.Element getVarsElt(final vars varsAnnot, final Document doc, final Messager mes,
final String skillName, final TypeConverter tc) {
if (varsAnnot != null) {
final org.w3c.dom.Element varsElt = doc.createElement(XMLElements.VARS);
for (final variable v : varsAnnot.value()) {
final org.w3c.dom.Element varElt = doc.createElement(XMLElements.VAR);
varElt.setAttribute(XMLElements.ATT_VAR_NAME, v.name());
varElt.setAttribute(XMLElements.ATT_VAR_TYPE, tc.getTypeString(Integer.valueOf(v.type())));
varElt.setAttribute(XMLElements.ATT_VAR_CONSTANT, "" + v.constant());

final org.w3c.dom.Element docEltVar = DocProcessorAnnotations.getDocElt(v.doc(), doc, mes,
"Var " + v.name() + " from " + skillName, tc, null);
if (docEltVar != null) {
varElt.appendChild(docEltVar);
}
if (varsAnnot == null) {
return null;
}
final org.w3c.dom.Element varsElt = doc.createElement(XMLElements.VARS);
for (final variable v : varsAnnot.value()) {
final org.w3c.dom.Element varElt = doc.createElement(XMLElements.VAR);
varElt.setAttribute(XMLElements.ATT_VAR_NAME, v.name());
varElt.setAttribute(XMLElements.ATT_VAR_TYPE, tc.getTypeString(Integer.valueOf(v.type())));
varElt.setAttribute(XMLElements.ATT_VAR_CONSTANT, "" + v.constant());

final org.w3c.dom.Element docEltVar = DocProcessorAnnotations.getDocElt(v.doc(), doc, mes,
"Var " + v.name() + " from " + skillName, tc, null);
if (docEltVar != null) {
varElt.appendChild(docEltVar);
}

String dependsOn = new String();
for (final String dependElement : v.depends_on()) {
dependsOn = ("".equals(dependsOn) ? "" : dependsOn + ",") + dependElement;
StringBuilder strBuilder = new StringBuilder();
for (int i = 0 ; i < v.depends_on().length; i++ ) {
final String dependElement = v.depends_on()[i];
strBuilder.append(dependElement);
if (i < v.depends_on().length - 1) {
strBuilder.append(",");
}
varElt.setAttribute(XMLElements.ATT_VAR_DEPENDS_ON, dependsOn);
varsElt.appendChild(varElt);
}
return varsElt;

final String dependsOn = strBuilder.toString();
varElt.setAttribute(XMLElements.ATT_VAR_DEPENDS_ON, dependsOn);
varsElt.appendChild(varElt);
}
return null;
return varsElt;
}

/**
Expand Down Expand Up @@ -475,12 +492,15 @@ public static org.w3c.dom.Element getFacetsElt(final facets facetsAnnot, final D
facetElt.setAttribute(XMLElements.ATT_FACET_TYPE, tc.getTypeString(f.type()));
facetElt.setAttribute(XMLElements.ATT_FACET_OPTIONAL, "" + f.optional());
if (f.values().length != 0) {
String valuesTaken = ", takes values in: {" + f.values()[0];
StringBuilder strBuilder = new StringBuilder();
strBuilder.append(", takes values in: {");
strBuilder.append(f.values()[0]);
for (int i = 1; i < f.values().length; i++) {
valuesTaken += ", " + f.values()[i];
strBuilder.append(", ");
strBuilder.append(f.values()[i]);
}
valuesTaken += "}";
facetElt.setAttribute(XMLElements.ATT_FACET_VALUES, valuesTaken);
strBuilder.append("}");
facetElt.setAttribute(XMLElements.ATT_FACET_VALUES, strBuilder.toString());
}
facetElt.setAttribute(XMLElements.ATT_FACET_OMISSIBLE,
f.name().equals(facetsAnnot.omissible()) ? "true" : "false");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,9 @@ public class Constants {

// Repositories containing used files

/** The Constant BASE_FOLDER. */
public final static String BASE_FOLDER = "";

/** The Constant SRC_FOLDER. */
public final static String SRC_FOLDER = BASE_FOLDER + "files";
public final static String SRC_FOLDER = "files";

/** The Constant GEN_FOLDER. */
public final static String GEN_FOLDER = SRC_FOLDER + File.separator + "gen";
Expand Down

This file was deleted.

2 changes: 1 addition & 1 deletion gama.annotations/src/gama/dev/DEBUG.java
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public class DEBUG {
/**
* A custom security manager that exposes the getClassContext() information
*/
static class MySecurityManager extends SecurityManager {
static private class MySecurityManager extends SecurityManager {

/**
* Gets the caller class name.
Expand Down
1 change: 1 addition & 0 deletions gama.core/META-INF/MANIFEST.MF
Original file line number Diff line number Diff line change
Expand Up @@ -755,6 +755,7 @@ Export-Package: gama.core.common;
gama.core.kernel.experiment,
gama.core.util.path,
org.jgrapht.alg.drawing.model",
gama.gaml.operators.spatial,
gama.gaml.skills;
uses:="gama.core.util,
gama.core.util.graph,
Expand Down
2 changes: 1 addition & 1 deletion gama.core/src/gama/core/common/geometry/Envelope3D.java
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
public class Envelope3D extends Envelope implements IDisposable, IIntersectable {

/** The Constant POOL. */
private final static PoolUtils.ObjectPool<Envelope3D> POOL =
private static final PoolUtils.ObjectPool<Envelope3D> POOL =
PoolUtils.create("Envelope 3D", true, Envelope3D::new, (from, to) -> to.set(from), null);

/** The Constant EMPTY. */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ public ICoordinates create(final GamaPoint[] coordinates, final boolean copy) {
@Override
public ICoordinates create(final CoordinateSequence cs) {
if (cs.size() == 1) return new UniqueCoordinateSequence(cs.getDimension(), cs.getCoordinate(0));
if (cs instanceof GamaCoordinateSequence) return ((GamaCoordinateSequence) cs).clone();
if (cs instanceof GamaCoordinateSequence) return ((GamaCoordinateSequence) cs).copy();
return new GamaCoordinateSequence(cs.getDimension(), cs.toCoordinateArray());
}

Expand Down
Loading