com.kuka.command
Interface ICommandPipe


public interface ICommandPipe

An interface describing the unit responsible for the execution of commands.

Commands can be executed synchronously and asynchronously by calling execute(ICommand) and executeAsync(ICommand) methods respectively. These methods return objects of type ICommandExecutionContainer which are responsible for management of the command runtime information.

It is only possible for a pipe to execute one command in any moment of time. The other commands will be added to the queue and wait until the slot for the active command will be free.


Method Summary
 void addStateListener(ICommandStateListener listener)
          Adds a state listener to the command pipe.
 void cancelAll()
          Cancels all command execution container which are currently executed or queued.
 void cancelAllAsync()
          See cancelAllAsync(ICancelListener).
 void cancelAllAsync(ICancelListener listener)
          Cancels all command execution container which are currently executed or queued.
 void cancelAsync(ICommandExecutionContainer<?,?,?> container)
          Cancels the given command execution container.
 void cancelAsync(ICommandExecutionContainer<?,?,?> container, ICancelListener listener)
          Cancels the given command execution container.
<T extends ICommand<T,E>,E extends ICommandExecutionContainer<T,?,?>>
boolean
canExecute(T command)
          Tests if a command can be executed by this command pipe.
<T extends ICommand<T,E>,E extends ICommandExecutionContainer<T,?,?>>
E
execute(T command)
          Executes the given command synchronously.
<T extends ICommand<T,E>,E extends ICommandExecutionContainer<T,?,?>>
E
executeAsync(T command)
          Executes the given command asynchronously.
 ICommandExecutionContainer<?,?,?> getActive()
          Returns the command execution container which is currently executed.
 List<ICommandExecutionContainer<?,?,?>> getAll()
          Returns all command execution containers which are currently executed or queued.
 void removeStateListener(ICommandStateListener listener)
          Removes the given state listener from the command pipe.
 

Method Detail

canExecute

<T extends ICommand<T,E>,E extends ICommandExecutionContainer<T,?,?>> boolean canExecute(T command)
Tests if a command can be executed by this command pipe. The pipe tries to process the command normally to create an execution container but does not execute it. This specifically tests that:

Type Parameters:
T - type of the command to execute.
E - type of the execution container for the executed command.
Parameters:
command - A command.
Returns:
True, if this pipe could successfully create an execution container for the command.

executeAsync

<T extends ICommand<T,E>,E extends ICommandExecutionContainer<T,?,?>> E executeAsync(T command)
Executes the given command asynchronously.

The method returns immediately, in other words, the method does not wait for the execution of the container.

Type Parameters:
T - type of the command to execute.
E - type of the execution container for the executed command.
Parameters:
command - The command which should be executed.
Returns:
The command execution container.

execute

<T extends ICommand<T,E>,E extends ICommandExecutionContainer<T,?,?>> E execute(T command)
Executes the given command synchronously.

The method returns when the command execution container is finished.

Type Parameters:
T - type of the command to execute.
E - type of the execution container for the executed command.
Parameters:
command - The command which should be executed.
Returns:
The command execution container.

getAll

List<ICommandExecutionContainer<?,?,?>> getAll()
Returns all command execution containers which are currently executed or queued.

Please note: This function only delivers a snapshot in time, in other words, the container list might change immediately after or even during the function call.

Returns:
All command execution container which are currently executed or queued

getActive

ICommandExecutionContainer<?,?,?> getActive()
Returns the command execution container which is currently executed.

Returns:
The currently active command execution container.

cancelAsync

void cancelAsync(ICommandExecutionContainer<?,?,?> container)
Cancels the given command execution container.

The method returns immediately, in other words, the method does not wait for the container to finish.

Parameters:
container - The command execution container which should be cancelled.

cancelAsync

void cancelAsync(ICommandExecutionContainer<?,?,?> container,
                 ICancelListener listener)
Cancels the given command execution container.

The method returns immediately, in other words, the method does not wait for the container to finish.

Parameters:
container - The command execution container which should be cancelled.
listener - A listener which is called (asynchronous) when the container is finished.

cancelAllAsync

void cancelAllAsync()
See cancelAllAsync(ICancelListener).


cancelAllAsync

void cancelAllAsync(ICancelListener listener)
Cancels all command execution container which are currently executed or queued. The method returns immediately, in other words, the method does not wait for the containers to finish.

Parameters:
listener - A listener which is called (asynchronous) when all currently executed and queued container are finished.

cancelAll

void cancelAll()
Cancels all command execution container which are currently executed or queued. The method waits till all containers are finished.


addStateListener

void addStateListener(ICommandStateListener listener)
Adds a state listener to the command pipe. The listener is called (asynchronous) whenever a command execution container changes its state.

Parameters:
listener - A state listener which is called (asynchronous) whenever a command execution container changes its state.

removeStateListener

void removeStateListener(ICommandStateListener listener)
Removes the given state listener from the command pipe.

Parameters:
listener - The state listener which has to be removed from the command pipe.


Copyright © 2019. All rights reserved.