public class ChangeMonitor extends IChangeMonitor
IQuerySpecification
objects or EMV
Rules defined by the user to achieve this.
Based on the instance model to be monitored, a VIATRA Query Engine should be initialized and handed over to this class.
An ExecutionSchema is initialized based on the VIATRA Query Engine, then the rules defined by the user are registered in
it.
By default the monitor accumulates the changes of the defined QuerySpecifications, this behavior, however can be
overridden via inheritance.Constructor and Description |
---|
ChangeMonitor(ViatraQueryEngine engine)
Constructor that creates a new ChangeMonitor instance based on the specified ViatraQuery engine.
|
Modifier and Type | Method and Description |
---|---|
void |
addRule(IQuerySpecification<?> spec)
Public method used for adding new rules to the monitor.
|
void |
addRule(RuleSpecification<IPatternMatch> rule)
Public method used for adding new rules to the monitor.
|
ChangeDelta |
createCheckpoint()
Creates a new checkpoint and returns the changes in the model so far.
|
protected java.util.Set<Job<IPatternMatch>> |
createDefaultProcessorJobs()
Creates the default EVM Jobs which are executed as a new match appears, disappears or is updated.
|
void |
dispose()
Disposes the Change monitor's execution schema
|
ChangeDelta |
getDeltaSinceLastCheckpoint()
Returns the changes in the model since the last checkpoint.
|
protected void |
registerAppear(IPatternMatch match)
Extracts appeared elements from the given match
|
protected void |
registerDisappear(IPatternMatch match)
Extracts disappeared elements from the given match
|
protected void |
registerUpdate(IPatternMatch match)
Extracts updated elements from the given match
|
void |
removeRule(IQuerySpecification<?> spec)
Public method used for removing rules from the Monitor.
|
void |
removeRule(RuleSpecification<IPatternMatch> rule)
Public method used for removing rules from the Monitor.
|
void |
startMonitoring()
Adds the defined rules to the ExecutionSchema and enables them.
|
public ChangeMonitor(ViatraQueryEngine engine)
engine
- The ViatraQueryEngine the monitor is based on.public void addRule(RuleSpecification<IPatternMatch> rule)
rule
- The rule to be added to the monitorpublic void addRule(IQuerySpecification<?> spec)
spec
- QuerySpecification to be added to the Monitorpublic void removeRule(RuleSpecification<IPatternMatch> rule)
rule
- Rule to be removedpublic void removeRule(IQuerySpecification<?> spec)
spec
- The rules based on this QuerySpecification will be removedpublic ChangeDelta createCheckpoint()
createCheckpoint
in class IChangeMonitor
public ChangeDelta getDeltaSinceLastCheckpoint()
getDeltaSinceLastCheckpoint
in class IChangeMonitor
public void startMonitoring()
startMonitoring
in class IChangeMonitor
ViatraQueryRuntimeException
public void dispose()
protected java.util.Set<Job<IPatternMatch>> createDefaultProcessorJobs()
protected void registerUpdate(IPatternMatch match)
match
- protected void registerAppear(IPatternMatch match)
match
- protected void registerDisappear(IPatternMatch match)
match
-