org.erights.e.elib.prim
Class OverloaderNode

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

public class OverloaderNode
extends MethodNode

Untamed: Wraps a set of JavaMemberNodes with the same message name and arity, and dispatches to the unique one for which the current arguments coerce to its parameter list.

If the current arguments coerce to none or more than one, throw an exception.

Author:
Mark S. Miller

Field Summary
private  CallCounter myCallCounter
           
private  JavaMemberNode[] myNodes
           
 
Constructor Summary
private OverloaderNode(JavaMemberNode[] nodes)
           
 
Method Summary
 void addJavaMemberNodesToMap(FlexMap map)
          Enabled: Add all my nodes to the map
 Object execute(Object self, String aVerb, Object[] args)
          Enabled:
 int getArity()
          Enabled:
 String getDocComment()
          Enabled:
 String getOptTypedVerb()
          Enabled:
 String getVerb()
          Enabled:
static MethodNode make(JavaMemberNode[] nodes)
          Enabled:
 Script shorten(Object optSelf, String aVerb, Object[] args)
          Enabled: Returns the unique matching JavaMemberNode or throw an exception.
 void subPrintOn(TextWriter out, int priority)
          Enabled:
 String toString()
          Suppressed:
 
Methods inherited from class org.erights.e.elib.base.MethodNode
makeMessageType, protocol, respondsTo
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

myNodes

private final JavaMemberNode[] myNodes

myCallCounter

private final CallCounter myCallCounter
Constructor Detail

OverloaderNode

private OverloaderNode(JavaMemberNode[] nodes)
Method Detail

make

public static MethodNode make(JavaMemberNode[] nodes)
Enabled:


getDocComment

public String getDocComment()
Enabled:

Specified by:
getDocComment in class MethodNode

getVerb

public String getVerb()
Enabled:

Specified by:
getVerb in class MethodNode

getOptTypedVerb

public String getOptTypedVerb()
Enabled:

Specified by:
getOptTypedVerb in class MethodNode

getArity

public int getArity()
Enabled:

Specified by:
getArity in class MethodNode

addJavaMemberNodesToMap

public void addJavaMemberNodesToMap(FlexMap map)
Enabled: Add all my nodes to the map

Specified by:
addJavaMemberNodesToMap in class MethodNode

shorten

public Script shorten(Object optSelf,
                      String aVerb,
                      Object[] args)
Enabled: Returns the unique matching JavaMemberNode or throw an exception.

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 aVerb,
                      Object[] args)
Enabled:


subPrintOn

public void subPrintOn(TextWriter out,
                       int priority)
                throws IOException
Enabled:

IOException

toString

public String toString()
Suppressed:

Overrides:
toString in class Object
Returns:
a string representation of the object.


comments?