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.
|
com.google.common.collect.Table<ActivationState,EventAtom,Activation<EventAtom>> |
getActivations() |
java.util.Collection<Activation<EventAtom>> |
getActivations(ActivationState state) |
java.util.Collection<Activation<EventAtom>> |
getAllActivations() |
EventFilter<? super EventAtom> |
getFilter() |
ActivationLifeCycle |
getLifeCycle() |
RuleSpecification<EventAtom> |
getSpecification() |
boolean |
removeActivationNotificationListener(IActivationNotificationListener listener)
|
void |
setHandler(EventHandler<EventAtom> handler) |
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 IActivationNotificationProvider
listener
- fireNow
- public boolean removeActivationNotificationListener(IActivationNotificationListener listener)
ActivationNotificationProvider.removeActivationNotificationListener(org.eclipse.viatra.transformation.evm.notification.IActivationNotificationListener)
.removeActivationNotificationListener
in interface IActivationNotificationProvider
listener
- public RuleSpecification<EventAtom> getSpecification()
public EventFilter<? super EventAtom> getFilter()
public ActivationLifeCycle getLifeCycle()
public com.google.common.collect.Table<ActivationState,EventAtom,Activation<EventAtom>> getActivations()
public java.util.Collection<Activation<EventAtom>> getAllActivations()
public java.util.Collection<Activation<EventAtom>> getActivations(ActivationState state)
state
- protected void dispose()
public java.lang.String toString()
toString
in class java.lang.Object