public class RPNEngine extends AbstractEngine
Implements an RPN (Reverse Polish Notation) computing engine accepting a Forth-like syntax.
The operations available to the transform programs are supported by the modules supplied to this engine by the '' parameter.
RPNTransform
,
Compiler
Proxied.Abstract
Modifier and Type | Field and Description |
---|---|
static int |
DEFAULT_LOOP_LIMIT
Default loop limit.
|
DEFAULT_BEHAVIOR_PARAM
BINDING_PARAM, ENGINE_EXECUTOR_PARAM, LOOP_LIMIT_PARAM, MACRO_PARAM, MODULE_PARAM, NAME_PARAM, PASSWORD_PARAM, SECURITY_PARAM, USER_PARAM, WORD_PARAM
Constructor and Description |
---|
RPNEngine() |
Modifier and Type | Method and Description |
---|---|
Program |
compile(String source,
Optional<Map<String,MacroDef>> macroDefs,
Optional<Map<String,Program>> wordDefs,
Logger logger)
Compile a Program from a source String.
|
Transform |
createTransform(TransformEntity proxyEntity)
Creates a transform object.
|
protected Optional<ClassDef> |
defaultBehavior()
Returns the engine specific default behavior.
|
Optional<BehaviorEntity> |
getDefaultBehavior(PointRelation relation)
Gets the default (primary) behavior.
|
Optional<Map<String,MacroDef>> |
getMacroDefs(ProxyEntity proxyEntity)
Gets the macro instruction definitions.
|
Optional<Map<String,Program>> |
getWordDefs(ProxyEntity proxyEntity,
Optional<Map<String,MacroDef>> macroDefs)
Gets the additional word definitions.
|
void |
register(Operations module)
Registers an Operations module.
|
boolean |
setUp(Metadata metadata,
ProxyEntity proxyEntity)
Sets up the instance for action.
|
close, getDefaultBehavior
getMetadata, getName, getParams, getProxyEntity, getThisLogger, tearDown
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getName, getParams, getProxyEntity, tearDown
public static final int DEFAULT_LOOP_LIMIT
@Nullable @CheckReturnValue public final Program compile(@Nonnull String source, @Nonnull Optional<Map<String,MacroDef>> macroDefs, @Nonnull Optional<Map<String,Program>> wordDefs, @Nonnull Logger logger)
source
- The source code.macroDefs
- The optional macro instruction definitions.wordDefs
- Optional additional word definitions.logger
- The Logger.public Transform createTransform(TransformEntity proxyEntity)
proxyEntity
- The proxy (transform entity) for the transform.public Optional<BehaviorEntity> getDefaultBehavior(PointRelation relation)
On self-reference (when the input point is the same as the result
point), the default behavior becomes Retriggers
unless the
"SelectSyncPosition"
is specified.
getDefaultBehavior
in interface Engine
getDefaultBehavior
in class AbstractEngine
relation
- The relation needing a primary behavior.@Nonnull @CheckReturnValue public final Optional<Map<String,MacroDef>> getMacroDefs(@Nonnull ProxyEntity proxyEntity) throws Compiler.CompileException
On name collision, the definitions of the transform will override those of the engine.
proxyEntity
- The proxy (transform entity) for the transform.Compiler.CompileException
- On macro compilation exception.@Nonnull @CheckReturnValue public final Optional<Map<String,Program>> getWordDefs(@Nonnull ProxyEntity proxyEntity, @Nonnull Optional<Map<String,MacroDef>> macroDefs) throws Compiler.CompileException
On name collision, the definitions of the transform will override those of the engine.
proxyEntity
- The proxy (transform entity) for the transform.macroDefs
- The optional macro instruction definitions.Compiler.CompileException
- On word compilation exception.public final void register(@Nonnull Operations module) throws Operation.OverloadException
module
- The Operations module.Operation.OverloadException
- From Operations set up.public boolean setUp(Metadata metadata, ProxyEntity proxyEntity)
setUp
in interface Proxied
setUp
in class AbstractEngine
metadata
- The metadata available to the current process.proxyEntity
- The proxy entity refering to the proxied.protected Optional<ClassDef> defaultBehavior()
defaultBehavior
in class AbstractEngine
Copyright © 2003-2019 Serge Brisson. All Rights Reserved.