From 4d3216a74e6325e529855d50520c5e814c34c78a Mon Sep 17 00:00:00 2001 From: "Ankur Sinha (Ankur Sinha Gmail)" Date: Wed, 23 Aug 2023 16:03:36 +0100 Subject: [PATCH 1/5] feat(factory-generator): add additional import ... otherwise it errors saying that `Record` is ambiguous. --- .../java/org/lemsml/jlems/io/reader/LemsFactoryGenerator.java | 1 + 1 file changed, 1 insertion(+) diff --git a/src/main/java/org/lemsml/jlems/io/reader/LemsFactoryGenerator.java b/src/main/java/org/lemsml/jlems/io/reader/LemsFactoryGenerator.java index fcf0350d..d951f964 100644 --- a/src/main/java/org/lemsml/jlems/io/reader/LemsFactoryGenerator.java +++ b/src/main/java/org/lemsml/jlems/io/reader/LemsFactoryGenerator.java @@ -25,6 +25,7 @@ private String generateJava() { sb.append("import org.lemsml.jlems.core.type.*;\n"); sb.append("import org.lemsml.jlems.core.type.dynamics.*;\n"); sb.append("import org.lemsml.jlems.core.type.structure.*;\n"); + sb.append("import org.lemsml.jlems.core.type.simulation.Record;\n\n"); // Record is ambiguous sb.append("import org.lemsml.jlems.core.type.simulation.*;\n\n"); sb.append("import org.lemsml.jlems.core.type.procedure.*;\n\n"); sb.append("import org.lemsml.jlems.core.type.geometry.*;\n\n"); From b60302babb876d287a3310d1354b76969f0596cf Mon Sep 17 00:00:00 2001 From: "Ankur Sinha (Ankur Sinha Gmail)" Date: Wed, 23 Aug 2023 16:04:30 +0100 Subject: [PATCH 2/5] feat(lems-factory): regenerated Command to regenerate: ``` $ mvn clean install # if changes made to generator $ java -classpath target/jlems-0.10.7.jar org.lemsml.jlems.io.reader.LemsFactoryGenerator.main ``` --- .../java/org/lemsml/jlems/core/reader/LemsFactory.java | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/main/java/org/lemsml/jlems/core/reader/LemsFactory.java b/src/main/java/org/lemsml/jlems/core/reader/LemsFactory.java index eb03c0f8..ff150dd3 100644 --- a/src/main/java/org/lemsml/jlems/core/reader/LemsFactory.java +++ b/src/main/java/org/lemsml/jlems/core/reader/LemsFactory.java @@ -4,6 +4,7 @@ import org.lemsml.jlems.core.type.dynamics.*; import org.lemsml.jlems.core.type.structure.*; import org.lemsml.jlems.core.type.simulation.Record; + import org.lemsml.jlems.core.type.simulation.*; import org.lemsml.jlems.core.type.procedure.*; @@ -764,10 +765,10 @@ private Child buildChild(XMLElement xel) { ret.name = parseString(xv); } else if (xn.equals("type")) { ret.type = parseString(xv); - } else if (xn.equals("description")) { - ret.description = parseString(xv); } else if (xn.equals("substitute")) { ret.substitute = parseString(xv); + } else if (xn.equals("description")) { + ret.description = parseString(xv); } else { E.warning("Unrecognized attribute " + xa + " " + xv); } @@ -810,6 +811,8 @@ private Link buildLink(XMLElement xel) { ret.name = parseString(xv); } else if (xn.equals("type")) { ret.type = parseString(xv); + } else if (xn.equals("description")) { + ret.description = parseString(xv); } else if (xn.equals("root")) { ret.root = parseString(xv); } else if (xn.equals("isAny")) { @@ -2423,6 +2426,8 @@ private Simulation buildSimulation(XMLElement xel) { ret.dataWriters.add((DataWriter)obj); } else if (obj instanceof EventWriter) { ret.eventWriters.add((EventWriter)obj); + } else if (obj instanceof Meta) { + ret.metas.add((Meta)obj); } else { E.warning("Unrecognized element ("+xn+"): " + cel); } From de661bc91d42b3ff3734ffb657ff57b1f7a9bc99 Mon Sep 17 00:00:00 2001 From: "Ankur Sinha (Ankur Sinha Gmail)" Date: Wed, 23 Aug 2023 16:06:09 +0100 Subject: [PATCH 3/5] feat(simulation): add meta as children element --- .../java/org/lemsml/jlems/core/type/simulation/Simulation.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/main/java/org/lemsml/jlems/core/type/simulation/Simulation.java b/src/main/java/org/lemsml/jlems/core/type/simulation/Simulation.java index 0f16b4ad..761ae8a8 100644 --- a/src/main/java/org/lemsml/jlems/core/type/simulation/Simulation.java +++ b/src/main/java/org/lemsml/jlems/core/type/simulation/Simulation.java @@ -11,6 +11,7 @@ import org.lemsml.jlems.core.type.ComponentType; import org.lemsml.jlems.core.type.Lems; import org.lemsml.jlems.core.type.LemsCollection; +import org.lemsml.jlems.core.type.Meta; @@ -29,6 +30,8 @@ public class Simulation { public transient LemsCollection eventWriters = new LemsCollection(); + public transient LemsCollection metas = new LemsCollection(); + public static int idCounter = 0; From 8079267df46e732e4e62b0862f69594723ac3322 Mon Sep 17 00:00:00 2001 From: "Ankur Sinha (Ankur Sinha Gmail)" Date: Wed, 23 Aug 2023 16:06:39 +0100 Subject: [PATCH 4/5] feat(lems-classes): remove abstract class ... since it cannot be instantiated (java throws error). --- src/main/java/org/lemsml/jlems/io/reader/LemsClasses.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/org/lemsml/jlems/io/reader/LemsClasses.java b/src/main/java/org/lemsml/jlems/io/reader/LemsClasses.java index 4d4ce269..b4a84de0 100644 --- a/src/main/java/org/lemsml/jlems/io/reader/LemsClasses.java +++ b/src/main/java/org/lemsml/jlems/io/reader/LemsClasses.java @@ -174,7 +174,7 @@ private ArrayList getStructureClasses() { ArrayList ret = new ArrayList(); String section = "structure"; ret.add(new LemsClass(Structure.class, section)); - ret.add(new LemsClass(BuildElement.class, section)); + // ret.add(new LemsClass(BuildElement.class, section)); -> abstract ret.add(new LemsClass(MultiInstantiate.class, section)); ret.add(new LemsClass(CoInstantiate.class, section)); ret.add(new LemsClass(Assign.class, section)); From e23299003bb09e91b1e34ffd9b51dc8480e7cf77 Mon Sep 17 00:00:00 2001 From: "Ankur Sinha (Ankur Sinha Gmail)" Date: Wed, 23 Aug 2023 16:07:04 +0100 Subject: [PATCH 5/5] feat(lems-classes): add `Component` to list --- src/main/java/org/lemsml/jlems/io/reader/LemsClasses.java | 1 + 1 file changed, 1 insertion(+) diff --git a/src/main/java/org/lemsml/jlems/io/reader/LemsClasses.java b/src/main/java/org/lemsml/jlems/io/reader/LemsClasses.java index b4a84de0..b36cd572 100644 --- a/src/main/java/org/lemsml/jlems/io/reader/LemsClasses.java +++ b/src/main/java/org/lemsml/jlems/io/reader/LemsClasses.java @@ -199,6 +199,7 @@ private ArrayList getComponentTypeClasses() { ArrayList ret = new ArrayList(); String section = "componenttypes"; + ret.add(new LemsClass(Component.class, section)); ret.add(new LemsClass(ComponentType.class, section)); ret.add(new LemsClass(Parameter.class, section)); ret.add(new LemsClass(PathParameter.class, section));