public abstract class Engine
extends java.lang.Object
Entity
entity to another.Constructor and Description |
---|
Engine(java.lang.String id)
Constructs an engine.
|
Engine(java.lang.String id,
EntityType inputType,
EntityType outputType)
Constructs an engine.
|
Modifier and Type | Method and Description |
---|---|
void |
addBackend(Backend backend)
Adds backend.
|
void |
addInputType(EntityType inputType)
Adds the given input type of the engine.
|
void |
addParameter(Parameter parameter)
Adds the given parameter to the engine.
|
boolean |
defines(EntityType outputType)
Checks whether the engine defines an entity of the given type.
|
boolean |
equals(java.lang.Object obj) |
java.lang.String |
getId()
Returns the unique engine identifier.
|
java.util.Set<EntityType> |
getInputTypes()
Returns the input types of the engine (i.e., the types of input entities).
|
protected java.util.logging.Logger |
getLogger()
Returns the logger of the engine.
|
EntityType |
getOutputType()
Returns the output type of the engine (i.e., the type of output entities).
|
Parameters |
getParameters()
Returns the parameters of the engine.
|
boolean |
hasBackends()
Returns
true if engine has backends, false otherwise. |
int |
hashCode() |
Arguments |
parseCommandLine(java.lang.String[] args)
Parses the command line.
|
void |
runBackends(Entity entity)
Runs all the backends that were added to this engine.
|
void |
setOutputType(EntityType outputType)
Sets the given output type of the engine.
|
void |
setProgress(int progress)
Sets the engine progress.
|
abstract Entity |
start(java.util.Map<EntityType,Entity> inputs)
Processes entities of the input types and produces an entity of the output type.
|
Entity |
start(java.util.Map<EntityType,Entity> inputs,
EngineEventHandler eventHandler)
Processes entities of the input types and produces an entity of the output type.
|
java.lang.String |
toString() |
boolean |
uses(EntityType inputType)
Checks whether the engine uses an entity of the given type.
|
public Engine(java.lang.String id)
id
- the engine identifier.public Engine(java.lang.String id, EntityType inputType, EntityType outputType)
id
- the engine identifier.inputType
- the input type of the engine.outputType
- the output type of the engine.public final java.lang.String getId()
public final java.util.Set<EntityType> getInputTypes()
public final void addInputType(EntityType inputType)
inputType
- the input type to be added.public final boolean uses(EntityType inputType)
inputType
- the input type to be checked.true
if it uses; false
otherwise.public final EntityType getOutputType()
public final void setOutputType(EntityType outputType)
outputType
- the output type to be set.public final boolean defines(EntityType outputType)
outputType
- the output type to be checked.true
if it defines; false
otherwise.public final Parameters getParameters()
public final void addParameter(Parameter parameter)
parameter
- the parameter to be added.public final Arguments parseCommandLine(java.lang.String[] args) throws org.apache.commons.cli.ParseException
args
- the command line.org.apache.commons.cli.ParseException
- the parse exception.protected java.util.logging.Logger getLogger()
public abstract Entity start(java.util.Map<EntityType,Entity> inputs)
inputs
- the entities to be processed.public final Entity start(java.util.Map<EntityType,Entity> inputs, EngineEventHandler eventHandler)
inputs
- the entities to be processed.eventHandler
- the engine event handler.public final void setProgress(int progress)
progress
- the engine progress (from 0 to 100).public boolean hasBackends()
true
if engine has backends, false
otherwise.public void addBackend(Backend backend)
backend
- parser backendpublic void runBackends(Entity entity)
entity
- Entity to be processed by backendspublic java.lang.String toString()
toString
in class java.lang.Object
public boolean equals(java.lang.Object obj)
equals
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object