public class Handler
extends java.lang.Object
implements java.lang.Runnable
Modifier and Type | Field and Description |
---|---|
protected Task |
associatedTask
Associated task representing the goal of this handler execution.
|
protected Corrector |
correctorReference
Reference to the corrector instance.
|
Constructor and Description |
---|
Handler(Corrector correctorReference,
Task associatedTask)
Creates a new correction handler instance.
|
Modifier and Type | Method and Description |
---|---|
protected Report |
accessProfilingReport()
Returns the shortcut to the profiling report.
|
protected java.util.List<Repair> |
acquireInvokingMultiple(java.util.List<Intent> nestedIntents)
Fetches the required repairs or requests their invoked execution.
|
protected Repair |
acquireInvokingSingle(Intent nestedIntent)
Fetches the required repair or requests its invoked execution.
|
protected Repair |
acquireNestingSingle(Intent nestedIntent)
Fetches the required repair or requests its nested execution.
|
protected java.util.List<Repair> |
acquireSchedulingMultiple(Requests requestsData,
java.util.List<Intent> nestedIntents,
java.util.List<Edge> nestedEdges)
Fetches the required repairs or requests their scheduled execution.
|
protected Repair |
acquireSchedulingSingle(Requests requestsData,
Intent nestedIntent,
Edge nestedEdge)
Fetches the required repair or requests its scheduled execution.
|
protected void |
activateInvokingIterative(Task nestedTask,
Quota grantedQuota)
Activates the particular invoked task.
|
protected void |
activateInvokingStandard(Task nestedTask)
Activates the particular invoked task.
|
void |
dispatchEndingNotifications()
Sends required notifications at the end of the handler job execution.
|
void |
dispatchIterativeRequests(java.util.List<Edge> nestedEdges,
java.util.List<Task> nestedTasks,
java.util.List<Quota> nestedQuotas)
Dispatches all requests to the iterative refinement processing.
|
void |
dispatchStandardRequests(Vertex selectedVertex,
java.util.List<Intent> nestedIntents)
Dispatches all requests to the standard execution processing.
|
protected void |
doEdgeClosing(Edge nestedEdge,
Repair nestedRepair)
Closes the exploration of a given edge and its correction intent.
|
protected Edge |
doEdgeOpening(Intent nestedIntent)
Opens the exploration of a newly reached edge and its intent.
|
protected java.util.List<Edge> |
doEdgesOpening(java.util.List<Intent> nestedIntents)
Opens the exploration of edges for the entire set of intents.
|
protected void |
executeInvokingCorrection()
Entry point for the correction in case of the INVOKING approaches.
|
protected void |
executeNestingCorrection()
Entry point for the correction in case of the NESTING approaches.
|
protected void |
executeSchedulingCorrection()
Entry point for the correction in case of the SCHEDULING approaches.
|
Task |
getAssociatedTask()
Returns the associated correction task.
|
protected void |
handleInvokingMultiple(Vertex selectedVertex,
java.util.List<Intent> nestedIntents)
Processes exploration and invoked evaluation of all allowed intents.
|
protected void |
handleInvokingSingle(Vertex selectedVertex,
java.util.List<Intent> nestedIntents)
Processes exploration and invoked evaluation of all allowed intents.
|
protected void |
handleNestingSingle(Vertex selectedVertex,
java.util.List<Intent> nestedIntents)
Processes exploration and nested evaluation of all allowed intents.
|
protected void |
handleSchedulingMultiple(Vertex selectedVertex,
java.util.List<Intent> nestedIntents)
Processes exploration and scheduled evaluation of all allowed intents.
|
protected void |
handleSchedulingSingle(Requests requestsData,
Edge nestedEdge)
Processes exploration and scheduled evaluation of the given intent.
|
protected void |
handleSchedulingSingle(Vertex selectedVertex,
java.util.List<Intent> nestedIntents)
Processes exploration and scheduled evaluation of all allowed intents.
|
protected boolean |
hasApproach(Corrector.ExecutionApproach selectedApproach)
Tests whether the given execution approach is activated.
|
protected boolean |
hasExceededQuota()
Detects whether the iterative processing can continue.
|
protected boolean |
hasSignatures(Corrector.SignatureHandling selectedMode)
Tests whether the given signatures handling mode is activated.
|
protected boolean |
hasStatsProfiling()
Tests whether exploration statistics profiling is enabled.
|
protected boolean |
hasStrategy(Corrector.AlgorithmStrategy selectedStrategy)
Tests whether the given algorithm strategy is activated.
|
protected boolean |
hasTimesProfiling()
Tests whether execution times profiling is enabled.
|
protected Graph |
initCorrectionGraph()
Creates and initialises the correction multigraph.
|
boolean |
isVertexComplete(Record vertexReport)
Detects whether the given reached vertex can be completed.
|
protected void |
notifyInvokedMultiple()
Notifies all the parental tasks about the completed invoked execution.
|
protected void |
notifyInvokedSingle()
Notifies the only parental task about the completed invoked execution.
|
protected void |
notifyScheduledMultiple()
Notifies all the parental tasks about the completed scheduled execution.
|
protected void |
notifyScheduledSingle()
Notifies the only parental task about the completed scheduled execution.
|
protected void |
performCompleteExecution()
Processes the complete evaluation.
|
protected void |
performScatteredExecution()
Processes the complete execution scattered into steps.
|
protected void |
processCompleteVertex(Record reportData,
Vertex selectedVertex)
Processes the complete vertex using the iterative strategy.
|
protected void |
processDelayedEdges()
Processes the delayed edges using the iterative strategy.
|
protected void |
processExplorationLoop()
Performs or continues the multigraph exploration.
|
protected void |
processIncompleteVertex(Record reportData,
Vertex selectedVertex)
Processes the incomplete vertex using the iterative strategy.
|
protected void |
processIterativeLoop()
Performs or continues the multigraph exploration.
|
protected void |
processPathsSearching()
Finds all shortest paths in the provided and fully explored multigraph.
|
protected void |
processPreparedIntents(Requests requestsData)
Process one of the prepared or postponed nested intents and its edge.
|
protected void |
processPreparedRefinements(Requests requestsData)
Process one of the prepared or postponed nested intents and its edge.
|
protected void |
processRequestsClosing(Requests requestsData)
Closes the set of previously requested intents and their exploration.
|
protected void |
processSelectedVertex(Vertex selectedVertex)
Performs or starts the further exploration of the selected vertex.
|
protected void |
requestInvokingMultiple(java.util.List<Task> nestedTasks,
java.util.List<Quota> grantedQuotas)
Requests the invoked refinement execution for a set of tasks.
|
protected void |
requestInvokingSingle(java.util.List<Task> nestedTasks,
java.util.List<Quota> grantedQuotas)
Requests the invoked refinement execution for a set of tasks.
|
protected void |
requestMultipleScheduling(java.util.List<Task> nestedTasks,
java.util.List<Quota> grantedQuotas)
Requests the scheduled refinement execution for a set of tasks.
|
protected void |
requestNestingSingle(java.util.List<Task> nestedTasks,
java.util.List<Quota> grantedQuotas)
Requests the nested refinement execution for a set of tasks.
|
protected void |
requestSchedulingSingle(java.util.List<Task> nestedTasks,
java.util.List<Quota> grantedQuotas)
Requests the scheduled refinement execution for a set of tasks.
|
protected Quota |
resolveGrantedQuota(Edge nestedEdge,
int allowedRise)
Prepares the quota object to be assigned to the given task.
|
protected Record |
resolveVertexReport(Vertex inspectedVertex)
Computes the full report for the given reached vertex.
|
void |
run()
Entry point of the particular correction handler execution.
|
protected void |
scheduleIterativeExtended(Requests requestsData,
Task nestedTask,
Quota grantedQuota)
Activates the particular scheduled task.
|
protected void |
scheduleIterativeSimple(Requests requestsData,
Task nestedTask,
Quota grantedQuota)
Activates the particular scheduled task.
|
protected void |
scheduleStandardExtended(Requests requestsData,
Task nestedTask,
Edge nestedEdge)
Activates the particular scheduled task.
|
protected void |
scheduleStandardSimple(Requests requestsData,
Task nestedTask,
Edge nestedEdge)
Activates the particular scheduled task.
|
protected Vertex |
selectAnyVertex()
Returns some reached vertex from the set of reached vertices.
|
protected Vertex |
selectCheapestVertex()
Returns the first reached vertex with the lowest cost.
|
protected Record |
selectPromisingReport()
Selects the most promising reached vertex by exploring their reports.
|
protected boolean |
shouldFixateCost(Vertex selectedVertex)
Detects if the final cost should be fixed during the exploration.
|
protected boolean |
shouldQuitExploring(int reachedCost)
Detects whether the exploration can be already terminated.
|
protected void |
triggerInvokingSingle(Task nestedTask,
Quota grantedQuota)
Requests the invoked refinement execution for a given task.
|
protected void |
updatePathsTracing(Edge inspectedEdge)
Updates records about paths to the target vertex of the provided edge.
|
protected final Corrector correctorReference
protected final Task associatedTask
public void run()
run
in interface java.lang.Runnable
protected void executeNestingCorrection()
protected void executeInvokingCorrection()
protected void executeSchedulingCorrection()
protected void performCompleteExecution()
protected void performScatteredExecution()
protected void processExplorationLoop()
protected void processIterativeLoop()
protected void processSelectedVertex(Vertex selectedVertex)
selectedVertex
- Selected vertex to be further explored.protected void processCompleteVertex(Record reportData, Vertex selectedVertex)
reportData
- Full report for the selected reached vertex.selectedVertex
- Selected vertex to be further explored.protected void processIncompleteVertex(Record reportData, Vertex selectedVertex)
reportData
- Full report for the selected reached vertex.selectedVertex
- Selected vertex to be further explored.protected void processPreparedIntents(Requests requestsData)
requestsData
- Shortcut to the requests data container.protected void processPreparedRefinements(Requests requestsData)
requestsData
- Shortcut to the requests data container.protected void processDelayedEdges()
protected void processRequestsClosing(Requests requestsData)
requestsData
- Shortcut to the requests data container.public void dispatchStandardRequests(Vertex selectedVertex, java.util.List<Intent> nestedIntents)
selectedVertex
- Selected vertex to be further explored.nestedIntents
- List of nested intents to be processed.public void dispatchIterativeRequests(java.util.List<Edge> nestedEdges, java.util.List<Task> nestedTasks, java.util.List<Quota> nestedQuotas)
nestedEdges
- List of nested edges to be executed.nestedTasks
- List of associated correction tasks.nestedQuotas
- List of associated assigned quotas.protected void handleNestingSingle(Vertex selectedVertex, java.util.List<Intent> nestedIntents)
selectedVertex
- Selected vertex to be further explored.nestedIntents
- List of nested intents to be processed.protected void handleInvokingSingle(Vertex selectedVertex, java.util.List<Intent> nestedIntents)
selectedVertex
- Selected vertex to be further explored.nestedIntents
- List of nested intents to be processed.protected void handleInvokingMultiple(Vertex selectedVertex, java.util.List<Intent> nestedIntents)
selectedVertex
- Selected vertex to be further explored.nestedIntents
- List of nested intents to be processed.protected void handleSchedulingSingle(Vertex selectedVertex, java.util.List<Intent> nestedIntents)
selectedVertex
- Selected vertex to be further explored.nestedIntents
- List of nested intents to be processed.protected void handleSchedulingSingle(Requests requestsData, Edge nestedEdge)
requestsData
- Shortcut to the requests data container.nestedEdge
- Particular postponed edge and its intent.protected void handleSchedulingMultiple(Vertex selectedVertex, java.util.List<Intent> nestedIntents)
selectedVertex
- Selected vertex to be further explored.nestedIntents
- List of nested intents to be processed.protected Edge doEdgeOpening(Intent nestedIntent)
nestedIntent
- Nested correction intent reference.protected java.util.List<Edge> doEdgesOpening(java.util.List<Intent> nestedIntents)
nestedIntents
- Set of nested correction intentsdoEdgeOpening(cz.cuni.mff.corrector.intent.Intent)
protected void doEdgeClosing(Edge nestedEdge, Repair nestedRepair)
nestedEdge
- Reference to the edge to be closed.nestedRepair
- Reference to the repair to be associated.protected Repair acquireNestingSingle(Intent nestedIntent)
nestedIntent
- Nested correction intent to be evaluated.protected void requestNestingSingle(java.util.List<Task> nestedTasks, java.util.List<Quota> grantedQuotas)
nestedTasks
- List of tasks to be requested.grantedQuotas
- List of associated granted quotas.protected Repair acquireInvokingSingle(Intent nestedIntent)
nestedIntent
- Nested correction intent to be evaluated.protected void requestInvokingSingle(java.util.List<Task> nestedTasks, java.util.List<Quota> grantedQuotas)
nestedTasks
- List of tasks to be requested.grantedQuotas
- List of associated granted quotas.protected void triggerInvokingSingle(Task nestedTask, Quota grantedQuota)
nestedTask
- Reference to the task to be requested.grantedQuota
- Associated granted quota to be passed.protected java.util.List<Repair> acquireInvokingMultiple(java.util.List<Intent> nestedIntents)
nestedIntents
- Nested correction intents to be evaluated.protected void activateInvokingStandard(Task nestedTask)
nestedTask
- Nested task to be activated.protected void requestInvokingMultiple(java.util.List<Task> nestedTasks, java.util.List<Quota> grantedQuotas)
nestedTasks
- List of tasks to be requested.grantedQuotas
- List of associated granted quotas.protected void activateInvokingIterative(Task nestedTask, Quota grantedQuota)
nestedTask
- Nested task to be activated.grantedQuota
- Prepared granted quota description.protected Repair acquireSchedulingSingle(Requests requestsData, Intent nestedIntent, Edge nestedEdge)
requestsData
- Shortcut to the requests data container.nestedIntent
- Nested correction intent to be evaluated.nestedEdge
- Nested edge associated with the given intent.null
.protected void scheduleStandardSimple(Requests requestsData, Task nestedTask, Edge nestedEdge)
requestsData
- Shortcut to the requests container.nestedTask
- Nested task to be activated.nestedEdge
- Reference to the associated edge.protected void requestSchedulingSingle(java.util.List<Task> nestedTasks, java.util.List<Quota> grantedQuotas)
nestedTasks
- List of tasks to be requested.grantedQuotas
- List of associated granted quotas.protected void scheduleIterativeSimple(Requests requestsData, Task nestedTask, Quota grantedQuota)
requestsData
- Shortcut to the requests container.nestedTask
- Nested task to be activated.grantedQuota
- Reference to the assigned quota.protected java.util.List<Repair> acquireSchedulingMultiple(Requests requestsData, java.util.List<Intent> nestedIntents, java.util.List<Edge> nestedEdges)
requestsData
- Shortcut to the requests data container.nestedIntents
- Nested correction intents to be evaluated.nestedEdges
- Nested edges associated with the intents.null
references.
The output order of repairs is equal to the input order of intents!protected void scheduleStandardExtended(Requests requestsData, Task nestedTask, Edge nestedEdge)
requestsData
- Shortcut to the requests container.nestedTask
- Nested task to be activated.nestedEdge
- Reference to the associated edge.protected void requestMultipleScheduling(java.util.List<Task> nestedTasks, java.util.List<Quota> grantedQuotas)
nestedTasks
- List of tasks to be requested.grantedQuotas
- List of associated granted quotas.protected void scheduleIterativeExtended(Requests requestsData, Task nestedTask, Quota grantedQuota)
requestsData
- Shortcut to the requests container.nestedTask
- Nested task to be activated.grantedQuota
- Reference to the assigned quota.public void dispatchEndingNotifications()
protected void notifyInvokedSingle()
protected void notifyInvokedMultiple()
protected void notifyScheduledSingle()
protected void notifyScheduledMultiple()
protected Quota resolveGrantedQuota(Edge nestedEdge, int allowedRise)
nestedEdge
- Reference to the inspected edge.allowedRise
- Granted growth of the edge cost.protected boolean hasExceededQuota()
true
when further processing is allowed.protected Vertex selectAnyVertex()
protected Vertex selectCheapestVertex()
protected Record selectPromisingReport()
protected Record resolveVertexReport(Vertex inspectedVertex)
inspectedVertex
- Reached vertex to be inspected and updated.public boolean isVertexComplete(Record vertexReport)
vertexReport
- Record data prepared for the inspected vertex.true
in case the given vertex is complete.protected boolean shouldFixateCost(Vertex selectedVertex)
selectedVertex
- Currently selected reached vertex.true
if the final cost should be fixed.
The cost should be fixed if we (during the multigraph exploration)
come across the first target vertex (i.e. some vertex from the last
stratum with an accepting state from the corresponding automaton).protected boolean shouldQuitExploring(int reachedCost)
reachedCost
- Current value of the reached exploration cost.true
if the exploration should be ended.protected Graph initCorrectionGraph()
protected void processPathsSearching()
protected void updatePathsTracing(Edge inspectedEdge)
inspectedEdge
- Already evaluated edge to be inspected.public Task getAssociatedTask()
protected boolean hasStrategy(Corrector.AlgorithmStrategy selectedStrategy)
selectedStrategy
- Algorithm strategy to be tested.true
if the strategy corresponds.protected boolean hasApproach(Corrector.ExecutionApproach selectedApproach)
selectedApproach
- Execution approach to be tested.true
if the approach corresponds.protected boolean hasSignatures(Corrector.SignatureHandling selectedMode)
selectedMode
- Signature handling mode to be tested.true
if the mode corresponds.protected Report accessProfilingReport()
protected boolean hasTimesProfiling()
true
when time profiling active.protected boolean hasStatsProfiling()
true
when statistics profiling active.