de.projectory.koivima.core
Class Element

java.lang.Object
  extended by de.projectory.koivima.core.Element
Direct Known Subclasses:
AbstractElementList, DataElement, Operator

public abstract class Element
extends java.lang.Object

Element of a code block. Each element can be executed, even data elements. For example a data element would put itself to the data stack.


Field Summary
protected  ExecutionContext context
          provides the execution environment for this element
 
Constructor Summary
Element()
           
 
Method Summary
abstract  void execute()
          Executes this element.
 ExecutionContext getExecutionContext()
           
 void setExecutionContext(ExecutionContext context)
          Sets the ExecutionContext of this element.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

context

protected ExecutionContext context
provides the execution environment for this element

Constructor Detail

Element

public Element()
Method Detail

setExecutionContext

public void setExecutionContext(ExecutionContext context)
Sets the ExecutionContext of this element. Every element must have an execution context for execution. However the execution context is not provided on creation. Instead this method is called when this element is inserted into a CodeBlock.

Parameters:
context - ExecutionContext for this CodeBlock. If the context is null a new context is generated.

getExecutionContext

public ExecutionContext getExecutionContext()
Returns:
ExecutionContext of the this element

execute

public abstract void execute()
Executes this element. An operator usually removes some itmes from the data stack and operates on them. A variable just puts itself to the stack.