public abstract class AbstractOperation extends Object implements Operation
| Modifier and Type | Field and Description |
|---|---|
protected Operation[] |
ops
Array of arguments (as operations) for this operation.
|
protected SourceRange |
sourceRange
Source location of this operation and its arguments.
|
| Constructor and Description |
|---|
AbstractOperation(SourceRange sourceRange,
Operation... operations)
Set the source location information and arguments for this operation.
|
| Modifier and Type | Method and Description |
|---|---|
protected Element[] |
calculateArgs(Context context)
A utility method which calls
execute on each of this
operation's arguments and returns an array of the results. |
protected Term[] |
calculateTerms(Context context)
A utility method that creates a list of terms from the given arguments.
|
void |
checkInvalidSelfContext()
Default implementation recursively calls this method on all of the
contained operations (arguments).
|
void |
checkRestrictedContext()
Default implementation recursively calls this method on all of the
contained operations (arguments).
|
abstract Element |
execute(Context context)
Execute this operation within the given context.
|
Operation[] |
getOperations()
Allow a copy of the raw operations to be retrieved.
|
SourceRange |
getSourceRange()
Retrieve the source information from this operation.
|
String |
toString()
Default string representation of an operation is the class' simple name.
|
protected final SourceRange sourceRange
protected final Operation[] ops
public AbstractOperation(SourceRange sourceRange, Operation... operations)
sourceRange - source location of this operation and argumentsoperations - list of arguments (as operations) for this operationpublic abstract Element execute(Context context) throws EvaluationException
Operationexecute in interface Operationcontext - evaluation context for the statementEvaluationException - if an error occurs during processingpublic void checkRestrictedContext()
throws SyntaxException
checkRestrictedContext in interface OperationSyntaxException - if operation cannot appear in restricted contextpublic void checkInvalidSelfContext()
throws SyntaxException
checkInvalidSelfContext in interface OperationSyntaxException - if operation references SELFprotected Element[] calculateArgs(Context context) throws EvaluationException
execute on each of this
operation's arguments and returns an array of the results.context - evaluation context to useEvaluationExceptionprotected Term[] calculateTerms(Context context) throws EvaluationException
context - evaluation context to useEvaluationException - if any error occurs when evaluating the arguments or if the
resulting value is not a valid Termpublic SourceRange getSourceRange()
public Operation[] getOperations()
Copyright © 2014 Quattor. All Rights Reserved.