cz.cuni.amis.pogamut.sposh.executor
Class PrintWorkExecutor

Package class diagram package PrintWorkExecutor
java.lang.Object
  extended by cz.cuni.amis.pogamut.sposh.executor.PrintWorkExecutor
All Implemented Interfaces:
IWorkExecutor

public class PrintWorkExecutor
extends Object
implements IWorkExecutor

Very simple executor for plans that will print name of primitive, that is supposed to execute, to specified stream.

There are two lists of primitives, one will always return true, other will always return false. Both will be printed. Primitives that are not in either of lists will cause exception IllegalArgumentException.

Author:
Honza

Constructor Summary
PrintWorkExecutor(String[] succeed, String[] fail)
          Create worker that will print name of primitives into System.out.
PrintWorkExecutor(String[] succeed, String[] fail, PrintStream stream)
          Create worker that will print name of primitives into specified stream.
 
Method Summary
 void addPrimitives(String[] primitives, Boolean value)
          Add primitives to the map with specified return value.
 ActionResult executeAction(String primitive, VariableContext ctx)
          Execute action and get the result.
 Object executeSense(String primitive, VariableContext ctx)
          Execute sense and get the result.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PrintWorkExecutor

public PrintWorkExecutor(String[] succeed,
                         String[] fail,
                         PrintStream stream)
Create worker that will print name of primitives into specified stream.

Parameters:
succeed - list of non-zero length strings with names of primitives returning true
fail - list of non-zero length strings with names of primitives returning false
stream - stream to write into
Throws:
IllegalArgumentException - If some primitive is specified twice,

PrintWorkExecutor

public PrintWorkExecutor(String[] succeed,
                         String[] fail)
Create worker that will print name of primitives into System.out.

Method Detail

addPrimitives

public void addPrimitives(String[] primitives,
                          Boolean value)
Add primitives to the map with specified return value.

Parameters:
primitives - list of primitives we want to add.
value - what value should all primitives return
Throws:
IllegalArgumentException - If some primitive is specified twice,

executeSense

public Object executeSense(String primitive,
                           VariableContext ctx)
Description copied from interface: IWorkExecutor
Execute sense and get the result.

Specified by:
executeSense in interface IWorkExecutor
Parameters:
primitive - name of primitive
ctx - variable context for sense containing possible parameters
Returns:
result of executed primitive

executeAction

public ActionResult executeAction(String primitive,
                                  VariableContext ctx)
Description copied from interface: IWorkExecutor
Execute action and get the result.

Specified by:
executeAction in interface IWorkExecutor
Parameters:
primitive - name of primitive
ctx - variable context for action containing possible parameters
Returns:
result of executed primitive


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