pnuts.ext
Class Prototype

java.lang.Object
  |
  +--pnuts.lang.PnutsFunction
        |
        +--pnuts.ext.Prototype
All Implemented Interfaces:
AbstractData, java.lang.Cloneable, Property, java.io.Serializable

public class Prototype
extends PnutsFunction
implements AbstractData, java.lang.Cloneable, java.io.Serializable

An implementation of prototype-based Inheritance, which is simillar to that of ECMAScript. See Pnuts User's Guide for details.

See Also:
AbstractData, 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
Prototype()
           
Prototype(java.lang.String name)
           
 
Method Summary
 java.lang.Object clone()
           
protected  java.lang.Object exec(java.lang.Object[] args, Context context)
          Call a function in "context" with arguments "args".
 java.lang.Object get(java.lang.String name, Context context)
          This method defines the behavior of the following expression.
 java.lang.Object invoke(java.lang.String name, java.lang.Object[] args, Context context)
           
 void set(java.lang.String name, java.lang.Object value, Context context)
          This method defines the behavior of the following expression.
 java.lang.String toString()
           
 
Methods inherited from class pnuts.lang.PnutsFunction
accept, added, call, call, call, call, call, defined, elements, exec, get, getImportEnv, getName, getPackage, isBuiltin, put, unparse
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Prototype

public Prototype()

Prototype

public Prototype(java.lang.String name)
Method Detail

get

public java.lang.Object get(java.lang.String name,
                            Context context)
Description copied from interface: Property
This method defines the behavior of the following expression.
    aProperty . name
 
Specified by:
get in interface Property
Following copied from interface: pnuts.lang.Property
Parameters:
name - the name.
conext - the context in which the expression is evaluated.

set

public void set(java.lang.String name,
                java.lang.Object value,
                Context context)
Description copied from interface: Property
This method defines the behavior of the following expression.
    aProperty . name = value
 
Specified by:
set in interface Property
Following copied from interface: pnuts.lang.Property
Parameters:
name - the name.
value - the value.
context - the context in which the expression is evaluated.

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

invoke

public java.lang.Object invoke(java.lang.String name,
                               java.lang.Object[] args,
                               Context context)
Specified by:
invoke in interface AbstractData

toString

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

clone

public java.lang.Object clone()
Overrides:
clone in class java.lang.Object