public abstract class Engine
extends java.lang.Object
Entity
entity to another.Modifier and Type | Field and Description |
---|---|
static Parameter |
DISABLE_BACKENDS |
static Parameter |
NO_BACKEND
Parameter that disables all the engine backends.
|
Modifier | Constructor and Description |
---|---|
protected |
Engine(java.lang.String engineId)
Constructs an engine.
|
protected |
Engine(java.lang.String engineId,
EntityType inputType,
EntityType outputType)
Constructs an engine.
|
Modifier and Type | Method and Description |
---|---|
protected void |
addBackend(Backend backend)
Adds back-end.
|
void |
addInputType(EntityType inputType)
Adds the given input type of the engine.
|
protected void |
addParameter(Parameter parameter)
Adds the given parameter to the engine.
|
protected void |
deactivateBackends(java.lang.String... names)
Deactivates back-ends with the specified names.
|
protected void |
debugWrite(java.lang.String line)
Writes the line to the engine's debug file.
|
protected void |
debugWrite(java.lang.String format,
java.lang.Object... objects)
Writes the line to the engine's debug file.
|
boolean |
defines(EntityType outputType)
Checks whether the engine defines an entity of the given type.
|
protected void |
disableAllBackends()
Disables all the engine back ends.
|
protected void |
enableAllBackends()
Enables all the engine back ends.
|
boolean |
equals(java.lang.Object obj) |
protected java.util.List<Backend> |
getBackends()
Returns the list of back-ends.
|
java.lang.String |
getId()
Returns the unique engine identifier.
|
protected static <T extends Entity> |
getInputEntity(java.util.Map<EntityType,Entity> inputs,
java.lang.Class<T> entityClass,
EntityType entityType) |
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> |
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.
|
int |
hashCode() |
protected boolean |
isDebugMode()
Checks whether debug mode for the engine is enabled.
|
protected Arguments |
parseCommandLine(java.lang.String... args)
Parses the command line.
|
protected void |
setDebugMode(boolean debugMode)
Enables\disables engine's debug mode.
|
void |
setOutputType(EntityType outputType)
Sets the given output type of the engine.
|
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() |
public static final Parameter NO_BACKEND
public static final Parameter DISABLE_BACKENDS
protected Engine(java.lang.String engineId)
engineId
- the engine identifier.protected 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.protected java.util.List<Backend> getBackends()
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 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()
protected final void addParameter(Parameter parameter)
parameter
- the parameter to be added.protected 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()
protected boolean isDebugMode()
false
otherwise.protected void setDebugMode(boolean debugMode)
debugMode
- true
to enable debug mode, false
otherwise.protected void debugWrite(java.lang.String line)
line
- The line to be written.protected void debugWrite(java.lang.String format, java.lang.Object... objects)
Prints the line of the specified format that represents the described data objects.
format
- The line format.objects
- The objects to be printed.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.protected void addBackend(Backend backend)
backend
- parser back-endjava.lang.IllegalArgumentException
- when argument is null
.protected void enableAllBackends()
protected void disableAllBackends()
protected void deactivateBackends(java.lang.String... names)
names
- The names for registered back-ends.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 getInputEntity(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