Class ReactionRuleComposer<R extends ReactionRule<?>>
java.lang.Object
org.bigraphs.framework.core.reactivesystem.ReactionRuleComposer<R>
- Type Parameters:
R- the concrete reaction rule type produced by this composer
Utility class to compose reaction rules into a new single rule.
This class supports two operations:
- Parallel product: places the redex and reactum of two rules side by side under distinct roots.
- Merge product: places the redex and reactum of two rules side by side under a single, common root.
- Instantiation map
- Tracking map (if present)
- Rule label: created by concatenating the labels using a configurable separator (
_PP_)
"_PP_" and can be changed via withSeparator(String).- Author:
- Dominik Grzelak
- See Also:
-
Nested Class Summary
Nested Classes -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidassertRuleLabelNotEmpty(String ruleLabel) protected voidprotected BigraphComposite<DynamicSignature> composeBigraphs(PureBigraph left, PureBigraph right, ReactionRuleComposer.RuleProductOperation operation) Get the "intermediate string" used to separate two rule labels when they are composed.mergeProduct(ReactionRule<PureBigraph> left, ReactionRule<PureBigraph> right) Computes the merge product of two reaction rules.parallelProduct(ReactionRule<PureBigraph> left, ReactionRule<PureBigraph> right) This method composes two rules by using the parallel product.protected RruleProduct(ReactionRule<PureBigraph> left, ReactionRule<PureBigraph> right, ReactionRuleComposer.RuleProductOperation operation) withSeparator(String separator) When two rules are composed, their labels are also composed.
-
Constructor Details
-
ReactionRuleComposer
public ReactionRuleComposer()
-
-
Method Details
-
parallelProduct
public R parallelProduct(ReactionRule<PureBigraph> left, ReactionRule<PureBigraph> right) throws InvalidReactionRuleException, IncompatibleInterfaceException This method composes two rules by using the parallel product. The instantiation map, the tracking map (if employed), and the labels are also updated accordingly. If redexes or reactums of both rules share the same outer name, they will be merged.Note: The labels of both rules must be set.
- Parameters:
left- the left ruleright- the right rule- Returns:
- the parallel product of the two rules
- Throws:
InvalidReactionRuleException- if the product is invalidIncompatibleInterfaceException- if the product is invalid
-
mergeProduct
public R mergeProduct(ReactionRule<PureBigraph> left, ReactionRule<PureBigraph> right) throws InvalidReactionRuleException, IncompatibleInterfaceException Computes the merge product of two reaction rules.This operation combines the two given rules by merging their structures. The instantiation map, the tracking map (if present), and the labels are updated accordingly. If the redexes or reactums of both rules share the same outer name, those components are merged into a single one.
Note: Both reaction rules must have their labels defined prior to invoking this method.
- Parameters:
left- the first reaction rule to be mergedright- the second reaction rule to be merged- Returns:
- the merge product of the two reaction rules
- Throws:
InvalidReactionRuleException- if the resulting merge product is not a valid reaction ruleIncompatibleInterfaceException- if the interfaces of the two reaction rules are incompatible
-
ruleProduct
protected R ruleProduct(ReactionRule<PureBigraph> left, ReactionRule<PureBigraph> right, ReactionRuleComposer.RuleProductOperation operation) throws InvalidReactionRuleException, IncompatibleInterfaceException -
composeBigraphs
protected BigraphComposite<DynamicSignature> composeBigraphs(PureBigraph left, PureBigraph right, ReactionRuleComposer.RuleProductOperation operation) throws InvalidReactionRuleException, IncompatibleInterfaceException -
withSeparator
When two rules are composed, their labels are also composed. The "separator string" is the intermediate string between these two rule labels.- Parameters:
separator- any string used to separate two rule labels- Returns:
- this instance
-
getSeparator
Get the "intermediate string" used to separate two rule labels when they are composed. -
assertSeparatorStringNotContainedInRuleLabel
-
assertRuleLabelNotEmpty
-