org.erights.e.elib.prim
Class CallableScript

java.lang.Object
  |
  +--org.erights.e.elib.prim.CallableScript
All Implemented Interfaces:
Script

final class CallableScript
extends Object
implements Script

Author:
Mark S. Miller

Field Summary
(package private) static Script THE_ONE
          The behavior of all Callables are described by the one CallableScript
 
Constructor Summary
private CallableScript()
           
 
Method Summary
 Object execute(Object self, String verb, Object[] args)
          Enabled: verb must be an interned string
 void protocol(Object optSelf, FlexList mTypes)
          Enabled: Adds to 'mTypes' the mappings provided by this script.
 boolean respondsTo(Object optSelf, String verb, int arity)
          Enabled: Does an object whose behavior is this script respond to verb/arity messages?
 Script shorten(Object optSelf, String aVerb, Object[] args)
          Delegate's the shortening to optSelf's Callable.optShorten(java.lang.String, java.lang.Object[])
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

THE_ONE

static final Script THE_ONE
The behavior of all Callables are described by the one CallableScript

Constructor Detail

CallableScript

private CallableScript()
Method Detail

shorten

public Script shorten(Object optSelf,
                      String aVerb,
                      Object[] args)
Delegate's the shortening to optSelf's Callable.optShorten(java.lang.String, java.lang.Object[])

Specified by:
shorten in interface Script
Parameters:
optSelf - If present, then a script could shorten using instance-specific data.
aVerb - Must be interned
args - Typically, only its arity is used. But OverloaderNode uses the types of the arguments to select among Java overloads.
Returns:
The Script to use in lieu of this one. Note that it's always correct a Script to just return itself.

execute

public Object execute(Object self,
                      String verb,
                      Object[] args)
Description copied from interface: Script
Enabled: verb must be an interned string

Specified by:
execute in interface Script
Parameters:
self -
verb -
args -
Returns:

protocol

public void protocol(Object optSelf,
                     FlexList mTypes)
Description copied from interface: Script
Enabled: Adds to 'mTypes' the mappings provided by this script.

Specified by:
protocol in interface Script
Parameters:
optSelf -
mTypes -

respondsTo

public boolean respondsTo(Object optSelf,
                          String verb,
                          int arity)
Description copied from interface: Script
Enabled: Does an object whose behavior is this script respond to verb/arity messages?

Specified by:
respondsTo in interface Script
Parameters:
optSelf -
verb -
arity -
Returns:


comments?