pnuts.ext
Class SynchronizedFunction

java.lang.Object
  |
  +--pnuts.lang.PnutsFunction
        |
        +--pnuts.ext.SynchronizedFunction
All Implemented Interfaces:
java.io.Serializable

public class SynchronizedFunction
extends PnutsFunction

See Also:
Serialized Form

Fields inherited from class pnuts.lang.PnutsFunction
CATCH, CLASS, DEFINED, EVAL, GET_CONTEXT, IMPORT, LOAD, LOAD_FILE, PACKAGE, pkg, primitives, QUIT, REQUIRE, THROW, USE
 
Constructor Summary
SynchronizedFunction(PnutsFunction function, java.lang.Object lock)
           
 
Method Summary
 java.lang.Object accept(int narg, Visitor visitor, Context context)
           
protected  void added(int narg)
          This method is called when a Function object is registered to this object.
 boolean defined(int nargs)
          Check if the function with narg parameter is defined
protected  java.lang.Object exec(java.lang.Object[] args, Context context)
          Call a function in "context" with arguments "args".
 java.lang.String[] getImportEnv(int narg)
           
 java.lang.String getName()
           
 Package getPackage()
           
 boolean isBuiltin()
           
 java.lang.String toString()
           
 java.lang.String unparse(int nargs)
          Retrieve the symbolic definition of the function.
 
Methods inherited from class pnuts.lang.PnutsFunction
call, call, call, call, call, elements, exec, get, put
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

SynchronizedFunction

public SynchronizedFunction(PnutsFunction function,
                            java.lang.Object lock)
Method Detail

defined

public boolean defined(int nargs)
Description copied from class: PnutsFunction
Check if the function with narg parameter is defined
Overrides:
defined in class PnutsFunction
Following copied from class: pnuts.lang.PnutsFunction
Parameters:
narg - the number of paramters. -1 means a arbitrary length parameter.
Returns:
true if a function with narg, otherwise false

unparse

public java.lang.String unparse(int nargs)
Description copied from class: PnutsFunction
Retrieve the symbolic definition of the function.
Overrides:
unparse in class PnutsFunction
Following copied from class: pnuts.lang.PnutsFunction
Parameters:
narg - the number of paramters. -1 means a arbitrary length parameter.
Returns:
the function definition

getPackage

public Package getPackage()
Overrides:
getPackage in class PnutsFunction
Following copied from class: pnuts.lang.PnutsFunction
Returns:
Package in which the function is defined

getImportEnv

public java.lang.String[] getImportEnv(int narg)
Overrides:
getImportEnv in class PnutsFunction
Following copied from class: pnuts.lang.PnutsFunction
Parameters:
narg - the number of paramters. -1 means a arbitrary length parameter.
Returns:
imports of the function (array of Class or String)

isBuiltin

public boolean isBuiltin()
Overrides:
isBuiltin in class PnutsFunction

accept

public java.lang.Object accept(int narg,
                               Visitor visitor,
                               Context context)
Overrides:
accept in class PnutsFunction
Following copied from class: pnuts.lang.PnutsFunction
Parameters:
narg - the number of paramters. -1 means a arbitrary length parameter.

getName

public java.lang.String getName()
Overrides:
getName in class PnutsFunction
Following copied from class: pnuts.lang.PnutsFunction
Returns:
the name of functions

toString

public java.lang.String toString()
Overrides:
toString in class PnutsFunction

added

protected void added(int narg)
Description copied from class: PnutsFunction
This method is called when a Function object is registered to this object. This method just returns. Subclass can override this as a hook method.
Overrides:
added in class PnutsFunction
Following copied from class: pnuts.lang.PnutsFunction
Parameters:
narg - the number of parameters

exec

protected java.lang.Object exec(java.lang.Object[] args,
                                Context context)
Description copied from class: PnutsFunction
Call a function in "context" with arguments "args". Subclasses of this class should override this method.
Overrides:
exec in class PnutsFunction
Following copied from class: pnuts.lang.PnutsFunction
Returns:
the result of the call