com.kuka.appframework
Class ApplicationBlock<E extends Enum<?>>

java.lang.Object
  extended by com.kuka.appframework.ApplicationBlock<E>
Type Parameters:
E - The generic type of the ApplicationBlock. The enumeration of the generic type can be defined inside a concrete ApplicationBlock or outside, e.g. as a separate file. It can be used in one or multiple ApplicationBlocks.

public abstract class ApplicationBlock<E extends Enum<?>>
extends Object

The ApplicationBlock is the code behind a Block in the BlockModel.

The user code is defined in its run method. The run method will return a value which represents an exit of the Block.

The user code is responsible for returning the right values. To check preconditions before running the block, override checkPreconditions() method. To add inputs create and annotate a setter method with an Input annotation. To add outputs create and annotate a getter method with an Output annotation. When annotated with CyclicPreconditionCheck failing preconditions will be rechecked until all pass.

Checking interval is configurable via CyclicPreconditionCheck parameter.

When CyclicPreconditionCheck is enabled, checks will be performed until all preconditions pass or user chooses to ignore failing preconditions.


Constructor Summary
ApplicationBlock()
           
 
Method Summary
 void checkPreconditions(IChecker checker)
          This method is executed before run() method.
abstract  E run()
          The run method.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ApplicationBlock

public ApplicationBlock()
Method Detail

checkPreconditions

public void checkPreconditions(IChecker checker)
                        throws Exception
This method is executed before run() method.

A precondition is defined using IChecker.check(boolean, String) method. Example:

 checker.check(isGripperOpen(), "Check if gripper is open")
 

checkPreconditions(IChecker) is a blocking operation and will be executed at least once before run() method. run() will only be executed if all preconditions pass or user chooses to ignore failed preconditions. NOTE: CyclicPreconditionCheck is disabled when user chooses to ignore preconditions.

Parameters:
checker - the checker that will handle the result of the precondition check
Throws:
Exception - an exception that can occur while checking

run

public abstract E run()
                               throws Exception
The run method. This will execute the user code.

Returns:
The result of the user code execution. This is a value of the generic type of the ApplicationBlock. A return value of null will result in an exception during runtime of the BlockModel.
Throws:
Exception - Any exceptions that result while executing the user code.


Copyright © 2018. All rights reserved.