SimpleAtom


class SimpleAtom : Atom


A simple implementation of Atom suitable for subclassing.

Summary

Nested types

Controls whether the ElementReference appears as the first arg or last arg to the script.

Public constructors

SimpleAtom(script: String!)

Creates a SimpleAtom which runs the given script and places any ElementReference as the first argument to the script.

SimpleAtom(
    script: String!,
    elementPlacement: SimpleAtom.ElementReferencePlacement!
)

Creates a SimpleAtom which runs the given script and places any supplied ElementReference either as the first or last argument to the script.

Public functions

(Mutable)List<Any!>!

The SimpleAtom presents an argument list to the script which follows some basic conventions.

Evaluation!

The SimpleAtom's transform method checks the Evaluation object for success.

Protected functions

(Mutable)List<Any!>!

Extend this method to pass additional arguments to the script.

Evaluation!

Extend this method to handle a failure code in the Evaluation object.

Unit

Extend this method to handle the case where getArguments() has been called without an ElementReference.

Public properties

String!

Public constructors

SimpleAtom

SimpleAtom(script: String!)

Creates a SimpleAtom which runs the given script and places any ElementReference as the first argument to the script.

SimpleAtom

SimpleAtom(
    script: String!,
    elementPlacement: SimpleAtom.ElementReferencePlacement!
)

Creates a SimpleAtom which runs the given script and places any supplied ElementReference either as the first or last argument to the script.

Public functions

getArguments

fun getArguments(elementRef: ElementReference?): (Mutable)List<Any!>!

The SimpleAtom presents an argument list to the script which follows some basic conventions.

If an ElementReference is provided, it is placed either in the first or last position based on the ElementReferencePlacement provided to the constructor.

The nonContextualArguments (if provided via getNonContextualArguments) will appear after the ElementReference.

transform

fun transform(e: Evaluation!): Evaluation!

The SimpleAtom's transform method checks the Evaluation object for success.

If the Evaluation object has an error, the default behaviour is to throw an exception, subclasses may change this behaviour via the handleBadEvaluation method.

Protected functions

getNonContextualArguments

protected fun getNonContextualArguments(): (Mutable)List<Any!>!

Extend this method to pass additional arguments to the script.

Returns
(Mutable)List<Any!>!

a list of arguments (non-null)

handleBadEvaluation

protected fun handleBadEvaluation(e: Evaluation!): Evaluation!

Extend this method to handle a failure code in the Evaluation object.

The default implementation will throw an exception, subclasses may want to ignore certain failure cases.

Returns
Evaluation!

Evaluation the evaluation object (must be non-null)

Throws
java.lang.RuntimeException: java.lang.RuntimeException

if the badness level is too high.

handleNoElementReference

protected fun handleNoElementReference(): Unit

Extend this method to handle the case where getArguments() has been called without an ElementReference. Implementors may want to throw an exception here if they require an ElementReference to evaluate properly.

Public properties

script

val scriptString!