java.lang.Object
org.bigraphs.framework.core.reactivesystem.AbstractReactionRule<B>
- Type Parameters:
B- type of the bigraph
- All Implemented Interfaces:
HasLabel,HasPriority,ReactionRule<B>
- Direct Known Subclasses:
AbstractReactionRule.ReactiveSystemBoundReactionRule,GroundReactionRule,ParametricReactionRule
public abstract class AbstractReactionRule<B extends Bigraph<? extends Signature<?>>>
extends Object
implements ReactionRule<B>
This base class represents an immutable data structure for all kinds of reaction rules.
It contains the redex, reactum and an instantiation map.
The signature is inferred from the redex since both redex and reactum must have the same signature, otherwise an exception is thrown when instantiating a concrete reaction rule.
Other checks are also performed checking the reaction rule for conformity: Interfaces and "simpleness".
A rule is said to be linear when they do not duplicate or delete parameters.
- Author:
- Dominik Grzelak
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classAbstractReactionRule.ReactiveSystemBoundReactionRule<B extends Bigraph<? extends Signature<?>>> -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected booleanprotected InstantiationMapprotected Stringprotected longprotected ReactiveSystem<B> protected final Bprotected final Bprotected final Signature<?> protected TrackingMap -
Constructor Summary
ConstructorsConstructorDescriptionAbstractReactionRule(B redex, B reactum) AbstractReactionRule(B redex, B reactum, boolean isReversible) AbstractReactionRule(B redex, B reactum, InstantiationMap instantiationMap) AbstractReactionRule(B redex, B reactum, InstantiationMap instantiationMap, boolean isReversible) AbstractReactionRule(ReactiveSystem delegate, AbstractReactionRule rule) -
Method Summary
Modifier and TypeMethodDescriptionprotected voidprotected voidprotected voidReturn the instantiation map of the parametric reaction rulegetLabel()longReturn the reactum of the reaction rulegetRedex()Return the redex of the reaction ruleSignature<?> Returns the tracking map if one was specified for the rule.booleanA flag that indicates whether the rule can be also executed in reverse.withInstantiationMap(InstantiationMap instantiationMap) <T extends AbstractReactionRule<B>>
T<T extends AbstractReactionRule<B>>
TwithPriority(long priority) withReactiveSystem(ReactiveSystem<B> reactiveSystem) withTrackingMap(TrackingMap trackingMap) Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.bigraphs.framework.core.reactivesystem.ReactionRule
isParametricRule, isProperParametricRule, isRedexSimple
-
Field Details
-
signature
-
redex
-
reactum
-
canReverse
protected boolean canReverse -
instantiationMap
-
reactiveSystemAffili
-
label
-
priority
protected long priority -
trackingMap
-
-
Constructor Details
-
AbstractReactionRule
- Throws:
InvalidReactionRuleException
-
AbstractReactionRule
public AbstractReactionRule(B redex, B reactum, InstantiationMap instantiationMap) throws InvalidReactionRuleException - Throws:
InvalidReactionRuleException
-
AbstractReactionRule
public AbstractReactionRule(B redex, B reactum, boolean isReversible) throws InvalidReactionRuleException - Throws:
InvalidReactionRuleException
-
AbstractReactionRule
public AbstractReactionRule(B redex, B reactum, InstantiationMap instantiationMap, boolean isReversible) throws InvalidReactionRuleException - Throws:
InvalidReactionRuleException
-
AbstractReactionRule
public AbstractReactionRule(ReactiveSystem delegate, AbstractReactionRule rule) throws InvalidReactionRuleException - Throws:
InvalidReactionRuleException
-
-
Method Details
-
withReactiveSystem
public AbstractReactionRule.ReactiveSystemBoundReactionRule<B> withReactiveSystem(ReactiveSystem<B> reactiveSystem) -
getLabel
-
withLabel
-
getPriority
public long getPriority()- Specified by:
getPriorityin interfaceHasPriority
-
withPriority
-
assertRedexIsSimple
- Throws:
RedexIsNotSimpleException
-
assertIsProperParametricRule
-
assertInstantiationMapIsWellDefined
- Throws:
InstantiationMapIsNotWellDefined
-
getInstantationMap
Description copied from interface:ReactionRuleReturn the instantiation map of the parametric reaction rule- Specified by:
getInstantationMapin interfaceReactionRule<B extends Bigraph<? extends Signature<?>>>- Returns:
- the instantiation map of the parametric reaction rule
-
isReversible
public boolean isReversible()Description copied from interface:ReactionRuleA flag that indicates whether the rule can be also executed in reverse. For a rule R -> R' it means that R' -> R can also be used.This flag is usually evaluated in a reactive system class.
- Specified by:
isReversiblein interfaceReactionRule<B extends Bigraph<? extends Signature<?>>>- Returns:
true, if the rule can also be used reversely, otherwisefalse
-
getRedex
Description copied from interface:ReactionRuleReturn the redex of the reaction rule- Specified by:
getRedexin interfaceReactionRule<B extends Bigraph<? extends Signature<?>>>- Returns:
- the redex of the reaction rule
-
getReactum
Description copied from interface:ReactionRuleReturn the reactum of the reaction rule- Specified by:
getReactumin interfaceReactionRule<B extends Bigraph<? extends Signature<?>>>- Returns:
- the reactum of the reaction rule
-
getSignature
-
withTrackingMap
-
withInstantiationMap
-
getTrackingMap
Description copied from interface:ReactionRuleReturns the tracking map if one was specified for the rule. A tracking map helps to trace node and link identities through reactions.- Specified by:
getTrackingMapin interfaceReactionRule<B extends Bigraph<? extends Signature<?>>>- Returns:
- the tracking map of the rule
-