org.millscript.millscript.vm
Class FunctionCall

java.lang.Object
  extended by org.millscript.millscript.vm.FunctionCall

public class FunctionCall
extends java.lang.Object

This class represents a function call.


Constructor Summary
FunctionCall(Engine e)
          Constructs a new function call, which will use the specified engine to invoke the function.
FunctionCall(Engine e, Function f)
          Constructs a new function call, which will invoke the specified function on the specified engine.
FunctionCall(Engine e, Package p, java.lang.String sym)
          Constructs a new function call, which will invoke the specified function on the specified engine.
 
Method Summary
 void addArg(java.lang.Object o)
          Adds the specified object as the next argument for the function.
 void addArg(Package p, java.lang.String sym)
          Adds the value of the specified symbol in the specified package as the next argument for the function.
 org.millscript.commons.util.ListIterator<java.lang.Object> invoke()
          Invokes this function call, calling the defined function with the specified arguments.
 void invoke0()
          Invokes this function call expecting the function to return no results.
 java.lang.Object invoke1()
          Invokes this function call expecting the function to return a single result.
 org.millscript.commons.util.IList<java.lang.Object> invokeListResults(boolean mutable)
          Invokes this function call, calling the defined function with the specified arguments.
 void setFunction(Function f)
          Sets the function we want to invoke.
 void setFunction(Package p, java.lang.String sym)
          Sets the function we want to invoke to the specified symbol in the specified package.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FunctionCall

public FunctionCall(Engine e)
Constructs a new function call, which will use the specified engine to invoke the function.

Parameters:
e - the engine to use to invoke the function.

FunctionCall

public FunctionCall(Engine e,
                    Function f)
Constructs a new function call, which will invoke the specified function on the specified engine.

Parameters:
e - the engine to use to invoke the function.
f - the function which will be invoked.

FunctionCall

public FunctionCall(Engine e,
                    Package p,
                    java.lang.String sym)
Constructs a new function call, which will invoke the specified function on the specified engine. The function is specified by it's symbol and the package it is contained in.

Parameters:
e - the engine to use to invoke the function.
p - the package which contains the function.
sym - the symbol of the function to invoke.
Method Detail

addArg

public void addArg(java.lang.Object o)
Adds the specified object as the next argument for the function.

Parameters:
o - the next argument.

addArg

public void addArg(Package p,
                   java.lang.String sym)
Adds the value of the specified symbol in the specified package as the next argument for the function.

Parameters:
p - the package which contains the symbol.
sym - the symbol of the next argument.

invoke

public org.millscript.commons.util.ListIterator<java.lang.Object> invoke()
Invokes this function call, calling the defined function with the specified arguments.

Returns:
an Iterator to iterate over the functions results

invokeListResults

public org.millscript.commons.util.IList<java.lang.Object> invokeListResults(boolean mutable)
Invokes this function call, calling the defined function with the specified arguments.

Parameters:
mutable - a boolean to indicate if you want the returned list to be mutable or not. If true the returned list will be mutable, otherwise immutable.
Returns:
a List of the functions results

invoke0

public void invoke0()
Invokes this function call expecting the function to return no results. The defined function is called with the specified arguments.


invoke1

public java.lang.Object invoke1()
Invokes this function call expecting the function to return a single result. The defined function is called with the specified arguments.

Returns:
the functions result

setFunction

public void setFunction(Function f)
Sets the function we want to invoke.

Parameters:
f - the function this function call will invoke

setFunction

public void setFunction(Package p,
                        java.lang.String sym)
Sets the function we want to invoke to the specified symbol in the specified package.

Parameters:
p - the package which contains the function.
sym - the symbol of the function to invoke.


Copyright © 2001-2007 Open World Ltd. All Rights Reserved.