public class RuleInstance<EventAtom> extends java.lang.Object implements IActivationNotificationProvider
| Modifier | Constructor and Description |
|---|---|
protected |
RuleInstance(RuleSpecification<EventAtom> specification)
Creates an instance using a RuleSpecification.
|
| Modifier and Type | Method and Description |
|---|---|
ActivationState |
activationStateTransition(Activation<EventAtom> activation,
EventType event)
Performs the state transition on the given activation in response to the specified event
using the life-cycle defined in the rule specification.
|
boolean |
addActivationNotificationListener(IActivationNotificationListener listener,
boolean fireNow)
|
Activation<EventAtom> |
createActivation(EventAtom atom) |
protected void |
dispose()
Disposes the rule instance by inactivating all activations and disposing of its
activation notification provider and attribute monitor.
|
protected void |
doFire(Activation<EventAtom> activation,
ActivationState activationState,
EventAtom atom,
Context context)
Checks whether the activation is part of the activation set of
the instance, then updates the state by calling activationStateTransition().
|
void |
fire(Activation<EventAtom> activation,
Context context)
Fires the given activation using the supplied context.
|
java.util.Collection<Activation<EventAtom>> |
getActivationsFor(ActivationState state) |
java.util.Map<ActivationState,Activation<EventAtom>> |
getActivationsFor(EventAtom atom) |
java.util.Set<Activation<EventAtom>> |
getAllActivations() |
EventFilter<? super EventAtom> |
getFilter() |
ActivationLifeCycle |
getLifeCycle() |
RuleSpecification<EventAtom> |
getSpecification() |
boolean |
removeActivationNotificationListener(IActivationNotificationListener listener)
|
void |
setHandler(EventHandler<EventAtom> handler) |
java.util.stream.Stream<Activation<EventAtom>> |
streamAllActivations() |
java.lang.String |
toString() |
protected RuleInstance(RuleSpecification<EventAtom> specification)
specification - engine - java.lang.IllegalArgumentException - if filter is mutablepublic void setHandler(EventHandler<EventAtom> handler)
public Activation<EventAtom> createActivation(EventAtom atom)
public void fire(Activation<EventAtom> activation, Context context)
activation - context - protected void doFire(Activation<EventAtom> activation, ActivationState activationState, EventAtom atom, Context context)
activation - activationState - atom - context - public ActivationState activationStateTransition(Activation<EventAtom> activation, EventType event)
activation - event - public boolean addActivationNotificationListener(IActivationNotificationListener listener, boolean fireNow)
ActivationNotificationProvider.addActivationNotificationListener(org.eclipse.viatra.transformation.evm.notification.IActivationNotificationListener, boolean).addActivationNotificationListener in interface IActivationNotificationProviderlistener - fireNow - public boolean removeActivationNotificationListener(IActivationNotificationListener listener)
ActivationNotificationProvider.removeActivationNotificationListener(org.eclipse.viatra.transformation.evm.notification.IActivationNotificationListener).removeActivationNotificationListener in interface IActivationNotificationProviderlistener - public RuleSpecification<EventAtom> getSpecification()
public EventFilter<? super EventAtom> getFilter()
public ActivationLifeCycle getLifeCycle()
public java.util.Map<ActivationState,Activation<EventAtom>> getActivationsFor(EventAtom atom)
public java.util.stream.Stream<Activation<EventAtom>> streamAllActivations()
public java.util.Set<Activation<EventAtom>> getAllActivations()
public java.util.Collection<Activation<EventAtom>> getActivationsFor(ActivationState state)
state - protected void dispose()
public java.lang.String toString()
toString in class java.lang.Object