Skip to content

Commit

Permalink
Merge pull request #114 from LEMS/feat/annotate-meta
Browse files Browse the repository at this point in the history
Annotate meta + add it as children of Simulation
  • Loading branch information
pgleeson authored Sep 8, 2023
2 parents aa7fb2a + e232990 commit ef30e87
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 3 deletions.
9 changes: 7 additions & 2 deletions src/main/java/org/lemsml/jlems/core/reader/LemsFactory.java
Original file line number Diff line number Diff line change
Expand Up @@ -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.*;
Expand Down Expand Up @@ -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);
}
Expand Down Expand Up @@ -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")) {
Expand Down Expand Up @@ -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);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;



Expand All @@ -29,6 +30,8 @@ public class Simulation {

public transient LemsCollection <EventWriter> eventWriters = new LemsCollection<EventWriter>();

public transient LemsCollection <Meta> metas = new LemsCollection<Meta>();


public static int idCounter = 0;

Expand Down
3 changes: 2 additions & 1 deletion src/main/java/org/lemsml/jlems/io/reader/LemsClasses.java
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ private ArrayList<LemsClass> getStructureClasses() {
ArrayList<LemsClass> ret = new ArrayList<LemsClass>();
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));
Expand All @@ -199,6 +199,7 @@ private ArrayList<LemsClass> getComponentTypeClasses() {
ArrayList<LemsClass> ret = new ArrayList<LemsClass>();

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));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down

0 comments on commit ef30e87

Please sign in to comment.