HANDLED - the type of the object handled by the component handlers.public abstract class GCUBEComplexHandler<HANDLED> extends GCUBEHandler<HANDLED>
GCUBEHandler that manages one or more
component handlers.
A GCUBEComplexHandler may
constrain its components to handle objects of the same type (by instantiating the type parameter
to a type other than Object).
In turn, the component handlers may be built so as to share
the same handled object.
handled, logger, producer| Constructor and Description |
|---|
GCUBEComplexHandler(GCUBEIHandler<? extends HANDLED>... components)
Creates an instance with a list of component handlers.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addHandlers(GCUBEIHandler<? extends HANDLED>... components)
Adds one or more handlers to the list of component handlers.
|
List<GCUBEIHandler<? extends HANDLED>> |
getHandlers()
Returns the component handlers.
|
boolean |
removeHandler(GCUBEIHandler<? extends HANDLED> component)
Removes (the first occurrence of) a handler from the list of component handlers.
|
void |
setLogger(GCUBELog logger)
Sets the logger.
|
void |
undo()
Reverts the actions of the handler.
|
clearBlackboard, getBlackboard, getHandled, getId, getLogger, getName, getScopeManager, getSecurityManager, getState, notify, run, setBlackboard, setHandled, setName, setScopeManager, setSecurityManager, setState, subscribe, unsubscribepublic GCUBEComplexHandler(GCUBEIHandler<? extends HANDLED>... components)
components - the component handlers.public void addHandlers(GCUBEIHandler<? extends HANDLED>... components) throws IllegalArgumentException
components - the handlers.IllegalArgumentExceptionpublic void setLogger(GCUBELog logger)
setLogger in interface GCUBEIHandler<HANDLED>setLogger in class GCUBEHandler<HANDLED>logger - the logger.public boolean removeHandler(GCUBEIHandler<? extends HANDLED> component)
component - the handler.true if the handler was in the list, false otherwise.public List<GCUBEIHandler<? extends HANDLED>> getHandlers()
public void undo()
debug-logs the invocation.
If required, override as per handler semantics. For robustness, do not
assume the invocation occurs after the execution of the handler.undo in interface GCUBEIHandler<HANDLED>undo in class GCUBEHandler<HANDLED>Copyright © 2015. All Rights Reserved.