|
Eidola home | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.eidola.kernel.event.EventBroadcaster | +--org.eidola.kernel.Container | +--org.eidola.kernel.Element | +--org.eidola.kernel.NamedElement | +--org.eidola.kernel.Function
Holds a body of code which takes input and output parameters.
A function's parameters are Variable
s, which means that they are
named, and they come in a list instead of a set, which means that they have an
order. This is to allow a UI to show parameter passing by order
(C/Java-style) or by name, or both at once if that seems most entertaining.
To the code in the function's body, both the input and output parameters behave as local variables. It's just that the inputs happen to come initialized with useful information, and the outputs go on to whoever's calling the function.
What exactly the "body of code" will looks like is yet to be determined. It may well look like your wildest dreams, or your worst nightmares, or both. It may be possible to make the "Code" class very abstract, and have different subclasses with different syntactic flavors (i.e., one more procedural, another more functional, another using some ultra-funky dataflow thingers...). Or maybe it will be raw 6502 machine code. Who can tell?
Structure:
Signature:
See note on synchronization and concurrent read safety in Container
.
Inner Class Summary | |
class |
Function.Compilation
|
Inner classes inherited from class org.eidola.kernel.NamedElement |
NamedElement.Compilation |
Inner classes inherited from class org.eidola.kernel.Element |
Element.Compilation |
Inner classes inherited from class org.eidola.kernel.Container |
Container.Compilation |
Field Summary | |
static ContainerPart |
BODY
Part of a function. |
static ContainerPart |
INPUTS
Part of a function. |
static ContainerPart |
OUTPUTS
Part of a function. |
Fields inherited from class org.eidola.kernel.NamedElement |
NAME |
Fields inherited from class org.eidola.kernel.Element |
OWNER |
Fields inherited from class org.eidola.kernel.Container |
CONTENTS, debugCompile |
Fields inherited from class org.eidola.kernel.event.EventBroadcaster |
debugEvents |
Constructor Summary | |
Function()
Creates a new empty abstract function that takes nothing, does nothing with it, and gives you nothing back, yet still will probably run a bit slowly.... |
Method Summary | |
void |
addInput(Variable input)
Adds an input parameter at the end of the parameter list. |
void |
addOutput(Variable output)
Adds an output parameter at the end of the parameter list. |
void |
addParameter(Variable parameter,
boolean in)
Adds a parameter at the end of the parameter list. |
void |
dump(int i)
Does a debug dump of this container to System.out. |
org.eidola.kernel.Function.Code |
getBody()
Returns the body of code which describes the action this function takes, or null if the function is purely abstract. |
List |
getInputs()
Returns the list of input parameters. |
List |
getOutputs()
Returns the list of output parameters. |
void |
handleContentEvent(ContainerEvent event)
Handles an event passed on from content. |
protected Container.Compilation |
makeNewCompilation()
Creates a new Function.Compilation of an appropriate type for this container. |
void |
removeInput(Variable input)
Removes an input parameter. |
void |
removeOutput(Variable output)
Removes an output parameter. |
void |
removeParameter(Variable parameter,
boolean in)
Removes a parameter. |
void |
setInputs(List inputs)
Sets the input parameters. |
void |
setOutputs(List outputs)
Sets the output parameters. |
void |
setParameters(List newParameters,
boolean in)
Sets the input or output parameters. |
Methods inherited from class org.eidola.kernel.NamedElement |
broadcastEvent, getName, getSignatureVersion, setName |
Methods inherited from class org.eidola.kernel.Element |
getFullName, getIndirectOwners, getNamespace, getOwner, handleOwnerEvent, setOwner, toString |
Methods inherited from class org.eidola.kernel.Container |
compile, finalize, getCompilation, getCompileVersion, getStructureVersion, handleSelfEvent |
Methods inherited from class org.eidola.kernel.event.EventBroadcaster |
addListener, removeListener, updateBroadcasters |
Methods inherited from class java.lang.Object |
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
public static final ContainerPart INPUTS
StructureChanged
public static final ContainerPart OUTPUTS
StructureChanged
public static final ContainerPart BODY
StructureChanged
Constructor Detail |
public Function()
Method Detail |
public List getInputs()
Variable
s.public List getOutputs()
Variable
s.public void addInput(Variable input) throws IllegalElementType
public void addOutput(Variable output) throws IllegalElementType
public void addParameter(Variable parameter, boolean in) throws IllegalElementType
parameter
- The parameter to addin
- True = input parameter; false = output parameterpublic void removeInput(Variable input)
public void removeOutput(Variable output)
public void removeParameter(Variable parameter, boolean in)
parameter
- The parameter to removein
- True = input parameter; false = output parameterpublic void setInputs(List inputs) throws IllegalElementType
inputs
- A list of Variable
s. This method creates
an internal copy, so it is safe to pass a list and subsequently modify it.public void setOutputs(List outputs) throws IllegalElementType
inputs
- A list of Variable
s. This method creates
an internal copy, so it is safe to pass a list and subsequently modify it.public void setParameters(List newParameters, boolean in) throws IllegalElementType
inputs
- A list of Variable
s. This method creates
an internal copy, so it is safe to pass a list and subsequently modify it.in
- True = input parameters; false = output parameterspublic org.eidola.kernel.Function.Code getBody()
public void handleContentEvent(ContainerEvent event)
SignatureChanged
events from parameters,
and calls Container.handleContentEvent(ContainerEvent)
.handleContentEvent
in class Container
protected Container.Compilation makeNewCompilation()
Container
Container.Compilation
of an appropriate type for this container.
This method only exists because Java does not use runtime types to resolve
inner class names; in other words, there are no virtual inner classes.
Under normal circumstances, you will not need to call this method directly;
use Container.compile()
instead. It is a good idea to synchronize on the
container when calling this method.makeNewCompilation
in class Container
public void dump(int i)
Container
dump
in class Container
|
Eidola home | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |