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 class
AbstractReactionRule.ReactiveSystemBoundReactionRule<B extends Bigraph<? extends Signature<?>>>
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected boolean
protected InstantiationMap
protected String
protected long
protected ReactiveSystem<B>
protected final B
protected final B
protected 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 void
protected void
protected void
Return the instantiation map of the parametric reaction rulegetLabel()
long
Return the reactum of the reaction rulegetRedex()
Return the redex of the reaction ruleSignature<?>
Returns the tracking map if one was specified for the rule.boolean
A 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, wait
Methods 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:
getPriority
in interfaceHasPriority
-
withPriority
-
assertRedexIsSimple
- Throws:
RedexIsNotSimpleException
-
assertIsProperParametricRule
-
assertInstantiationMapIsWellDefined
- Throws:
InstantiationMapIsNotWellDefined
-
getInstantationMap
Description copied from interface:ReactionRule
Return the instantiation map of the parametric reaction rule- Specified by:
getInstantationMap
in interfaceReactionRule<B extends Bigraph<? extends Signature<?>>>
- Returns:
- the instantiation map of the parametric reaction rule
-
isReversible
public boolean isReversible()Description copied from interface:ReactionRule
A 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:
isReversible
in interfaceReactionRule<B extends Bigraph<? extends Signature<?>>>
- Returns:
true
, if the rule can also be used reversely, otherwisefalse
-
getRedex
Description copied from interface:ReactionRule
Return the redex of the reaction rule- Specified by:
getRedex
in interfaceReactionRule<B extends Bigraph<? extends Signature<?>>>
- Returns:
- the redex of the reaction rule
-
getReactum
Description copied from interface:ReactionRule
Return the reactum of the reaction rule- Specified by:
getReactum
in interfaceReactionRule<B extends Bigraph<? extends Signature<?>>>
- Returns:
- the reactum of the reaction rule
-
getSignature
-
withTrackingMap
-
withInstantiationMap
-
getTrackingMap
Description copied from interface:ReactionRule
Returns the tracking map if one was specified for the rule. A tracking map helps to trace node and link identities through reactions.- Specified by:
getTrackingMap
in interfaceReactionRule<B extends Bigraph<? extends Signature<?>>>
- Returns:
- the tracking map of the rule
-