Class FixedPriorityConflictSet
- java.lang.Object
-
- org.eclipse.viatra.transformation.evm.specific.resolver.FixedPriorityConflictSet
-
- All Implemented Interfaces:
ChangeableConflictSet,ConflictSet
- Direct Known Subclasses:
InvertedDisappearancePriorityConflictResolver.InvertedDisappearancePriorityConflictSet
public class FixedPriorityConflictSet extends java.lang.Object implements ChangeableConflictSet
This conflict set resolves conflicts between activations based on Integer valued priorities assigned to rules. The activations of rules with the lowest priority value will be the next activations. SeeFixedPriorityConflictResolverfor more details.
-
-
Constructor Summary
Constructors Constructor Description FixedPriorityConflictSet(FixedPriorityConflictResolver resolver, java.util.Map<RuleSpecification<?>,java.lang.Integer> priorities)FixedPriorityConflictSet(FixedPriorityConflictResolver resolver, java.util.Map<RuleSpecification<?>,java.lang.Integer> priorities, int defaultPriority)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanaddActivation(Activation<?> activation)This method is called by the Agenda when an activation changes state and becomes or is still enabled.protected booleanaddActivation(Activation<?> activation, java.lang.Integer priority)java.util.Set<Activation<?>>getConflictingActivations()Returns all conflicting activations.FixedPriorityConflictResolvergetConflictResolver()Activation<?>getNextActivation()Returns one of the activations of one of the rules with the lowest priority.java.util.Set<Activation<?>>getNextActivations()Returns the set of activations of rules with the lowest priority.protected java.lang.IntegergetRulePriority(Activation<?> activation)protected java.lang.IntegergetRulePriority(RuleSpecification<?> specification)booleanremoveActivation(Activation<?> activation)This method is called by the Agenda when an activation changes state and becomes or is still disabled.protected booleanremoveActivation(Activation<?> activation, java.lang.Integer priority)protected voidsetPriority(RuleSpecification<?> specification, int priority)
-
-
-
Constructor Detail
-
FixedPriorityConflictSet
public FixedPriorityConflictSet(FixedPriorityConflictResolver resolver, java.util.Map<RuleSpecification<?>,java.lang.Integer> priorities)
-
FixedPriorityConflictSet
public FixedPriorityConflictSet(FixedPriorityConflictResolver resolver, java.util.Map<RuleSpecification<?>,java.lang.Integer> priorities, int defaultPriority)
- Since:
- 2.1
-
-
Method Detail
-
getNextActivation
public Activation<?> getNextActivation()
Returns one of the activations of one of the rules with the lowest priority.- Specified by:
getNextActivationin interfaceConflictSet- Returns:
- the next activation chosen by the resolver
-
addActivation
public boolean addActivation(Activation<?> activation)
Description copied from interface:ChangeableConflictSetThis method is called by the Agenda when an activation changes state and becomes or is still enabled. NOTE: The ChangeableConflictSet is responsible for handling thataddmay be called multiple times on an Activation already in the conflict set!- Specified by:
addActivationin interfaceChangeableConflictSet- Parameters:
activation- the activation that should be added to the conflict set- Returns:
- true, if the conflict set changed
-
removeActivation
public boolean removeActivation(Activation<?> activation)
Description copied from interface:ChangeableConflictSetThis method is called by the Agenda when an activation changes state and becomes or is still disabled. NOTE: The ChangeableConflictSet is responsible for handling thatremovemay be called on Activations that are not in the conflict set!- Specified by:
removeActivationin interfaceChangeableConflictSet- Parameters:
activation- the activation that should be removed from the conflict set- Returns:
- true, if the conflict set changed
-
addActivation
protected boolean addActivation(Activation<?> activation, java.lang.Integer priority)
- Since:
- 2.0
-
removeActivation
protected boolean removeActivation(Activation<?> activation, java.lang.Integer priority)
- Since:
- 2.0
-
setPriority
protected void setPriority(RuleSpecification<?> specification, int priority)
-
getConflictResolver
public FixedPriorityConflictResolver getConflictResolver()
- Specified by:
getConflictResolverin interfaceConflictSet
-
getNextActivations
public java.util.Set<Activation<?>> getNextActivations()
Returns the set of activations of rules with the lowest priority.- Specified by:
getNextActivationsin interfaceConflictSet
-
getConflictingActivations
public java.util.Set<Activation<?>> getConflictingActivations()
Returns all conflicting activations.- Specified by:
getConflictingActivationsin interfaceConflictSet
-
getRulePriority
protected java.lang.Integer getRulePriority(Activation<?> activation)
-
getRulePriority
protected java.lang.Integer getRulePriority(RuleSpecification<?> specification)
-
-