com.kuka.roboticsAPI.conditionModel
Class ObserverManager

java.lang.Object
  extended by com.kuka.roboticsAPI.conditionModel.ObserverManager

public class ObserverManager
extends Object

Class for create and handle condition observers.


Constructor Summary
ObserverManager()
           
 
Method Summary
 ConditionObserver createAndEnableConditionObserver(ICondition condition, NotificationType notificationType, IAnyEdgeListener anyEdgeListener)
          Create a new condition observer and start observing any edge of a condition, i.e. the observer is immediately enabled and events are sent for each change of the condition between true and false according to the notification type.
 ConditionObserver createAndEnableConditionObserver(ICondition condition, NotificationType notificationType, IFallingEdgeListener fallingEdgeListener)
          Create a new condition observer and start observing the falling edge of a condition, i.e. the observer is immediately enabled and events are sent for each change of the condition from true to false according to the notification type.
 ConditionObserver createAndEnableConditionObserver(ICondition condition, NotificationType notificationType, IRisingEdgeListener risingEdgeListener)
          Create a new condition observer and start observing rising edge of a condition, i.e. the observer is immediately enabled and events are sent for each change of the condition from false to true according to the notification type.
 ConditionObserver createConditionObserver(ICondition condition, NotificationType notificationType, IAnyEdgeListener anyEdgeListener)
          Creates a new condition observer to observe any edge of a condition.
 ConditionObserver createConditionObserver(ICondition condition, NotificationType notificationType, IFallingEdgeListener fallingEdgeListener)
          Creates a new condition observer to observe the falling edge of a condition.
 ConditionObserver createConditionObserver(ICondition condition, NotificationType notificationType, IRisingEdgeListener risingEdgeListener)
          Creates a new condition observer to observe the rising edge of a condition.
 boolean evaluate(ICondition condition)
          Evaluates a condition.
 List<ConditionObserver> getRegisteredConditionObservers(Controller controller)
          Get a list of all registered condition observers.
 void removeConditionObserver(ConditionObserver conditionObserver)
          Remove the selected condition observer.
 void waitFor(ICondition condition)
          Blocks the calling thread until the condition is true.
 boolean waitFor(ICondition condition, long timeout, TimeUnit timeUnit)
          Blocks the calling thread until the condition is true or the timeout has elapsed.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ObserverManager

public ObserverManager()
Method Detail

createConditionObserver

public ConditionObserver createConditionObserver(ICondition condition,
                                                 NotificationType notificationType,
                                                 IRisingEdgeListener risingEdgeListener)
Creates a new condition observer to observe the rising edge of a condition.

Note: To start observing, the ConditionObserver has to be enabled.

Parameters:
condition - The condition to observe.
notificationType - Notification options of the ConditionObserver
risingEdgeListener - The listener for observing the rising edge of the condition.
Returns:
ConditionObserver
Throws:
IllegalArgumentException - if an invalid argument is given

createConditionObserver

public ConditionObserver createConditionObserver(ICondition condition,
                                                 NotificationType notificationType,
                                                 IFallingEdgeListener fallingEdgeListener)
Creates a new condition observer to observe the falling edge of a condition.

Note: To start observing, the ConditionObserver has to be enabled.

Parameters:
condition - The condition to observe.
notificationType - Notification options of the ConditionObserver
fallingEdgeListener - The listener for observing the falling edge of the condition.
Returns:
ConditionObserver
Throws:
IllegalArgumentException - if an invalid argument is given

createConditionObserver

public ConditionObserver createConditionObserver(ICondition condition,
                                                 NotificationType notificationType,
                                                 IAnyEdgeListener anyEdgeListener)
Creates a new condition observer to observe any edge of a condition.

Note: To start observing, the ConditionObserver has to be enabled.

Parameters:
condition - The condition to observe.
notificationType - Notification options of the ConditionObserver
anyEdgeListener - The listener for observing any edge of the condition.
Returns:
ConditionObserver
Throws:
IllegalArgumentException - if an invalid argument is given

createAndEnableConditionObserver

public ConditionObserver createAndEnableConditionObserver(ICondition condition,
                                                          NotificationType notificationType,
                                                          IRisingEdgeListener risingEdgeListener)
Create a new condition observer and start observing rising edge of a condition, i.e. the observer is immediately enabled and events are sent for each change of the condition from false to true according to the notification type.

Parameters:
condition - The condition to observe.
notificationType - Notification options of the ConditionObserver
risingEdgeListener - The listener for observing rising edge of the condition.
Returns:
ConditionObserver
Throws:
IllegalArgumentException - if an invalid argument is given
See Also:
ConditionObserver.enable(), ConditionObserver.disable()

createAndEnableConditionObserver

public ConditionObserver createAndEnableConditionObserver(ICondition condition,
                                                          NotificationType notificationType,
                                                          IFallingEdgeListener fallingEdgeListener)
Create a new condition observer and start observing the falling edge of a condition, i.e. the observer is immediately enabled and events are sent for each change of the condition from true to false according to the notification type.

Parameters:
condition - The condition to observe.
notificationType - Notification options of the ConditionObserver
fallingEdgeListener - The listener for observing the falling edge of the condition.
Returns:
ConditionObserver
Throws:
IllegalArgumentException - if an invalid argument is given
See Also:
ConditionObserver.enable(), ConditionObserver.disable()

createAndEnableConditionObserver

public ConditionObserver createAndEnableConditionObserver(ICondition condition,
                                                          NotificationType notificationType,
                                                          IAnyEdgeListener anyEdgeListener)
Create a new condition observer and start observing any edge of a condition, i.e. the observer is immediately enabled and events are sent for each change of the condition between true and false according to the notification type.

Parameters:
condition - The condition to observe.
notificationType - Notification options of the ConditionObserver
anyEdgeListener - The listener for observing any edge of the condition.
Returns:
ConditionObserver
Throws:
IllegalArgumentException - if an invalid argument is given
See Also:
ConditionObserver.enable(), ConditionObserver.disable()

removeConditionObserver

public void removeConditionObserver(ConditionObserver conditionObserver)
Remove the selected condition observer. As soon as the condition is removed, it can not be enabled any more. Observers should be removed when the application does not need them any more. Observers are automatically removed when the application exits.

Parameters:
conditionObserver - The condition observer to remove.
Throws:
IllegalArgumentException - if an invalid argument is given

getRegisteredConditionObservers

public List<ConditionObserver> getRegisteredConditionObservers(Controller controller)
Get a list of all registered condition observers.

Parameters:
controller - The controller
Returns:
List of all registered conditionObservers.
Throws:
IllegalArgumentException - if an invalid argument is given

waitFor

public boolean waitFor(ICondition condition,
                       long timeout,
                       TimeUnit timeUnit)
Blocks the calling thread until the condition is true or the timeout has elapsed. If the condition is already true when called, this method returns immediately.

Parameters:
condition - The condition to wait for.
timeout - The maximum time the calling thread is blocked. A negative value means that no timeout will be used. In this case, the method waitFor(ICondition) may also be used.
The execution of this method takes some milliseconds independently from the given timeout.
timeUnit - The unit of the timeout.
Returns:
true, if the condition fires during the configured timeout, false otherwise.
Even if the timeout is smaller than the execution time of this method, the condition state at the time of the method call will be returned.
Throws:
IllegalArgumentException - if an invalid argument is given

waitFor

public void waitFor(ICondition condition)
Blocks the calling thread until the condition is true. If the condition is already true when called, this method returns immediately.

Parameters:
condition - The condition to wait for.

evaluate

public boolean evaluate(ICondition condition)
Evaluates a condition.

Parameters:
condition - The condition to evaluate.
Returns:
the value of the condition.


Copyright © 2019. All rights reserved.