public abstract class NodeEngine extends Engine
Linkable Engine
.
Fundamental design inside WUIC is to use a set of NodeEngine
to be executed.
They are structured using the chain of responsibility design pattern. Each engine is
in charge of the execution of the next engine and could decide not to execute it.
Constructor and Description |
---|
NodeEngine() |
Modifier and Type | Method and Description |
---|---|
protected boolean |
callNextEngine()
Indicates if the next engine should be called by the base class or if this responsibility is delegated to the
subclass.
|
static NodeEngine |
chain(NodeEngine... engines)
Link the given
engines . |
NodeEngine |
getNext()
Returns the next engine previously set with
setNext(NodeEngine)
method. |
abstract List<NutType> |
getNutTypes()
Gets the all
types supported by this engine. |
NodeEngine |
getPrevious()
Returns the previous engine in the chain.
|
List<ConvertibleNut> |
parse(EngineRequest request)
Parses the given nuts and returns the result of this operation.
|
void |
setNext(NodeEngine next)
The next
NodeEngine to be execute din the chain of responsibility. |
compareTo, getEngineType, internalParse, works
public static NodeEngine chain(NodeEngine... engines)
Link the given engines
. They will be linked respecting the order of the implied by their
Engine.getEngineType()
.
If an NodeEngine
is already chained to other engines
, any engine won't be added
as the next engine but to the end of the existing chain.
If two different instances of the same class appear in the chain, then the first one will be replaced by the second one, keeping the original position.
engines
- the enginespublic abstract List<NutType> getNutTypes()
Gets the all types
supported by this engine.
NutType
public List<ConvertibleNut> parse(EngineRequest request) throws WuicException
Parses the given nuts and returns the result of this operation.
Should throw an IllegalArgumentException
the files type is not supported by this Engine
.
parse
in class Engine
request
- the request with nuts to parseWuicException
- if any kind of error occurspublic void setNext(NodeEngine next)
The next NodeEngine
to be execute din the chain of responsibility. If
it is not set, then this NodeEngine
is the last one to be executed.
next
- the next Engine
public NodeEngine getNext()
Returns the next engine previously set with setNext(NodeEngine)
method.
Engine
public NodeEngine getPrevious()
Returns the previous engine in the chain.
Engine
protected boolean callNextEngine()
Indicates if the next engine should be called by the base class or if this responsibility is delegated to the subclass.
true
if NodeEngine
is responsible of calling next engine, false
otherwiseCopyright © 2012-2015. All Rights Reserved.