Skip to content

Commit 2a8abaf

Browse files
S-furiDanySK
authored andcommitted
fix(sapere): use generalised molecules for dsl expressions test failure
1 parent 6e9a998 commit 2a8abaf

2 files changed

Lines changed: 3 additions & 3 deletions

File tree

alchemist-incarnation-sapere/src/main/java/it/unibo/alchemist/model/sapere/conditions/LsaNeighborhoodCondition.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ public LsaNeighborhoodCondition(
5353
this.environment = environment;
5454

5555
// We depend on every neighbor's concentration of the target molecule.
56-
// An update is triggered only when a molecule matching the template
56+
// An update is triggered only when a molecule matching the generalized template
5757
// is added or removed in any neighbor.
5858
addObservableDependency(ObservableExtensions.INSTANCE.switchMap(
5959
environment.getNeighborhood(node).map(Neighborhood::getNeighbors),
@@ -62,7 +62,7 @@ public LsaNeighborhoodCondition(
6262
neighbors.stream()
6363
.filter(it -> it instanceof ILsaNode)
6464
.map(neighbor ->
65-
((ILsaNode) neighbor).observeConcentration(molecule)
65+
neighbor.observeConcentration(molecule.generalize())
6666
).toList(),
6767
space -> space
6868
)

alchemist-incarnation-sapere/src/main/java/it/unibo/alchemist/model/sapere/conditions/LsaStandardCondition.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ public class LsaStandardCondition extends AbstractLsaCondition {
4949
public LsaStandardCondition(final ILsaMolecule mol, final ILsaNode n) {
5050
super(n, Sets.newHashSet(new ILsaMolecule[] {mol}));
5151

52-
addObservableDependency(n.observeConcentration(mol));
52+
addObservableDependency(n.observeConcentration(mol.generalize()));
5353
setValidity(valid);
5454
setPropensity(MutableObservable.Companion.observe(-1d));
5555

0 commit comments

Comments
 (0)