oscript.data
Class Reference

java.lang.Object
  extended byoscript.data.Value
      extended byoscript.data.Reference
All Implemented Interfaces:
java.io.Serializable

public final class Reference
extends Value

A reference forwards all method calls to the object it is a reference for, but additionally a reference is assignable. It is used when a variable (or array element) is looked up within a scope, and can be used as either an lval or rval.

When a property of an object (ie a scope) has attributes associated with it, those attributes are attributes of the reference. The attributes are partially enforced by this class (in the case of "const"), and by ScriptObject (in the case of "public").

Note that this could extends AbstractReference, but doesn't because I think that would have a performance impact... one of these days I should actually verify that...

Author:
Rob Clark (rob@ti.com)
See Also:
Serialized Form

Field Summary
static int ATTR_CONST
           
static int ATTR_INVALID
           
static int ATTR_PRIVATE
           
static int ATTR_PROTECTED
           
static int ATTR_PUBLIC
           
static int ATTR_STATIC
           
 
Fields inherited from class oscript.data.Value
DEBUG, MEMBER_NAMES, NULL, PARENT_TYPE_NAME, TYPE, TYPE_NAME, UNDEFINED
 
Constructor Summary
Reference()
          Class Constructor.
Reference(int attr)
          Class Constructor.
Reference(Reference r)
          Copy Constructor
 
Method Summary
 Value bopBitwiseAnd(Value val)
          Perform the bitwise AND operation.
 Value bopBitwiseAndR(Value val, PackagedScriptObjectException e)
           
 Value bopBitwiseOr(Value val)
          Perform the bitwise OR operation.
 Value bopBitwiseOrR(Value val, PackagedScriptObjectException e)
           
 Value bopBitwiseXor(Value val)
          Perform the bitwise XOR operation.
 Value bopBitwiseXorR(Value val, PackagedScriptObjectException e)
           
 Value bopCast(Value val)
          Perform the cast operation, (a)b is equivalent to a.bopCast(b)
 Value bopCastR(Value val, PackagedScriptObjectException e)
           
 Value bopDivide(Value val)
          Perform the "/" operation.
 Value bopDivideR(Value val, PackagedScriptObjectException e)
           
 Value bopEquals(Value val)
          Perform the "==" operation.
 Value bopEqualsR(Value val, PackagedScriptObjectException e)
           
 Value bopGreaterThan(Value val)
          Perform the ">" operation.
 Value bopGreaterThanOrEquals(Value val)
          Perform the ">=" operation.
 Value bopGreaterThanOrEqualsR(Value val, PackagedScriptObjectException e)
           
 Value bopGreaterThanR(Value val, PackagedScriptObjectException e)
           
 Value bopInstanceOf(Value val)
          Perform the instanceof operation.
 Value bopInstanceOfR(Value val, PackagedScriptObjectException e)
           
 Value bopLeftShift(Value val)
          Perform the "<<" operation.
 Value bopLeftShiftR(Value val, PackagedScriptObjectException e)
           
 Value bopLessThan(Value val)
          Perform the "<" operation.
 Value bopLessThanOrEquals(Value val)
          Perform the "<=" operation.
 Value bopLessThanOrEqualsR(Value val, PackagedScriptObjectException e)
           
 Value bopLessThanR(Value val, PackagedScriptObjectException e)
           
 Value bopLogicalAnd(Value val)
          Perform the logical AND operation.
 Value bopLogicalAndR(Value val, PackagedScriptObjectException e)
           
 Value bopLogicalOr(Value val)
          Perform the logical OR operation.
 Value bopLogicalOrR(Value val, PackagedScriptObjectException e)
           
 Value bopMinus(Value val)
          Perform the "-" operation.
 Value bopMinusR(Value val, PackagedScriptObjectException e)
           
 Value bopMultiply(Value val)
          Perform the "*" operation.
 Value bopMultiplyR(Value val, PackagedScriptObjectException e)
           
 Value bopNotEquals(Value val)
          Perform the "!=" operation.
 Value bopNotEqualsR(Value val, PackagedScriptObjectException e)
           
 Value bopPlus(Value val)
          Perform the "+" operation.
 Value bopPlusR(Value val, PackagedScriptObjectException e)
           
 Value bopRemainder(Value val)
          Perform the "%" operation.
 Value bopRemainderR(Value val, PackagedScriptObjectException e)
           
 Value bopSignedRightShift(Value val)
          Perform the ">>" operation.
 Value bopSignedRightShiftR(Value val, PackagedScriptObjectException e)
           
 Value bopUnsignedRightShift(Value val)
          Perform the ">>>" operation.
 Value bopUnsignedRightShiftR(Value val, PackagedScriptObjectException e)
           
 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.
 boolean castToBoolean()
          Convert this object to a native java boolean value.
 long castToExactNumber()
          Convert this object to a native java long value.
 double castToInexactNumber()
          Convert this object to a native java double value.
 java.lang.Object castToJavaObject()
          Convert this object to a native java Object value.
 java.lang.String castToString()
          Convert this object to a native java String value.
 Value elementAt(Value idx)
          Get the specified index of this object, if this object is an array.
 Value elementsAt(Value idx1, Value idx2)
          Get the specified range of this object, if this object is an array.
 boolean equals(java.lang.Object obj)
          Compare two objects for equality.
 Value getMember(int id, boolean exception)
          Get a member of this object.
 java.lang.Object getMonitor()
          Return the object used for implementing synchronized.
 Value getType()
          Get the type of this object.
protected  Value getTypeImpl()
          Get the type of this object.
protected  Value getTypeMember(Value obj, int id)
          Get a member of this type.
 int hashCode()
          Return a hash code value for this object.
 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.
 int length()
          For types that implement elementAt, this returns the number of elements.
 java.util.Set memberSet()
          Returns the names of the members of this object.
 void opAssign(Value val)
          Perform assignment.
 void reset()
           
 void reset(Value val)
           
 Value unhand()
          For references to an object (ie variables), this returns the actual value this is a reference to, otherwise this return this.
 Value uopBitwiseNot()
          Perform the "~" operation.
 Value uopDecrement()
          Perform the "--" operation.
 Value uopIncrement()
          Perform the "++" operation.
 Value uopLogicalNot()
          Perform the "!" operation.
 Value uopMinus()
          Perform the "-" operation.
 Value uopPlus()
          Perform the "+" operation.
 
Methods inherited from class oscript.data.Value
_getTypeMember, _populateTypeMemberSet, callAsConstructor, callAsConstructor, callAsExtends, callAsExtends, callAsFunction, callAsFunction, getMember, getMember, getMember, getMember, getMember, getTypeMember, noSuchMember, populateMemberSet, populateTypeMemberSet, readExternal, toString, writeExternal
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

ATTR_INVALID

public static final int ATTR_INVALID
See Also:
Constant Field Values

ATTR_PRIVATE

public static final int ATTR_PRIVATE
See Also:
Constant Field Values

ATTR_PROTECTED

public static final int ATTR_PROTECTED
See Also:
Constant Field Values

ATTR_PUBLIC

public static final int ATTR_PUBLIC
See Also:
Constant Field Values

ATTR_CONST

public static final int ATTR_CONST
See Also:
Constant Field Values

ATTR_STATIC

public static final int ATTR_STATIC
See Also:
Constant Field Values
Constructor Detail

Reference

public Reference()
Class Constructor. Create a reference with the default attributes.


Reference

public Reference(Reference r)
Copy Constructor


Reference

public Reference(int attr)
Class Constructor. Create a reference with the specified attributes.

Parameters:
attr - attribute bitmask
Method Detail

getTypeImpl

protected Value getTypeImpl()
Get the type of this object. The returned type doesn't have to take into account the possibility of a script type extending a built-in type, since that is handled by getType().

Specified by:
getTypeImpl in class Value
Returns:
the object's type

reset

public final void reset(Value val)

reset

public final void reset()

hashCode

public int hashCode()
Return a hash code value for this object.

Returns:
a hash code value
See Also:
Object.hashCode()

equals

public boolean equals(java.lang.Object obj)
Compare two objects for equality.

Parameters:
obj - the object to compare to this object
Returns:
true if equals, else false
See Also:
Object.equals(java.lang.Object)

unhand

public Value unhand()
For references to an object (ie variables), this returns the actual value this is a reference to, otherwise this return this.

Overrides:
unhand in class Value
Returns:
the actual object

getMonitor

public java.lang.Object getMonitor()
Return the object used for implementing synchronized. For a normal script object, the object is it's own monitor. For a java object, it is the java object rather than the JavaObjectWrapper.

Overrides:
getMonitor in class Value
Returns:
the object to synchronize on

isA

public 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. if this is type, or a subclass.

Overrides:
isA in class Value
Parameters:
type - the type to compare this type to
Returns:
true or false
Throws:
PackagedScriptObjectException(NoSuchMemberException)

getType

public Value getType()
Get the type of this object. A reference doesn't actually have a type, but instead is the type of whatever it contains... really I am not sure if a reference is a first class type, or perhaps could be implemented as an inner-class for OArray and ScriptObject. Perhaps Value should be an interface, and what is now Value becomes some sort of adapter class?

Overrides:
getType in class Value
Returns:
the object's type

castToBoolean

public boolean castToBoolean()
                      throws PackagedScriptObjectException
Convert this object to a native java boolean value.

Overrides:
castToBoolean in class Value
Returns:
a boolean value
Throws:
PackagedScriptObjectException(NoSuchMemberException)
PackagedScriptObjectException

castToString

public java.lang.String castToString()
                              throws PackagedScriptObjectException
Convert this object to a native java String value.

Overrides:
castToString in class Value
Returns:
a String value
Throws:
PackagedScriptObjectException(NoSuchMemberException)
PackagedScriptObjectException

castToExactNumber

public long castToExactNumber()
                       throws PackagedScriptObjectException
Convert this object to a native java long value.

Overrides:
castToExactNumber in class Value
Returns:
a long value
Throws:
PackagedScriptObjectException(NoSuchMemberException)
PackagedScriptObjectException

castToInexactNumber

public double castToInexactNumber()
                           throws PackagedScriptObjectException
Convert this object to a native java double value.

Overrides:
castToInexactNumber in class Value
Returns:
a double value
Throws:
PackagedScriptObjectException(NoSuchMemberException)
PackagedScriptObjectException

castToJavaObject

public java.lang.Object castToJavaObject()
                                  throws PackagedScriptObjectException
Convert this object to a native java Object value.

Overrides:
castToJavaObject in class Value
Returns:
a java object
Throws:
PackagedScriptObjectException(NoSuchMemberException)
PackagedScriptObjectException

bopCast

public Value bopCast(Value val)
              throws PackagedScriptObjectException
Perform the cast operation, (a)b is equivalent to a.bopCast(b)

Overrides:
bopCast in class Value
Parameters:
val - the other value
Returns:
the result
Throws:
PackagedScriptObjectException(NoSuchMemberException)
PackagedScriptObjectException

bopCastR

public Value bopCastR(Value val,
                      PackagedScriptObjectException e)
               throws PackagedScriptObjectException
Overrides:
bopCastR in class Value
Throws:
PackagedScriptObjectException

bopInstanceOf

public Value bopInstanceOf(Value val)
                    throws PackagedScriptObjectException
Perform the instanceof operation.

Overrides:
bopInstanceOf in class Value
Parameters:
val - the other value
Returns:
the result
Throws:
PackagedScriptObjectException(NoSuchMemberException)
PackagedScriptObjectException

bopInstanceOfR

public Value bopInstanceOfR(Value val,
                            PackagedScriptObjectException e)
                     throws PackagedScriptObjectException
Overrides:
bopInstanceOfR in class Value
Throws:
PackagedScriptObjectException

bopLogicalOr

public Value bopLogicalOr(Value val)
                   throws PackagedScriptObjectException
Perform the logical OR operation.

Overrides:
bopLogicalOr in class Value
Parameters:
val - the other value
Returns:
the result
Throws:
PackagedScriptObjectException(NoSuchMemberException)
PackagedScriptObjectException

bopLogicalOrR

public Value bopLogicalOrR(Value val,
                           PackagedScriptObjectException e)
                    throws PackagedScriptObjectException
Overrides:
bopLogicalOrR in class Value
Throws:
PackagedScriptObjectException

bopLogicalAnd

public Value bopLogicalAnd(Value val)
                    throws PackagedScriptObjectException
Perform the logical AND operation.

Overrides:
bopLogicalAnd in class Value
Parameters:
val - the other value
Returns:
the result
Throws:
PackagedScriptObjectException(NoSuchMemberException)
PackagedScriptObjectException

bopLogicalAndR

public Value bopLogicalAndR(Value val,
                            PackagedScriptObjectException e)
                     throws PackagedScriptObjectException
Overrides:
bopLogicalAndR in class Value
Throws:
PackagedScriptObjectException

bopBitwiseOr

public Value bopBitwiseOr(Value val)
                   throws PackagedScriptObjectException
Perform the bitwise OR operation.

Overrides:
bopBitwiseOr in class Value
Parameters:
val - the other value
Returns:
the result
Throws:
PackagedScriptObjectException(NoSuchMemberException)
PackagedScriptObjectException

bopBitwiseOrR

public Value bopBitwiseOrR(Value val,
                           PackagedScriptObjectException e)
                    throws PackagedScriptObjectException
Overrides:
bopBitwiseOrR in class Value
Throws:
PackagedScriptObjectException

bopBitwiseXor

public Value bopBitwiseXor(Value val)
                    throws PackagedScriptObjectException
Perform the bitwise XOR operation.

Overrides:
bopBitwiseXor in class Value
Parameters:
val - the other value
Returns:
the result
Throws:
PackagedScriptObjectException(NoSuchMemberException)
PackagedScriptObjectException

bopBitwiseXorR

public Value bopBitwiseXorR(Value val,
                            PackagedScriptObjectException e)
                     throws PackagedScriptObjectException
Overrides:
bopBitwiseXorR in class Value
Throws:
PackagedScriptObjectException

bopBitwiseAnd

public Value bopBitwiseAnd(Value val)
                    throws PackagedScriptObjectException
Perform the bitwise AND operation.

Overrides:
bopBitwiseAnd in class Value
Parameters:
val - the other value
Returns:
the result
Throws:
PackagedScriptObjectException(NoSuchMemberException)
PackagedScriptObjectException

bopBitwiseAndR

public Value bopBitwiseAndR(Value val,
                            PackagedScriptObjectException e)
                     throws PackagedScriptObjectException
Overrides:
bopBitwiseAndR in class Value
Throws:
PackagedScriptObjectException

bopEquals

public Value bopEquals(Value val)
                throws PackagedScriptObjectException
Perform the "==" operation.

Overrides:
bopEquals in class Value
Parameters:
val - the other value
Returns:
the result
Throws:
PackagedScriptObjectException(NoSuchMemberException)
PackagedScriptObjectException

bopEqualsR

public Value bopEqualsR(Value val,
                        PackagedScriptObjectException e)
                 throws PackagedScriptObjectException
Overrides:
bopEqualsR in class Value
Throws:
PackagedScriptObjectException

bopNotEquals

public Value bopNotEquals(Value val)
                   throws PackagedScriptObjectException
Perform the "!=" operation.

Overrides:
bopNotEquals in class Value
Parameters:
val - the other value
Returns:
the result
Throws:
PackagedScriptObjectException(NoSuchMemberException)
PackagedScriptObjectException

bopNotEqualsR

public Value bopNotEqualsR(Value val,
                           PackagedScriptObjectException e)
                    throws PackagedScriptObjectException
Overrides:
bopNotEqualsR in class Value
Throws:
PackagedScriptObjectException

bopLessThan

public Value bopLessThan(Value val)
                  throws PackagedScriptObjectException
Perform the "<" operation.

Overrides:
bopLessThan in class Value
Parameters:
val - the other value
Returns:
the result
Throws:
PackagedScriptObjectException(NoSuchMemberException)
PackagedScriptObjectException

bopLessThanR

public Value bopLessThanR(Value val,
                          PackagedScriptObjectException e)
                   throws PackagedScriptObjectException
Overrides:
bopLessThanR in class Value
Throws:
PackagedScriptObjectException

bopGreaterThan

public Value bopGreaterThan(Value val)
                     throws PackagedScriptObjectException
Perform the ">" operation.

Overrides:
bopGreaterThan in class Value
Parameters:
val - the other value
Returns:
the result
Throws:
PackagedScriptObjectException(NoSuchMemberException)
PackagedScriptObjectException

bopGreaterThanR

public Value bopGreaterThanR(Value val,
                             PackagedScriptObjectException e)
                      throws PackagedScriptObjectException
Overrides:
bopGreaterThanR in class Value
Throws:
PackagedScriptObjectException

bopLessThanOrEquals

public Value bopLessThanOrEquals(Value val)
                          throws PackagedScriptObjectException
Perform the "<=" operation.

Overrides:
bopLessThanOrEquals in class Value
Parameters:
val - the other value
Returns:
the result
Throws:
PackagedScriptObjectException(NoSuchMemberException)
PackagedScriptObjectException

bopLessThanOrEqualsR

public Value bopLessThanOrEqualsR(Value val,
                                  PackagedScriptObjectException e)
                           throws PackagedScriptObjectException
Overrides:
bopLessThanOrEqualsR in class Value
Throws:
PackagedScriptObjectException

bopGreaterThanOrEquals

public Value bopGreaterThanOrEquals(Value val)
                             throws PackagedScriptObjectException
Perform the ">=" operation.

Overrides:
bopGreaterThanOrEquals in class Value
Parameters:
val - the other value
Returns:
the result
Throws:
PackagedScriptObjectException(NoSuchMemberException)
PackagedScriptObjectException

bopGreaterThanOrEqualsR

public Value bopGreaterThanOrEqualsR(Value val,
                                     PackagedScriptObjectException e)
                              throws PackagedScriptObjectException
Overrides:
bopGreaterThanOrEqualsR in class Value
Throws:
PackagedScriptObjectException

bopLeftShift

public Value bopLeftShift(Value val)
                   throws PackagedScriptObjectException
Perform the "<<" operation.

Overrides:
bopLeftShift in class Value
Parameters:
val - the other value
Returns:
the result
Throws:
PackagedScriptObjectException(NoSuchMemberException)
PackagedScriptObjectException

bopLeftShiftR

public Value bopLeftShiftR(Value val,
                           PackagedScriptObjectException e)
                    throws PackagedScriptObjectException
Overrides:
bopLeftShiftR in class Value
Throws:
PackagedScriptObjectException

bopSignedRightShift

public Value bopSignedRightShift(Value val)
                          throws PackagedScriptObjectException
Perform the ">>" operation.

Overrides:
bopSignedRightShift in class Value
Parameters:
val - the other value
Returns:
the result
Throws:
PackagedScriptObjectException(NoSuchMemberException)
PackagedScriptObjectException

bopSignedRightShiftR

public Value bopSignedRightShiftR(Value val,
                                  PackagedScriptObjectException e)
                           throws PackagedScriptObjectException
Overrides:
bopSignedRightShiftR in class Value
Throws:
PackagedScriptObjectException

bopUnsignedRightShift

public Value bopUnsignedRightShift(Value val)
                            throws PackagedScriptObjectException
Perform the ">>>" operation.

Overrides:
bopUnsignedRightShift in class Value
Parameters:
val - the other value
Returns:
the result
Throws:
PackagedScriptObjectException(NoSuchMemberException)
PackagedScriptObjectException

bopUnsignedRightShiftR

public Value bopUnsignedRightShiftR(Value val,
                                    PackagedScriptObjectException e)
                             throws PackagedScriptObjectException
Overrides:
bopUnsignedRightShiftR in class Value
Throws:
PackagedScriptObjectException

bopPlus

public Value bopPlus(Value val)
              throws PackagedScriptObjectException
Perform the "+" operation.

Overrides:
bopPlus in class Value
Parameters:
val - the other value
Returns:
the result
Throws:
PackagedScriptObjectException(NoSuchMemberException)
PackagedScriptObjectException

bopPlusR

public Value bopPlusR(Value val,
                      PackagedScriptObjectException e)
               throws PackagedScriptObjectException
Overrides:
bopPlusR in class Value
Throws:
PackagedScriptObjectException

bopMinus

public Value bopMinus(Value val)
               throws PackagedScriptObjectException
Perform the "-" operation.

Overrides:
bopMinus in class Value
Parameters:
val - the other value
Returns:
the result
Throws:
PackagedScriptObjectException(NoSuchMemberException)
PackagedScriptObjectException

bopMinusR

public Value bopMinusR(Value val,
                       PackagedScriptObjectException e)
                throws PackagedScriptObjectException
Overrides:
bopMinusR in class Value
Throws:
PackagedScriptObjectException

bopMultiply

public Value bopMultiply(Value val)
                  throws PackagedScriptObjectException
Perform the "*" operation.

Overrides:
bopMultiply in class Value
Parameters:
val - the other value
Returns:
the result
Throws:
PackagedScriptObjectException(NoSuchMemberException)
PackagedScriptObjectException

bopMultiplyR

public Value bopMultiplyR(Value val,
                          PackagedScriptObjectException e)
                   throws PackagedScriptObjectException
Overrides:
bopMultiplyR in class Value
Throws:
PackagedScriptObjectException

bopDivide

public Value bopDivide(Value val)
                throws PackagedScriptObjectException
Perform the "/" operation.

Overrides:
bopDivide in class Value
Parameters:
val - the other value
Returns:
the result
Throws:
PackagedScriptObjectException(NoSuchMemberException)
PackagedScriptObjectException

bopDivideR

public Value bopDivideR(Value val,
                        PackagedScriptObjectException e)
                 throws PackagedScriptObjectException
Overrides:
bopDivideR in class Value
Throws:
PackagedScriptObjectException

bopRemainder

public Value bopRemainder(Value val)
                   throws PackagedScriptObjectException
Perform the "%" operation.

Overrides:
bopRemainder in class Value
Parameters:
val - the other value
Returns:
the result
Throws:
PackagedScriptObjectException(NoSuchMemberException)
PackagedScriptObjectException

bopRemainderR

public Value bopRemainderR(Value val,
                           PackagedScriptObjectException e)
                    throws PackagedScriptObjectException
Overrides:
bopRemainderR in class Value
Throws:
PackagedScriptObjectException

uopIncrement

public Value uopIncrement()
                   throws PackagedScriptObjectException
Perform the "++" operation.

Overrides:
uopIncrement in class Value
Returns:
the result
Throws:
PackagedScriptObjectException(NoSuchMemberException)
PackagedScriptObjectException

uopDecrement

public Value uopDecrement()
                   throws PackagedScriptObjectException
Perform the "--" operation.

Overrides:
uopDecrement in class Value
Returns:
the result
Throws:
PackagedScriptObjectException(NoSuchMemberException)
PackagedScriptObjectException

uopPlus

public Value uopPlus()
              throws PackagedScriptObjectException
Perform the "+" operation.

Overrides:
uopPlus in class Value
Returns:
the result
Throws:
PackagedScriptObjectException(NoSuchMemberException)
PackagedScriptObjectException

uopMinus

public Value uopMinus()
               throws PackagedScriptObjectException
Perform the "-" operation.

Overrides:
uopMinus in class Value
Returns:
the result
Throws:
PackagedScriptObjectException(NoSuchMemberException)
PackagedScriptObjectException

uopBitwiseNot

public Value uopBitwiseNot()
                    throws PackagedScriptObjectException
Perform the "~" operation.

Overrides:
uopBitwiseNot in class Value
Returns:
the result
Throws:
PackagedScriptObjectException(NoSuchMemberException)
PackagedScriptObjectException

uopLogicalNot

public Value uopLogicalNot()
                    throws PackagedScriptObjectException
Perform the "!" operation.

Overrides:
uopLogicalNot in class Value
Returns:
the result
Throws:
PackagedScriptObjectException(NoSuchMemberException)
PackagedScriptObjectException

opAssign

public void opAssign(Value val)
              throws PackagedScriptObjectException
Perform assignment. Set the value of this reference to the specified value.

Overrides:
opAssign in class Value
Parameters:
val - the value to set this reference to
Throws:
PackagedScriptObjectException(NoSuchMemberException)
PackagedScriptObjectException

callAsFunction

public Value callAsFunction(StackFrame sf,
                            MemberTable args)
                     throws PackagedScriptObjectException
Call this object as a function.

Overrides:
callAsFunction in class Value
Parameters:
sf - the current stack frame
args - the arguments to the function
Returns:
the value returned by the function
Throws:
PackagedScriptObjectException
See Also:
Function

callAsConstructor

public Value callAsConstructor(StackFrame sf,
                               MemberTable args)
                        throws PackagedScriptObjectException
Call this object as a constructor.

Overrides:
callAsConstructor in class Value
Parameters:
sf - the current stack frame
args - the arguments to the function
Returns:
the newly constructed object
Throws:
PackagedScriptObjectException
See Also:
Function

callAsExtends

public Value callAsExtends(StackFrame sf,
                           Scope scope,
                           MemberTable args)
                    throws PackagedScriptObjectException
Call this object as a parent class constructor.

Overrides:
callAsExtends in class Value
Parameters:
sf - the current stack frame
scope - the object
args - the arguments to the function
Returns:
the value returned by the function
Throws:
PackagedScriptObjectException
See Also:
Function

getMember

public Value getMember(int id,
                       boolean exception)
                throws PackagedScriptObjectException
Get a member of this object.

Overrides:
getMember in class Value
Parameters:
id - the id of the symbol that maps to the member
exception - whether an exception should be thrown if the member object is not resolved
Returns:
a reference to the member
Throws:
PackagedScriptObjectException(NoSuchMethodException)
PackagedScriptObjectException(NoSuchMemberException)
PackagedScriptObjectException

getTypeMember

protected Value getTypeMember(Value obj,
                              int id)
Get a member of this type. This is used to interface to the java method of having members be attributes of a type. Regular object- script object's members are attributes of the object, but in the case of java types (including built-in types), the members are attributes of the type.

Overrides:
getTypeMember in class Value
Parameters:
obj - an object of this type
id - the id of the symbol that maps to the member
Returns:
a reference to the member, or null
See Also:
Value.populateTypeMemberSet(java.util.Set, boolean)

length

public int length()
           throws PackagedScriptObjectException
For types that implement elementAt, this returns the number of elements.

Overrides:
length in class Value
Returns:
an integer length
Throws:
PackagedScriptObjectException(NoSuchMemberException)
PackagedScriptObjectException
See Also:
elementAt(oscript.data.Value), elementsAt(oscript.data.Value, oscript.data.Value)

elementAt

public Value elementAt(Value idx)
                throws PackagedScriptObjectException
Get the specified index of this object, if this object is an array. If needed, the array is grown to the appropriate size.

Overrides:
elementAt in class Value
Parameters:
idx - the index to get
Returns:
a reference to the member
Throws:
PackagedScriptObjectException(NoSuchMemberException)
PackagedScriptObjectException
See Also:
length(), elementsAt(oscript.data.Value, oscript.data.Value)

elementsAt

public Value elementsAt(Value idx1,
                        Value idx2)
                 throws PackagedScriptObjectException
Get the specified range of this object, if this object is an array. This returns a copy of a range of the array.

Overrides:
elementsAt in class Value
Parameters:
idx1 - the index index of the beginning of the range, inclusive
idx2 - the index of the end of the range, inclusive
Returns:
a copy of the specified range of this array
Throws:
PackagedScriptObjectException(NoSuchMemberException)
PackagedScriptObjectException
See Also:
length(), elementAt(oscript.data.Value)

memberSet

public final java.util.Set memberSet()
Returns the names of the members of this object.

Overrides:
memberSet in class Value
Returns:
a collection view of the names of the members of this object