Skip to content

Commit

Permalink
Merge pull request #112 from LEMS/development
Browse files Browse the repository at this point in the history
Updates for NML v2.3
  • Loading branch information
pgleeson authored Sep 20, 2023
2 parents 15a46eb + f7f95ee commit f6c98c2
Show file tree
Hide file tree
Showing 33 changed files with 172 additions and 71 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ jobs:
strategy:
fail-fast: false
matrix:
java: [ '8', '11', '16', '17' ]
runs-on: [ubuntu-latest, macos-11, windows-latest]
java: [ '8', '11', '16', '17', '19' ]
runs-on: [ubuntu-latest, macos-latest, windows-latest]

name: Test on Java ${{ matrix.Java }} on ${{ matrix.runs-on }}
steps:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/examples.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: Check LEMS examples

on:
push:
branches: [ master, development, experimental ]
branches: [ master, development ]

jobs:
verify:
Expand Down
2 changes: 1 addition & 1 deletion lems
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/sh

export LEMS_VERSION=0.10.6
export LEMS_VERSION=0.10.8

export CLASSPATH=.:./target/jlems-$LEMS_VERSION.jar:$LEMS_HOME/target/jlems-$LEMS_VERSION.jar

Expand Down
2 changes: 1 addition & 1 deletion lems.bat
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
@echo off

set LEMS_VERSION=0.10.6
set LEMS_VERSION=0.10.8

set CLASSPATH=target\jlems-%LEMS_VERSION%.jar;%LEMS_HOME%\target\jlems-%LEMS_VERSION%.jar

Expand Down
11 changes: 5 additions & 6 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,11 @@
<modelVersion>4.0.0</modelVersion>
<groupId>org.lemsml</groupId>
<artifactId>jlems</artifactId>
<version>0.10.6</version>
<packaging>bundle</packaging>
<version>0.10.8</version>
<packaging>bundle</packaging>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencies>
<dependency>
<groupId>junit</groupId>
Expand Down Expand Up @@ -34,10 +37,6 @@
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.22.2</version>
<configuration>
<source>1.7</source>
<target>1.7</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.felix</groupId>
Expand Down
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
4 changes: 2 additions & 2 deletions src/main/java/org/lemsml/jlems/core/type/Attachments.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@
"and access purposes they are like child components. The cannonical use of attachments is in " +
"adding synapses to a cell when a network connection is made.")
public class Attachments implements Named {
@ModelProperty(info="")
@ModelProperty(info="A name for the Attachments")
public String name;
@ModelProperty(info="")
@ModelProperty(info="The type of the Attachments")
public String type;
public ComponentType r_type;

Expand Down
3 changes: 2 additions & 1 deletion src/main/java/org/lemsml/jlems/core/type/Child.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"children of the same type but with different roles, such as the forward and reverse transition rates in a channel.")
public class Child implements Named {

@ModelProperty(info="")
@ModelProperty(info="Name of the child")
public String name;

@ModelProperty(info="Reference to a component class, the value should be the name of the target class.")
Expand All @@ -20,6 +20,7 @@ public class Child implements Named {

public String substitute;

@ModelProperty(info="An optional description of the child")
public String description;


Expand Down
2 changes: 1 addition & 1 deletion src/main/java/org/lemsml/jlems/core/type/Children.java
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"child components")
public class Children implements Named {

@ModelProperty(info="")
@ModelProperty(info="Name of the children")
public String name;

@ModelProperty(info="The class of component allowed as children.")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,12 @@
"same way as a child component, but can be defined independently")
public class ComponentReference implements Named {

@ModelProperty(info="")
@ModelProperty(info="A name for the ComponentReference")
public String name;

@ModelProperty(info="Target type")
@ModelProperty(info="The type of the target Component")
public String type;
@ModelProperty(info="An optional description of the ComponentReference")
public String description;
public ComponentType r_type;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
import org.lemsml.jlems.core.type.structure.Structure;
import org.lemsml.jlems.core.xml.XMLElement;

@ModelElement(info="Root element for defining component types.")
@ModelElement(info="Root element for defining LEMS Component Types.")

@SuppressWarnings("StringConcatenationInsideStringBufferAppend")
public class ComponentType extends Base implements Named, Summaried, Inheritor {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import org.lemsml.jlems.core.sim.ContentError;
import org.lemsml.jlems.core.type.dynamics.ExpressionValued;

@ModelElement(info="A parameter that comes from other parameter values in the model rather than being set explicitly. Its value " +
@ModelElement(info="A parameter that is a function of the Component's Parameters, which does not change with time. Its value " +
"can be supplied either with the 'value' attribute that evaluates within the scope of the definition, or with the " +
"'select' attribute which gives a path to 'primary' version of the parameter. For example, " +
" setting select='//MembranePotential[species=channel/species]/reversal' within the appropriate context allows " +
Expand All @@ -15,8 +15,13 @@

public class DerivedParameter extends ExpressionValued implements Named {

@ModelProperty(info="The name of the derived parameter")
public String name;

@ModelProperty(info="The dimension, or 'none'. This should be the name of an already defined dimension element")
public String dimension;

@ModelProperty(info="An optional description of the derived parameter")
public String description;
public Dimension r_dimension;

Expand Down
5 changes: 3 additions & 2 deletions src/main/java/org/lemsml/jlems/core/type/EventPort.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,15 @@
import org.lemsml.jlems.core.logging.E;
import org.lemsml.jlems.core.sim.ContentError;

@ModelElement(info = "A port on a component that can send or receive events, depending on the direction speicfied.")
@ModelElement(info = "A port on a component that can send or receive events, depending on the direction specified")

public class EventPort implements Named {

@ModelProperty(info = "")
@ModelProperty(info = "Name of the EventPort")
public String name;
@ModelProperty(info = "'IN' or 'OUT'")
public String direction;
@ModelProperty(info="An optional description of the EventPort")
public String description;

public Dimension r_dimension;
Expand Down
9 changes: 5 additions & 4 deletions src/main/java/org/lemsml/jlems/core/type/Exposure.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,16 @@
import org.lemsml.jlems.core.logging.E;
import org.lemsml.jlems.core.sim.ContentError;

@ModelElement(info = "A quantity that is made available to other component in the simulation. All variables in a Dynamics "
+ "definition are private. If other components need access to them then the definition has to explicitly link them "
@ModelElement(info = "A quantity that is made available to other components in the simulation. Note that all variables in a Dynamics "
+ "definition are private. If other components need access to them, then the definition should explicitly link them "
+ "to an exposure defined in the component class")
public class Exposure implements Named {

@ModelProperty(info = "name")
@ModelProperty(info = "Name of the exposure element")
public String name;
@ModelProperty(info = "Reference to a dimension")
@ModelProperty(info="The dimension, or 'none'. This should be the name of an already defined dimension element")
public String dimension;
@ModelProperty(info="An optional description of the element")
public String description;
public Dimension r_dimension;

Expand Down
26 changes: 14 additions & 12 deletions src/main/java/org/lemsml/jlems/core/type/Meta.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,34 +3,36 @@
import java.util.ArrayList;
import java.util.HashMap;

import org.lemsml.jlems.core.annotation.ModelElement;
import org.lemsml.jlems.core.sim.ContentError;
import org.lemsml.jlems.core.xml.XMLAttribute;
import org.lemsml.jlems.core.xml.XMLElement;


// RawValued indicates that XML found inside Meta elements should be treated

// RawValued indicates that XML found inside Meta elements should be treated
// processed into an element tree, but not interpreted as lems elements.
// other tools can do their own thing with the content
@ModelElement(info="Meta element to provide arbitrary metadata to LEMS simulations. Note that this is not processed by the LEMS interpreter.")
public class Meta {

public String context;

public XMLElement valueWrapper = new XMLElement("wrapper");

private XMLElement p_sourceXML;

public ArrayList<MetaItem> items = new ArrayList<MetaItem>();



public Meta() {

}

public void setSource(XMLElement xe) {
p_sourceXML = xe;
}

public void addXMLElement(XMLElement xe) {
valueWrapper.add(xe);
// E.info("Set VW " + xe.toXMLString(""));
Expand All @@ -45,15 +47,15 @@ public HashMap<String, String> getAttributes() {
}
return ret;
}


public void add(Object obj) throws ContentError {
if (obj instanceof MetaItem) {
items.add((MetaItem)obj);
} else {
throw new ContentError("cant add " + obj);
}
}
}

public MetaItem newItem(String nm) {
MetaItem ret = new MetaItem(nm);
Expand Down
9 changes: 5 additions & 4 deletions src/main/java/org/lemsml/jlems/core/type/Parameter.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,19 @@
import org.lemsml.jlems.core.logging.E;
import org.lemsml.jlems.core.sim.ContentError;

@ModelElement(info = "Sets the name an dimensionality of a parameter that must be supplied when a component is defined "
+ "curresponding to the enclosing ComponentType")
@ModelElement(info = "A quantity, defined by name and dimension, that must be supplied when a Component of the "
+ "enclosing ComponentType is defined")
public class Parameter implements Named {

@ModelProperty(info="The name of the parameter. This is the attibute name when the parameter is supplied in a component definition")
@ModelProperty(info="The name of the parameter. This is the name of the attribute to be used when the parameter is supplied in a component definition")
public String name;

@ModelProperty(info="The dimension, or 'none'. This should be the ID of a dimension element defined elsewhere")
@ModelProperty(info="The dimension, or 'none'. This should be the name of an already defined dimension element")
public String dimension;

public Dimension r_dimension;

@ModelProperty(info="An optional description of the parameter")
public String description;

public String exposure;
Expand Down
3 changes: 2 additions & 1 deletion src/main/java/org/lemsml/jlems/core/type/Requirement.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,11 @@ public class Requirement implements Named {
@ModelProperty(info = "name")
public String name;

@ModelProperty(info = "reference to a dimension")
@ModelProperty(info="The dimension, or 'none'. This should be the name of an already defined dimension element")
public String dimension;
public Dimension r_dimension;

@ModelProperty(info="An optional description of the requirement")
public String description;


Expand Down
3 changes: 2 additions & 1 deletion src/main/java/org/lemsml/jlems/core/type/Text.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,10 @@
@ModelElement(info="Holds textual information that does not change the model but is needed for other purposes such as " +
"labelling graphs.")
public class Text implements Named {
@ModelProperty(info="")
@ModelProperty(info="The textual content")
public String name;

@ModelProperty(info="An optional description of the element")
public String description;

public Text() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,11 @@
import org.lemsml.jlems.core.sim.ContentError;
import org.lemsml.jlems.core.type.Dimension;
import org.lemsml.jlems.core.type.LemsCollection;
import org.lemsml.jlems.core.annotation.ModelProperty;

public abstract class AbstractStateChange extends ExpressionValued {

@ModelProperty(info="The name of the variable")
public String variable;

private StateVariable r_variable;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,21 +18,22 @@
import org.lemsml.jlems.core.type.LemsCollection;

@ModelElement(info="A quantity that depends algebraically on other quantities in the model. The 'value' field can be " +
"set to a mathematical expression, or the select field to a path expression. If the path expression " +
"set to a mathematical expression, or the 'select' field to a path expression. If the path expression " +
"produces multiple matches, then the 'reduce' field says how these are reduced to a single value by " +
"taking the sum or product. ")
public class DerivedVariable extends ExpressionValued implements Valued {

@ModelProperty(info="")
@ModelProperty(info="Name of the derived variable")
public String name;

@ModelProperty(info="")
@ModelProperty(info="A path to the variable that supplies the value. Note that to select a variable from another component, the variable must be marked as an Exposure. Exactly one of 'select' and 'value' is required")
public String select;

@ModelProperty(info="")
@ModelProperty(info="The dimension, or 'none'. This should be the name of an already defined dimension element")
public String dimension;
public Dimension r_dimension;

@ModelProperty(info="An optional description of the derived variable")
public String description;

@ModelProperty(info="Either 'add' or 'multiply'. This applies if ther are multiple " +
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,11 @@
import org.lemsml.jlems.core.type.Requirement;


@ModelElement(info="Specifies the dynamical behavior of components build from this ComponentType. ")
@ModelElement(info="Specifies the dynamical behavior of components build from this ComponentType. "
+ "Note that all variables in a Dynamics "
+ "definition are private. If other components need access to them, then the definition should explicitly link them "
+ "to an Exposure defined in the component class"
)
public class Dynamics {

public String name;
Expand Down
Loading

0 comments on commit f6c98c2

Please sign in to comment.