public abstract class Engine
extends java.lang.Object
Entity
entity to another.Constructor and Description |
---|
Engine(java.lang.String engineId)
Constructs an engine.
|
Engine(java.lang.String engineId,
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.
|
protected static <T extends Entity> |
getMandatoryInputEntity(java.util.Map<EntityType,Entity> inputs,
java.lang.Class<T> entityClass,
EntityType entityType) |
protected static <T extends Entity> |
getOptionalInputEntity(java.util.Map<EntityType,Entity> inputs,
java.lang.Class<T> entityClass,
EntityType entityType) |
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 back-ends, false otherwise. |
int |
hashCode() |
Arguments |
parseCommandLine(java.lang.String[] args)
Parses the command line.
|
void |
runBackEnds(Entity entity)
Runs all the back-ends 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 engineId)
engineId
- the engine identifier.public Engine(java.lang.String engineId, EntityType inputType, EntityType outputType)
engineId
- 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 back-ends, false
otherwise.public void addBackend(Backend backend)
backend
- parser backendjava.lang.IllegalArgumentException
- when argument is null
.public void runBackEnds(Entity entity)
entity
- Entity to be processed by back-endsjava.lang.IllegalArgumentException
- when argument is null
.protected static <T extends Entity> T getOptionalInputEntity(java.util.Map<EntityType,Entity> inputs, java.lang.Class<T> entityClass, EntityType entityType)
protected static <T extends Entity> T getMandatoryInputEntity(java.util.Map<EntityType,Entity> inputs, java.lang.Class<T> entityClass, EntityType entityType)
public 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