cz.cuni.amis.pogamut.sposh.engine
Class PoshEngine

Package class diagram package PoshEngine
java.lang.Object
  extended by cz.cuni.amis.pogamut.sposh.engine.PoshEngine

public final class PoshEngine
extends Object

This class is responsible for executing the valid posh plan.

Author:
Honza

Nested Class Summary
static class PoshEngine.EvaluationResult
          How did evaluation of plan ended?
static class PoshEngine.EvaluationResultInfo
          Container holding two information about result of last evaluation of the plan and how was stack changed.
 
Constructor Summary
  PoshEngine(int engineId, PoshPlan plan, ITimer timer, Logger log)
          Create new engine of Yaposh plan and reset() it.
protected PoshEngine(PoshPlan plan)
           
protected PoshEngine(PoshPlan plan, ITimer timer)
           
protected PoshEngine(PoshPlan plan, ITimer timer, Logger log)
           
 
Method Summary
 PoshEngine.EvaluationResultInfo evaluatePlan(IWorkExecutor workExecuter)
          Do one step of the plan, pick a drive from DC and execute the element at the top of its stack.
 Logger getLog()
          Get logger of engine
 String getName()
          Get name of engine, retrieved from doc node or from DC name.
 PoshPlan getPlan()
          Get plan of this engine (serialize the parsed plane and return it).
 String getPoshPlan()
          Convert posh tree into posh plan (textual representation) and return it.
 void reset()
          Reset the posh engine, all stacks and variables will be reseted.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PoshEngine

protected PoshEngine(PoshPlan plan)

PoshEngine

protected PoshEngine(PoshPlan plan,
                     ITimer timer)

PoshEngine

protected PoshEngine(PoshPlan plan,
                     ITimer timer,
                     Logger log)

PoshEngine

public PoshEngine(int engineId,
                  PoshPlan plan,
                  @Deprecated
                  ITimer timer,
                  Logger log)
Create new engine of Yaposh plan and reset() it.

Parameters:
engineId - Id of engine, it is used for construction of path in EngineLog.pathReached(cz.cuni.amis.pogamut.sposh.elements.LapPath), it is used as i of the plan.
plan - Plan to be executed.
timer - Timer used by the engine
log - Logger for logging the execution of the engine
Method Detail

reset

public final void reset()
Reset the posh engine, all stacks and variables will be reseted. Use this to return engine to former state, it had when first initialized.


evaluatePlan

public PoshEngine.EvaluationResultInfo evaluatePlan(IWorkExecutor workExecuter)
Do one step of the plan, pick a drive from DC and execute the element at the top of its stack.

Parameters:
workExecuter - Executor used to execute primitives.
Returns:
Result of execution of the plan, how was stack of drive changed.

getLog

public Logger getLog()
Get logger of engine

Returns:
Logger passed in the constructor

getPlan

public final PoshPlan getPlan()
Get plan of this engine (serialize the parsed plane and return it). DO NOT MODIFY ANYTHING IN RETURNED PLAN!

Returns:

getPoshPlan

public final String getPoshPlan()
Convert posh tree into posh plan (textual representation) and return it.

Returns:
Textual representation of the posh tree.

getName

public String getName()
Get name of engine, retrieved from doc node or from DC name.

Returns:
Name of the plan from the documentation, if exists, else name of DC


Copyright © 2014 AMIS research group, Faculty of Mathematics and Physics, Charles University in Prague, Czech Republic. All Rights Reserved.