Skip to content

Commit

Permalink
Various compilation fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
lesquoyb committed Feb 22, 2024
1 parent e5946f1 commit 0dad3f6
Show file tree
Hide file tree
Showing 20 changed files with 84 additions and 78 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,7 @@ public static IList<PhysicalBlock> classifyCode(final IScope scope, final List<B
if (saveImage) {
File outputfile = new File(scope.getModel().getProjectPath() +"\\models\\generated\\blocks\\image_"+cpt2+".jpg" );
ImageIO.write(img, "jpg", outputfile);
System.out.println("image_" + cpt2 + " -> l : " + l.serialize(false) + " x_g: " + x_g+ " y_g: " + x_g);
// System.out.println("image_" + cpt2 + " -> l : " + l.serialize(false) + " x_g: " + x_g+ " y_g: " + x_g);
}

for (PatternBlock pb : patterns) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
import msi.gama.precompiler.GamlAnnotations.vars;
import msi.gama.runtime.IScope;
import msi.gama.runtime.exceptions.GamaRuntimeException;
import msi.gama.util.file.json.Json;
import msi.gama.util.file.json.JsonValue;
import msi.gama.util.matrix.GamaIntMatrix;
import msi.gaml.expressions.IExpression;
import msi.gaml.types.GamaMatrixType;
Expand Down Expand Up @@ -58,16 +60,11 @@ public IType<?> getGamlType() {
return Types.get(PatternBlockType.id);
}


@Override
public String toString() {
return serialize(true);
}

@Override
public String serialize(final boolean includingBuiltIn) {
return id + ":"+matrix.serialize(includingBuiltIn);
}
// Don't think it's actually used outside of debugging
// @Override
// public String toString() {
// return id + ":" +matrix.serialize(true);
// }

@Override
public String stringValue(final IScope scope) throws GamaRuntimeException {
Expand All @@ -80,6 +77,10 @@ public IValue copy(IScope scope) throws GamaRuntimeException {
p.setMatrix((GamaIntMatrix) getMatrix().copy(scope));
return p;
}
@Override
public JsonValue serializeToJson(Json json) {
return json.object(id, matrix.serializeToJson(json));
}


}
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
import msi.gama.precompiler.GamlAnnotations.vars;
import msi.gama.runtime.IScope;
import msi.gama.runtime.exceptions.GamaRuntimeException;
import msi.gama.util.file.json.Json;
import msi.gama.util.file.json.JsonValue;
import msi.gaml.expressions.IExpression;
import msi.gaml.types.IType;
import msi.gaml.types.Types;
Expand Down Expand Up @@ -58,15 +60,30 @@ public IType<?> getGamlType() {
return Types.get(PhysicalBlockType.id);
}


@Override
public String toString() {
return serialize(true);
}
// Don't think it's used outside of debuging
// @Override
// public String toString() {
// return serialize(true);
// }

// @Override
// public String serialize(final boolean includingBuiltIn) {
// return (pattern == null ? "": pattern.serialize(includingBuiltIn)) + ":" + (shape == null ? "" : shape.serialize(includingBuiltIn)) ;
// }

@Override
public String serialize(final boolean includingBuiltIn) {
return (pattern == null ? "": pattern.serialize(includingBuiltIn)) + ":" + (shape == null ? "" : shape.serialize(includingBuiltIn)) ;
public JsonValue serializeToJson(Json json) {
if (pattern != null ) {
if (shape == null) {
return pattern.serializeToJson(json);
}
else {
return json.object(pattern.serializeToJson(json).asString(), shape.serializeToJson(json));
}
}
else {
return json.valueOf("");
}
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,20 +22,16 @@
import javax.swing.JOptionPane;

import org.geotools.coverage.grid.GridCoverage2D;
import org.geotools.coverage.grid.io.AbstractGridCoverage2DReader;
import org.geotools.data.DataSourceException;
import org.geotools.data.PrjFileReader;
import org.geotools.gce.arcgrid.ArcGridReader;
import org.geotools.data.PrjFileReader;
import org.geotools.gce.geotiff.GeoTiffReader;
import org.locationtech.jts.geom.Envelope;
import org.opengis.referencing.FactoryException;
import org.opengis.referencing.crs.CoordinateReferenceSystem;


import msi.gama.common.geometry.Envelope3D;
import msi.gama.metamodel.shape.GamaPoint;
import msi.gama.metamodel.shape.GamaShape;
import msi.gama.metamodel.shape.ILocation;
import msi.gama.metamodel.shape.IShape;
import msi.gama.precompiler.GamlAnnotations.doc;
import msi.gama.precompiler.GamlAnnotations.example;
Expand Down Expand Up @@ -464,7 +460,7 @@ public GridCoverage2D getCoverage() {
return null;
}

public Double valueOf(final IScope scope, final ILocation loc) {
public Double valueOf(final IScope scope, final GamaPoint loc) {
if (getBuffer() == null) {
fillBuffer(scope);
}
Expand Down
14 changes: 8 additions & 6 deletions idees.gama.weka/src/idees/gama/types/GamaClassifier.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
import msi.gama.runtime.IScope;
import msi.gama.runtime.exceptions.GamaRuntimeException;
import msi.gama.util.IList;
import msi.gama.util.file.json.Json;
import msi.gama.util.file.json.JsonValue;
import msi.gaml.types.IType;
import msi.gaml.types.Types;
import weka.classifiers.Classifier;
Expand All @@ -17,12 +19,6 @@ public class GamaClassifier implements IValue{

private Map<String,IList<String>> valsNominal;


@Override
public String serialize(boolean includingBuiltIn) {
// TODO Auto-generated method stub
return null;
}

@Override
public IType<?> getGamlType() {
Expand Down Expand Up @@ -65,6 +61,12 @@ public void setValsNominal(Map<String, IList<String>> valsNominal) {
this.valsNominal = valsNominal;
}

@Override
public JsonValue serializeToJson(Json json) {
// TODO Auto-generated method stub
return null;
}




Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@
import msi.gama.runtime.exceptions.GamaRuntimeException;
import msi.gama.util.GamaListFactory;
import msi.gama.util.IList;
import msi.gama.util.file.json.Json;
import msi.gama.util.file.json.JsonValue;
import msi.gaml.types.IType;

@vars({ @variable(name = "id", type = IType.STRING),
Expand Down Expand Up @@ -77,5 +79,10 @@ public IValue copy(IScope scope) throws GamaRuntimeException {
GamaBayesianNetwork bayes = new GamaBayesianNetwork(this.network);
return bayes;
}

@Override
public JsonValue serializeToJson(Json json) {
return json.valueOf(stringValue(null));
}

}
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
package miat.gaml.extensions.argumentation.skills;

import java.util.ArrayList;
import java.util.Iterator;
import java.util.Arrays;
import java.util.HashSet;
import java.util.Hashtable;
import java.util.IdentityHashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Set;
Expand All @@ -18,15 +16,12 @@
import msi.gama.precompiler.GamlAnnotations.doc;
import msi.gama.precompiler.GamlAnnotations.example;
import msi.gama.precompiler.GamlAnnotations.getter;
import msi.gama.precompiler.GamlAnnotations.operator;
import msi.gama.precompiler.GamlAnnotations.setter;
import msi.gama.precompiler.GamlAnnotations.skill;
import msi.gama.precompiler.GamlAnnotations.variable;
import msi.gama.precompiler.GamlAnnotations.vars;
import msi.gama.runtime.IScope;
import msi.gama.runtime.exceptions.GamaRuntimeException;
import msi.gama.util.GamaList;
import msi.gama.util.GamaListCollectionWrapper;
import msi.gama.util.GamaListFactory;
import msi.gama.util.GamaMap;
import msi.gama.util.GamaMapFactory;
Expand All @@ -36,16 +31,13 @@
import msi.gama.util.graph.GamaGraph;
import msi.gama.util.graph.IGraph;
import msi.gaml.descriptions.ConstantExpressionDescription;
import msi.gaml.operators.Graphs;
import msi.gaml.operators.Random;
import msi.gaml.skills.Skill;
import msi.gaml.species.ISpecies;
import msi.gaml.statements.Arguments;
import msi.gaml.statements.IStatement;
import msi.gaml.types.GamaAttributesType;
import msi.gaml.types.IType;
import msi.gaml.types.Types;
import net.sf.jargsemsat.jargsemsat.alg.Misc;
import net.sf.jargsemsat.jargsemsat.datastructures.DungAF;

@skill(name = "argumenting")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
import msi.gama.runtime.IScope;
import msi.gama.runtime.exceptions.GamaRuntimeException;
import msi.gama.util.IMap;
import msi.gama.util.file.json.Json;
import msi.gama.util.file.json.JsonValue;
import msi.gaml.types.IType;
import msi.gaml.types.Types;

Expand Down Expand Up @@ -82,10 +84,6 @@ public String getSourceType() {
return sourceType;
}

@Override
public String serialize(boolean includingBuiltIn) {
return id;
}

@Override
public IType<?> getGamlType() {
Expand All @@ -94,7 +92,7 @@ public IType<?> getGamlType() {

@Override
public String stringValue(IScope scope) throws GamaRuntimeException {
return serialize(true);
return id;
}

@Override
Expand Down Expand Up @@ -126,5 +124,10 @@ public int hashCode() {
int result = 1;
result = prime * result + (id == null ? 0 : id.hashCode());
return result;
}

@Override
public JsonValue serializeToJson(Json json) {
return json.valueOf(id);
}
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package mit.gaml.extension.launchpad.skills;

import msi.gama.metamodel.shape.GamaPoint;
import msi.gama.metamodel.shape.ILocation;
import msi.gama.precompiler.GamlAnnotations.action;
import msi.gama.precompiler.GamlAnnotations.arg;
import msi.gama.precompiler.GamlAnnotations.doc;
Expand Down Expand Up @@ -48,7 +47,7 @@ public String getButtonPressed() {
}

@getter ("padPressed")
public ILocation getPadPressed() {
public GamaPoint getPadPressed() {
final GamaPoint p = new GamaPoint(LaunchPadEventLayer.pressedPad.getX(), LaunchPadEventLayer.pressedPad.getY());
return p;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
import msi.gama.common.interfaces.IKeyword;
import msi.gama.metamodel.agent.IAgent;
import msi.gama.metamodel.shape.GamaPoint;
import msi.gama.metamodel.shape.ILocation;
import msi.gama.precompiler.GamlAnnotations.doc;
import msi.gama.precompiler.GamlAnnotations.getter;
import msi.gama.precompiler.GamlAnnotations.setter;
Expand Down Expand Up @@ -103,7 +102,7 @@ public GamaPoint getParticuleLocation(final IAgent scope) {
if (p == null) { return null; }
final Point3d loc3D = p.getLocation().getAbsoluteCoordinate();
final IAgent agt = p.getWorld().getUnderworldAgent();
final ILocation lc = agt.getLocation();
final GamaPoint lc = agt.getLocation();
final double width = p.getWorld().getDimension() / 200;
final double sz = p.getAbsoluteSize() / 2;
return new GamaPoint((loc3D.x + sz) / 100.0 - width + lc.getX(), (loc3D.y + sz) / 100.0 - width + lc.getY(),
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
package ummisco.gama.extension.hecras.skill;

import java.io.File;
import java.io.FileOutputStream;
import java.io.InputStream;

//import com.jacob.activeX.*;
//import com.jacob.com.*;
/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@

import msi.gama.metamodel.agent.IAgent;
import msi.gama.metamodel.shape.GamaPoint;
import msi.gama.metamodel.shape.ILocation;
import msi.gama.outputs.IOutput;
import msi.gama.outputs.LayeredDisplayOutput;
import msi.gama.precompiler.GamlAnnotations.action;
Expand Down
5 changes: 3 additions & 2 deletions ummisco.gama.markdown.documentation/META-INF/MANIFEST.MF
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,12 @@ Require-Bundle: org.eclipse.core.runtime;bundle-version="3.11.1",
org.eclipse.ui.ide;bundle-version="3.11.0",
org.eclipse.core.filesystem;bundle-version="1.5.0",
org.eclipse.core.resources;bundle-version="3.10.1",
msi.gama.application,
msi.gama.application,
org.eclipse.jface.text;bundle-version="3.10.0",
org.eclipse.ui.forms;bundle-version="3.6.200",
msi.gama.lang.gaml,
ummisco.gama.ui.modeling
ummisco.gama.ui.modeling,
org.eclipse.xtext
Import-Package: org.apache.commons.io,
org.eclipse.compare,
org.eclipse.ui.commands
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@
import org.eclipse.emf.ecore.EObject;
import org.eclipse.xtext.documentation.IEObjectDocumentationProvider;
import org.eclipse.xtext.resource.IResourceServiceProvider;

import msi.gama.lang.gaml.ui.hover.GamlDocumentationProvider;
/**
*
* @author damienphilippon
Expand All @@ -31,8 +29,8 @@ public static String goBeginLine()
*/
public static String getCommentsFromElement(EObject element)
{
GamlDocumentationProvider p = (GamlDocumentationProvider)IResourceServiceProvider.Registry.INSTANCE.getResourceServiceProvider(URI.createFileURI("toto.gaml")).get(IEObjectDocumentationProvider.class);
String comments = p.getOnlyComment(element);
IEObjectDocumentationProvider op = (IEObjectDocumentationProvider)IResourceServiceProvider.Registry.INSTANCE.getResourceServiceProvider(URI.createFileURI("toto.gaml")).get(IEObjectDocumentationProvider.class);
String comments = op.getDocumentation(element);
return comments==null?"":comments;
}
/**
Expand Down
Loading

0 comments on commit 0dad3f6

Please sign in to comment.