|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectoscript.data.Value
oscript.data.Type
oscript.data.Function
A script function/constructor. Since native (and other) objects that behave as a function can re-use some functionality (ie checking number of args, type casting, etc., the stuff specific to a script function/ constructor is pushed out into a seperate class.
Nested Class Summary | |
static class |
Function.FunctionData
In order to keep function instances more lightweight, the values that will be the same for any instance of a function representing the same portion of the parse tree have been split out into this class, in order to be shared between different function instances. |
Field Summary | |
Function.FunctionData |
fd
The shared function data... |
static java.lang.String[] |
MEMBER_NAMES
|
static java.lang.String |
PARENT_TYPE_NAME
|
static Value |
TYPE
The type object for an script function. |
static java.lang.String |
TYPE_NAME
|
Fields inherited from class oscript.data.Type |
HIDDEN_TYPE |
Fields inherited from class oscript.data.Value |
DEBUG, NULL, UNDEFINED |
Constructor Summary | |
Function(Scope enclosingScope,
Value superFxn,
Function.FunctionData fd)
Class Constructor. |
Method Summary | |
Value |
bopCast(Value val)
Perform the cast operation, (a)b is equivalent to a.bopCast(b) |
Value |
callAsConstructor(StackFrame sf,
MemberTable args)
Call this object as a constructor. |
Value |
callAsExtends(StackFrame sf,
Scope scope,
MemberTable args)
Call this object as a parent class constructor. |
Value |
callAsFunction(StackFrame sf,
MemberTable args)
Call this object as a function. |
java.lang.String |
castToString()
Convert this object to a native java String value. |
static Value |
extractJavadocComment(java.lang.String str,
Value name,
Value[] argNames)
|
static Value |
extractJavadocComment(java.util.Vector specials,
Value name,
int[] argIds)
|
static Value |
extractJavadocCommentBody(java.lang.String str,
Value name,
Value[] argNames)
|
Value[] |
getArgNames()
Get the names of the arguments to the function, in order. |
Value |
getComment()
Get the comment block. |
Value |
getMember(int id,
boolean exception)
Get a member of this object. |
int |
getMinimumArgCount()
Get the minimum number of args that should be passed to this function. |
Value |
getName()
Get the name of this function. |
protected Value |
getTypeImpl()
Get the type of this object. |
protected Value |
getTypeMember(Value obj,
int id)
Get a member of this type. |
boolean |
isA(Value type)
If this object is a type, determine if an instance of this type is an instance of the specified type, ie. |
protected void |
populateMemberSet(java.util.Set s,
boolean debugger)
Derived classes that implement getMember(int, boolean) should also
implement this. |
protected void |
populateTypeMemberSet(java.util.Set s,
boolean debugger)
Derived classes that implement getTypeMember(oscript.data.Value, int) should also
implement this. |
boolean |
takesVarArgs()
Can this function be called with a variable number of arguments? |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
public static final Value TYPE
public static final java.lang.String PARENT_TYPE_NAME
public static final java.lang.String TYPE_NAME
public static final java.lang.String[] MEMBER_NAMES
public final Function.FunctionData fd
public for StackFrame.evalNode(oscript.NodeEvaluator, oscript.data.Scope)
Constructor Detail |
public Function(Scope enclosingScope, Value superFxn, Function.FunctionData fd)
enclosingScope
- the context the function was declared insuperFxn
- the function this function extends, or
null
fd
- the shared function data, for all instances
of this functionMethod Detail |
protected Value getTypeImpl()
Value.getType()
.
getTypeImpl
in class Value
public Value getName()
public Value getComment()
null
public int getMinimumArgCount()
#isVarArgs
returns true
, then it is possible
to pass more arguments to this function, otherwise, you should pass
exactly this number of args to the function.
#isVarArgs
,
getArgNames()
public boolean takesVarArgs()
getMinimumArgCount()
,
getArgNames()
public Value[] getArgNames()
public boolean isA(Value type)
type
,
or a subclass.
isA
in class Type
type
- the type to compare this type to
true
or false
PackagedScriptObjectException(NoSuchMemberException)
public Value bopCast(Value val) throws PackagedScriptObjectException
(a)b
is equivalent to a.bopCast(b)
bopCast
in class Value
val
- the other value
PackagedScriptObjectException(NoSuchMemberException)
PackagedScriptObjectException
public java.lang.String castToString() throws PackagedScriptObjectException
String
value.
castToString
in class Value
PackagedScriptObjectException(NoSuchMethodException)
PackagedScriptObjectException
public Value callAsFunction(StackFrame sf, MemberTable args) throws PackagedScriptObjectException
callAsFunction
in class Value
sf
- the current stack frameargs
- the arguments to the function, or null
if none
PackagedScriptObjectException
Function
public Value callAsConstructor(StackFrame sf, MemberTable args) throws PackagedScriptObjectException
callAsConstructor
in class Value
sf
- the current stack frameargs
- the arguments to the function, or null
if none
PackagedScriptObjectException
Function
public Value callAsExtends(StackFrame sf, Scope scope, MemberTable args) throws PackagedScriptObjectException
callAsExtends
in class Value
sf
- the current stack framescope
- the objectargs
- the arguments to the function, or null
if none
PackagedScriptObjectException
Function
public Value getMember(int id, boolean exception) throws PackagedScriptObjectException
getMember
in class Value
id
- the id of the symbol that maps to the memberexception
- whether an exception should be thrown if the
member object is not resolved
PackagedScriptObjectException(NoSuchMethodException)
PackagedScriptObjectException(NoSuchMemberException)
PackagedScriptObjectException
protected Value getTypeMember(Value obj, int id)
getTypeMember
in class Value
obj
- an object of this typeid
- the id of the symbol that maps to the member
Value.populateTypeMemberSet(java.util.Set, boolean)
protected void populateMemberSet(java.util.Set s, boolean debugger)
getMember(int, boolean)
should also
implement this.
populateMemberSet
in class Value
s
- the set to populatedebugger
- true
if being used by debugger, in
which case both public and private/protected field names should
be returnedgetMember(int, boolean)
protected void populateTypeMemberSet(java.util.Set s, boolean debugger)
getTypeMember(oscript.data.Value, int)
should also
implement this.
populateTypeMemberSet
in class Value
s
- the set to populatedebugger
- true
if being used by debugger, in
which case both public and private/protected field names should
be returnedgetTypeMember(oscript.data.Value, int)
public static Value extractJavadocComment(java.util.Vector specials, Value name, int[] argIds)
public static Value extractJavadocComment(java.lang.String str, Value name, Value[] argNames)
public static Value extractJavadocCommentBody(java.lang.String str, Value name, Value[] argNames)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |