it.unibo.alchemist.model.sapere.conditions.LsaStandardCondition Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of alchemist-incarnation-sapere Show documentation
Show all versions of alchemist-incarnation-sapere Show documentation
Alchemist incarnation for SAPERE
/*
* Copyright (C) 2010-2023, Danilo Pianini and contributors
* listed, for each module, in the respective subproject's build.gradle.kts file.
*
* This file is part of Alchemist, and is distributed under the terms of the
* GNU General Public License, with a linking exception,
* as described in the file LICENSE in the Alchemist distribution's top directory.
*/
package it.unibo.alchemist.model.sapere.conditions;
import com.google.common.collect.Sets;
import it.unibo.alchemist.model.sapere.dsl.IExpression;
import it.unibo.alchemist.model.sapere.dsl.ITreeNode;
import it.unibo.alchemist.model.Context;
import it.unibo.alchemist.model.sapere.ILsaMolecule;
import it.unibo.alchemist.model.sapere.ILsaNode;
import it.unibo.alchemist.model.Node;
import it.unibo.alchemist.model.Reaction;
import org.danilopianini.lang.HashString;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
/**
* simple LSA-condition (example: <grad,X,1>). Search an instance of a template
* in a node. The LSAMolecule matched, if exist, will not be deleted from the
* node Lsa-space . It can be deleted from the reaction, if necessary.
*/
public class LsaStandardCondition extends LsaAbstractCondition {
private static final long serialVersionUID = 1L;
private final ILsaMolecule molecule;
private boolean valid;
/**
* Builds an LsaStandardCondition.
*
* @param mol
* the molecole whose presence must be tested
* @param n
* the node in which this condition will act
*/
public LsaStandardCondition(final ILsaMolecule mol, final ILsaNode n) {
super(n, Sets.newHashSet(new ILsaMolecule[] { mol }));
molecule = mol;
}
/**
* {@inheritDoc}
*/
@Override
public LsaStandardCondition cloneCondition(final Node> node, final Reaction> r) {
return new LsaStandardCondition(molecule, (ILsaNode) node);
}
/**
* {@inheritDoc}
*/
@Override
public boolean filter(
final List
© 2015 - 2025 Weber Informatics LLC | Privacy Policy