com.caucho.quercus.function
Class AbstractFunction

java.lang.Object
  extended by com.caucho.quercus.env.Value
      extended by com.caucho.quercus.env.Callback
          extended by com.caucho.quercus.function.AbstractFunction
All Implemented Interfaces:
Callable, java.io.Serializable
Direct Known Subclasses:
AbstractJavaMethod, CompiledFunction, CompiledFunctionRef, CompiledMethod, CompiledMethodRef, Function, FunSpecialCall, LazyFunction, LazyMethod, ProfileFunction, UndefinedFunction, UnsetFunction

public abstract class AbstractFunction
extends Callback

Represents a function

See Also:
Serialized Form

Field Summary
protected  QuercusClass _bindingClass
           
protected  java.lang.String _declaringClassName
           
protected  boolean _isClosure
           
protected  boolean _isConstructor
           
protected  boolean _isFinal
           
protected  boolean _isStatic
           
protected  int _parseIndex
           
protected  Visibility _visibility
           
 
Fields inherited from class com.caucho.quercus.env.Value
NULL_VALUE_ARRAY, SCALAR_V
 
Constructor Summary
AbstractFunction()
           
AbstractFunction(Location location)
           
 
Method Summary
 Value call(Env env)
          Evaluates the function.
 Value call(Env env, Value a1)
          Evaluates the function with an argument .
abstract  Value call(Env env, Value[] args)
          Evaluates the function.
 Value call(Env env, Value a1, Value a2)
          Evaluates the function with arguments
 Value call(Env env, Value a1, Value a2, Value a3)
          Evaluates the function with arguments
 Value call(Env env, Value a1, Value a2, Value a3, Value a4)
          Evaluates the function with arguments
 Value call(Env env, Value a1, Value a2, Value a3, Value a4, Value a5)
          Evaluates the function with arguments
 Value callCopy(Env env, Value[] args)
          Evaluates the function, returning a copy
 Value callMethod(Env env, QuercusClass qClass, Value qThis)
          Evaluates the function as a method call.
 Value callMethod(Env env, QuercusClass qClass, Value qThis, Expr[] exprs)
          Evaluates the function.
 Value callMethod(Env env, QuercusClass qClass, Value qThis, Value a1)
          Evaluates the function as a method call.
 Value callMethod(Env env, QuercusClass qClass, Value qThis, Value[] args)
          Evaluates the method call.
 Value callMethod(Env env, QuercusClass qClass, Value qThis, Value a1, Value a2)
          Evaluates the function as a method call.
 Value callMethod(Env env, QuercusClass qClass, Value qThis, Value a1, Value a2, Value a3)
          Evaluates the function as a method call.
 Value callMethod(Env env, QuercusClass qClass, Value qThis, Value a1, Value a2, Value a3, Value a4)
          Evaluates the function as a method call.
 Value callMethod(Env env, QuercusClass qClass, Value qThis, Value a1, Value a2, Value a3, Value a4, Value a5)
          Evaluates the function as a method call.
 Value callMethodRef(Env env, QuercusClass qClass, Value qThis)
          Evaluates the function as a method call.
 Value callMethodRef(Env env, QuercusClass qClass, Value qThis, Expr[] exprs)
          Evaluates the function.
 Value callMethodRef(Env env, QuercusClass qClass, Value qThis, Value a1)
          Evaluates the function as a method call.
 Value callMethodRef(Env env, QuercusClass qClass, Value qThis, Value[] args)
          Evaluates the method call, returning a reference.
 Value callMethodRef(Env env, QuercusClass qClass, Value qThis, Value a1, Value a2)
          Evaluates the function as a method call.
 Value callMethodRef(Env env, QuercusClass qClass, Value qThis, Value a1, Value a2, Value a3)
          Evaluates the function as a method call.
 Value callMethodRef(Env env, QuercusClass qClass, Value qThis, Value a1, Value a2, Value a3, Value a4)
          Evaluates the function as a method call.
 Value callMethodRef(Env env, QuercusClass qClass, Value qThis, Value a1, Value a2, Value a3, Value a4, Value a5)
          Evaluates the function as a method call.
 Value callRef(Env env)
          Evaluates the function.
 Value callRef(Env env, Value a1)
          Evaluates the function with an argument .
 Value callRef(Env env, Value[] args)
          Evaluates the function, returning a reference.
 Value callRef(Env env, Value a1, Value a2)
          Evaluates the function with arguments
 Value callRef(Env env, Value a1, Value a2, Value a3)
          Evaluates the function with arguments
 Value callRef(Env env, Value a1, Value a2, Value a3, Value a4)
          Evaluates the function with arguments
 Value callRef(Env env, Value a1, Value a2, Value a3, Value a4, Value a5)
          Evaluates the function with arguments
protected  Value errorPrivateAccess(Env env, Value oldThis)
           
protected  Value errorProtectedAccess(Env env, Value oldThis)
           
 Value[] evalArguments(Env env, Expr fun, Expr[] args)
          Binds the user's arguments to the actual arguments.
 AbstractFunction getActualFunction(Expr[] args)
          Returns the actual function
 Arg[] getArgs()
          Returns the args.
 QuercusClass getBindingClass()
           
 java.lang.String getBindingClassName()
           
 java.lang.String getCallbackName()
          Returns the name of the callback.
 java.lang.String getComment()
          Returns the documentation for this function.
 java.lang.String getCompilationName()
           
 ClassDef getDeclaringClass()
           
 java.lang.String getDeclaringClassName()
           
 Location getLocation()
           
 java.lang.String getName()
           
 java.lang.String getType()
          Returns the type.
 boolean isAbstract()
          Returns true for an abstract function.
 boolean isBoolean()
          Returns true for a boolean function.
 boolean isCallUsesSymbolTable()
          Returns true if the function uses/modifies the local symbol table
 boolean isCallUsesVariableArgs()
          Returns true if the function uses variable args.
 boolean isClosure()
          Returns true for a closure.
 boolean isConstructor()
           
 boolean isDouble()
          Returns true for a double function.
 boolean isFinal()
           
 boolean isGlobal()
          Returns true for a global function.
 boolean isInternal(Env env)
          Returns true if this callback is implemented internally (i.e.
 boolean isLong()
          Returns true for a long function.
 boolean isObject()
          Returns true for an object
 boolean isPrivate()
           
 boolean isProtected()
           
 boolean isPublic()
           
 boolean isReturnsReference()
          True for a returns reference.
 boolean isStatic()
          Returns true for a static function.
 boolean isString()
          Returns true for a string function.
 boolean isValid(Env env)
          Checks for a valid callback.
 void setBindingClass(QuercusClass qcl)
           
 void setClosure(boolean isClosure)
          Sets true if function is a closure.
 void setConstructor(boolean isConstructor)
           
 void setDeclaringClassName(java.lang.String name)
           
 void setFinal(boolean isFinal)
           
 void setGlobal(boolean isGlobal)
          Returns true for a global function.
 void setParseIndex(int index)
           
 void setStatic(boolean isStatic)
          Sets true if function is static.
 void setVisibility(Visibility v)
           
 AbstractFunction toFun()
          For lazy functions, returns the actual function
 java.lang.String toString()
           
 
Methods inherited from class com.caucho.quercus.env.Callback
callArray, callArray, callArray, toCallable
 
Methods inherited from class com.caucho.quercus.env.Value
abs, add, add, addOne, append, appendTo, appendTo, appendTo, appendTo, bitAnd, bitOr, bitXor, callMethod, callMethod, callMethod, callMethod, callMethod, callMethod, callMethod, callMethod, callMethod, callMethod, callMethod, callMethod, callMethod, callMethod, callMethodRef, callMethodRef, callMethodRef, callMethodRef, callMethodRef, callMethodRef, callMethodRef, callMethodRef, callMethodRef, callMethodRef, callMethodRef, callMethodRef, callMethodRef, callMethodRef, charValueAt, checkPrivate, checkProtected, clone, cmp, containsKey, copy, copy, copy, copyArrayItem, copyReturn, copySaveFunArg, copyStringBuilder, copyTree, current, div, div, end, eq, eql, eqValue, findFunction, generate, geq, get, getArg, getArray, getArray, getBaseIterator, getCallableName, getCalledClass, getClassName, getCount, getCountRecursive, getDirty, getField, getFieldArg, getFieldArgRef, getFieldArray, getFieldObject, getFieldVar, getHashCode, getIterator, getKeyArray, getKeyIterator, getObject, getObject, getQuercusClass, getRef, getResourceType, getSize, getThisField, getThisFieldArg, getThisFieldArgRef, getThisFieldArray, getThisFieldObject, getThisFieldVar, getValueArray, getValueIterator, getValueType, getVar, gt, hasCurrent, hashCode, increment, initField, isA, isA, isArray, isBinary, isCallable, isDefault, isDoubleConvertible, isEmpty, isFieldInit, isLongConvertible, isNull, isNumberConvertible, isNumeric, isResource, isset, isset, issetField, issetThisField, isUnicode, isVar, jsonEncode, key, keyExists, length, leq, lshift, lt, mod, mul, mul, neg, next, nextIndex, pop, pos, postdecr, postincr, postincr, predecr, preincr, preincr, prev, print, print, printDepth, printJavaChar, printJavaString, printR, printRImpl, put, put, put, putField, putField, putField, putObject, putThisField, putThisField, putVar, remove, reset, rshift, serialize, serialize, set, setCharValueAt, setFieldInit, setJavaObject, shuffle, sub_rev, sub, sub, subOne, toArgRef, toArray, toArrayValue, toAutoArray, toAutoObject, toBigDecimal, toBigInteger, toBinaryValue, toBinaryValue, toBinaryValue, toBinaryValueMarshalCost, toBoolean, toBooleanMarshalCost, toByteArrayMarshalCost, toByteMarshalCost, toChar, toCharArrayMarshalCost, toCharMarshalCost, toDebugString, toDouble, toDoubleMarshalCost, toDoubleValue, toException, toFloatMarshalCost, toInputStream, toInt, toIntegerMarshalCost, toInternString, toJavaBoolean, toJavaByte, toJavaCalendar, toJavaCharacter, toJavaCollection, toJavaDate, toJavaDouble, toJavaFloat, toJavaInteger, toJavaList, toJavaLong, toJavaMap, toJavaObject, toJavaObject, toJavaObjectMarshalCost, toJavaObjectNotNull, toJavaShort, toJavaString, toJavaURL, toKey, toLocalRef, toLocalThis, toLocalValue, toLocalValueReadOnly, toLocalVar, toLocalVarDeclAsRef, toLong, toLongMarshalCost, toLongValue, toObject, toRef, toRefValue, toShortMarshalCost, toString, toStringBuilder, toStringBuilder, toStringBuilder, toStringBuilder, toStringMarshalCost, toStringValue, toStringValue, toStringValueMarshalCost, toUnicode, toUnicodeValue, toUnicodeValue, toUnicodeValueMarshalCost, toValue, toVar, unsetArray, unsetField, unsetThisArray, unsetThisField, valuesToArray, varDump, varDumpImpl, varExport
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

_isStatic

protected boolean _isStatic

_isFinal

protected boolean _isFinal

_isConstructor

protected boolean _isConstructor

_isClosure

protected boolean _isClosure

_visibility

protected Visibility _visibility

_declaringClassName

protected java.lang.String _declaringClassName

_bindingClass

protected QuercusClass _bindingClass

_parseIndex

protected int _parseIndex
Constructor Detail

AbstractFunction

public AbstractFunction()

AbstractFunction

public AbstractFunction(Location location)
Method Detail

getName

public java.lang.String getName()

getCallbackName

public java.lang.String getCallbackName()
Description copied from class: Callback
Returns the name of the callback.

Specified by:
getCallbackName in interface Callable
Specified by:
getCallbackName in class Callback

isInternal

public boolean isInternal(Env env)
Description copied from class: Callback
Returns true if this callback is implemented internally (i.e. in Java).

Specified by:
isInternal in class Callback

isValid

public boolean isValid(Env env)
Description copied from interface: Callable
Checks for a valid callback.

Specified by:
isValid in interface Callable
Specified by:
isValid in class Callback
Returns:
true if this is an invalid callback reference

getCompilationName

public final java.lang.String getCompilationName()

getDeclaringClassName

public java.lang.String getDeclaringClassName()

setDeclaringClassName

public void setDeclaringClassName(java.lang.String name)

getBindingClassName

public java.lang.String getBindingClassName()

setBindingClass

public void setBindingClass(QuercusClass qcl)

getBindingClass

public QuercusClass getBindingClass()

getDeclaringClass

public ClassDef getDeclaringClass()

isGlobal

public final boolean isGlobal()
Returns true for a global function.


isAbstract

public boolean isAbstract()
Returns true for an abstract function.


setStatic

public void setStatic(boolean isStatic)
Sets true if function is static.


isStatic

public boolean isStatic()
Returns true for a static function.


isFinal

public boolean isFinal()

setFinal

public final void setFinal(boolean isFinal)

setClosure

public void setClosure(boolean isClosure)
Sets true if function is a closure.


isClosure

public boolean isClosure()
Returns true for a closure.


isConstructor

public boolean isConstructor()

setConstructor

public final void setConstructor(boolean isConstructor)

isPublic

public boolean isPublic()

isProtected

public boolean isProtected()

isPrivate

public boolean isPrivate()

setVisibility

public final void setVisibility(Visibility v)

setParseIndex

public final void setParseIndex(int index)

getLocation

public final Location getLocation()

setGlobal

public final void setGlobal(boolean isGlobal)
Returns true for a global function.


isBoolean

public boolean isBoolean()
Returns true for a boolean function.

Overrides:
isBoolean in class Value

isString

public boolean isString()
Returns true for a string function.

Overrides:
isString in class Value

isLong

public boolean isLong()
Returns true for a long function.

Overrides:
isLong in class Value

isDouble

public boolean isDouble()
Returns true for a double function.

Overrides:
isDouble in class Value

isCallUsesVariableArgs

public boolean isCallUsesVariableArgs()
Returns true if the function uses variable args.


isCallUsesSymbolTable

public boolean isCallUsesSymbolTable()
Returns true if the function uses/modifies the local symbol table


isReturnsReference

public boolean isReturnsReference()
True for a returns reference.


getArgs

public Arg[] getArgs()
Returns the args.


toFun

public AbstractFunction toFun()
For lazy functions, returns the actual function


getActualFunction

public AbstractFunction getActualFunction(Expr[] args)
Returns the actual function


getComment

public java.lang.String getComment()
Returns the documentation for this function.


evalArguments

public Value[] evalArguments(Env env,
                             Expr fun,
                             Expr[] args)
Binds the user's arguments to the actual arguments.

Parameters:
args - the user's arguments
Returns:
the user arguments augmented by any defaults

isObject

public boolean isObject()
Returns true for an object

Overrides:
isObject in class Value

getType

public java.lang.String getType()
Description copied from class: Value
Returns the type.

Overrides:
getType in class Value

call

public abstract Value call(Env env,
                           Value[] args)
Evaluates the function.

Specified by:
call in interface Callable
Specified by:
call in class Callback
Parameters:
env - the calling environment

callRef

public Value callRef(Env env,
                     Value[] args)
Evaluates the function, returning a reference.

Overrides:
callRef in class Value

callCopy

public Value callCopy(Env env,
                      Value[] args)
Evaluates the function, returning a copy

Overrides:
callCopy in class Value

call

public Value call(Env env)
Evaluates the function.

Specified by:
call in interface Callable
Overrides:
call in class Value
Parameters:
env - the calling environment

call

public Value call(Env env,
                  Value a1)
Evaluates the function with an argument .

Specified by:
call in interface Callable
Overrides:
call in class Value
Parameters:
env - the calling environment

call

public Value call(Env env,
                  Value a1,
                  Value a2)
Evaluates the function with arguments

Specified by:
call in interface Callable
Overrides:
call in class Value
Parameters:
env - the calling environment

call

public Value call(Env env,
                  Value a1,
                  Value a2,
                  Value a3)
Evaluates the function with arguments

Specified by:
call in interface Callable
Overrides:
call in class Value
Parameters:
env - the calling environment

call

public Value call(Env env,
                  Value a1,
                  Value a2,
                  Value a3,
                  Value a4)
Evaluates the function with arguments

Specified by:
call in interface Callable
Overrides:
call in class Value
Parameters:
env - the calling environment

call

public Value call(Env env,
                  Value a1,
                  Value a2,
                  Value a3,
                  Value a4,
                  Value a5)
Evaluates the function with arguments

Specified by:
call in interface Callable
Overrides:
call in class Value
Parameters:
env - the calling environment

callRef

public Value callRef(Env env)
Evaluates the function.

Overrides:
callRef in class Value

callRef

public Value callRef(Env env,
                     Value a1)
Evaluates the function with an argument .

Overrides:
callRef in class Value

callRef

public Value callRef(Env env,
                     Value a1,
                     Value a2)
Evaluates the function with arguments

Overrides:
callRef in class Value

callRef

public Value callRef(Env env,
                     Value a1,
                     Value a2,
                     Value a3)
Evaluates the function with arguments

Overrides:
callRef in class Value

callRef

public Value callRef(Env env,
                     Value a1,
                     Value a2,
                     Value a3,
                     Value a4)
Evaluates the function with arguments

Overrides:
callRef in class Value

callRef

public Value callRef(Env env,
                     Value a1,
                     Value a2,
                     Value a3,
                     Value a4,
                     Value a5)
Evaluates the function with arguments

Overrides:
callRef in class Value

callMethod

public Value callMethod(Env env,
                        QuercusClass qClass,
                        Value qThis,
                        Value[] args)
Evaluates the method call.


callMethodRef

public Value callMethodRef(Env env,
                           QuercusClass qClass,
                           Value qThis,
                           Value[] args)
Evaluates the method call, returning a reference.


callMethod

public Value callMethod(Env env,
                        QuercusClass qClass,
                        Value qThis)
Evaluates the function as a method call.


callMethodRef

public Value callMethodRef(Env env,
                           QuercusClass qClass,
                           Value qThis)
Evaluates the function as a method call.


callMethod

public Value callMethod(Env env,
                        QuercusClass qClass,
                        Value qThis,
                        Value a1)
Evaluates the function as a method call.


callMethodRef

public Value callMethodRef(Env env,
                           QuercusClass qClass,
                           Value qThis,
                           Value a1)
Evaluates the function as a method call.


callMethod

public Value callMethod(Env env,
                        QuercusClass qClass,
                        Value qThis,
                        Value a1,
                        Value a2)
Evaluates the function as a method call.


callMethodRef

public Value callMethodRef(Env env,
                           QuercusClass qClass,
                           Value qThis,
                           Value a1,
                           Value a2)
Evaluates the function as a method call.


callMethod

public Value callMethod(Env env,
                        QuercusClass qClass,
                        Value qThis,
                        Value a1,
                        Value a2,
                        Value a3)
Evaluates the function as a method call.


callMethodRef

public Value callMethodRef(Env env,
                           QuercusClass qClass,
                           Value qThis,
                           Value a1,
                           Value a2,
                           Value a3)
Evaluates the function as a method call.


callMethod

public Value callMethod(Env env,
                        QuercusClass qClass,
                        Value qThis,
                        Value a1,
                        Value a2,
                        Value a3,
                        Value a4)
Evaluates the function as a method call.


callMethodRef

public Value callMethodRef(Env env,
                           QuercusClass qClass,
                           Value qThis,
                           Value a1,
                           Value a2,
                           Value a3,
                           Value a4)
Evaluates the function as a method call.


callMethod

public Value callMethod(Env env,
                        QuercusClass qClass,
                        Value qThis,
                        Value a1,
                        Value a2,
                        Value a3,
                        Value a4,
                        Value a5)
Evaluates the function as a method call.


callMethodRef

public Value callMethodRef(Env env,
                           QuercusClass qClass,
                           Value qThis,
                           Value a1,
                           Value a2,
                           Value a3,
                           Value a4,
                           Value a5)
Evaluates the function as a method call.


callMethod

public Value callMethod(Env env,
                        QuercusClass qClass,
                        Value qThis,
                        Expr[] exprs)
Evaluates the function.


callMethodRef

public Value callMethodRef(Env env,
                           QuercusClass qClass,
                           Value qThis,
                           Expr[] exprs)
Evaluates the function.


errorProtectedAccess

protected Value errorProtectedAccess(Env env,
                                     Value oldThis)

errorPrivateAccess

protected Value errorPrivateAccess(Env env,
                                   Value oldThis)

toString

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