oscript.data
Class Value

java.lang.Object
  extended byoscript.data.Value
All Implemented Interfaces:
java.io.Serializable
Direct Known Subclasses:
AbstractReference, Debugger, JavaMethodWrapper, JavaObjectWrapper, OObject, Reference, Scope, Type

public abstract class Value
extends java.lang.Object
implements java.io.Serializable

The base class of all values in the interpreter. This class provides methods (which throw script-exceptions if not overloaded), so that the interpreter has a handy way of calling the methods needed to evaluate a program. This methods can be overloaded by built-in (ie native java) methods for the built-in types, or via ScriptObject for script types.

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

Field Summary
static boolean DEBUG
           
static java.lang.String[] MEMBER_NAMES
           
static Value NULL
           
static java.lang.String PARENT_TYPE_NAME
           
static BuiltinType TYPE
          The type object for an instance of Value...
static java.lang.String TYPE_NAME
           
static Value UNDEFINED
          Various and asundry special values.
 
Constructor Summary
Value()
          Class Constructor.
 
Method Summary
static Value _getTypeMember(Value type, Value obj, int id)
           
static void _populateTypeMemberSet(Value type, java.util.Set s, boolean d)
           
 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 callAsConstructor(StackFrame sf, Value[] args)
          Deprecated.  
 Value callAsConstructor(Value[] args)
           
 Value callAsExtends(Scope scope, MemberTable args)
           
 Value callAsExtends(StackFrame sf, Scope scope, MemberTable args)
          Call this object as a parent class constructor.
 Value callAsExtends(StackFrame sf, Scope scope, Value[] args)
          Deprecated.  
 Value callAsFunction(StackFrame sf, MemberTable args)
          Call this object as a function.
 Value callAsFunction(StackFrame sf, Value[] args)
          Deprecated.  
 Value callAsFunction(Value[] args)
           
 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.
 Value getMember(int id)
          Get a member of this object.
 Value getMember(int id, boolean exception)
           
 Value getMember(java.lang.String name)
          Get a member of this object.
 Value getMember(java.lang.String name, boolean exception)
          This isn't really part of the public interface, but is provided for the generated wrapper classes.
 Value getMember(Value name)
          Get a member of this object.
 Value getMember(Value name, boolean exception)
           
 java.lang.Object getMonitor()
          Return the object used for implementing synchronized.
 Value getType()
          Get the type of this object.
protected abstract  Value getTypeImpl()
          Get the type of this object.
protected  Value getTypeMember(Value obj, int id)
          Get a member of this type.
protected  Value getTypeMember(Value obj, Value name)
          Deprecated. use other getTypeMember
 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.
protected  PackagedScriptObjectException noSuchMember(java.lang.String member)
           
 void opAssign(Value val)
          Perform assignment.
protected  void populateMemberSet(java.util.Set s, boolean debugger)
          Derived classes that implement getMember(java.lang.String) 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.
 void readExternal(java.io.ObjectInput in)
          Derived class that implements Externalizable must call this if it overrides it, or call #_externalInit from the readExternal(java.io.ObjectInput) method.
 java.lang.String toString()
          Convert this value to a string, for the benefit of java code.
 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.
 void writeExternal(java.io.ObjectOutput out)
          Derived class that implements Externalizable must call this if it overrides it, or call #setType from the readExternal(java.io.ObjectInput) method.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

UNDEFINED

public static final Value UNDEFINED
Various and asundry special values. UNDEFINED is different from NULL in that it is used for un-initialized variables or array entries. A variable or array entry cannot be given the value UNDEFINED, but can be assigned the value NULL.


NULL

public static final Value NULL

TYPE

public static final BuiltinType TYPE
The type object for an instance of Value... value can't really be instantiated, but this is needed internally.


PARENT_TYPE_NAME

public static final java.lang.String PARENT_TYPE_NAME

TYPE_NAME

public static final java.lang.String TYPE_NAME
See Also:
Constant Field Values

MEMBER_NAMES

public static final java.lang.String[] MEMBER_NAMES

DEBUG

public static final boolean DEBUG
See Also:
Constant Field Values
Constructor Detail

Value

public Value()
Class Constructor.

Method Detail

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.

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.

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.

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.

Returns:
the object's type

getTypeImpl

protected abstract 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().

Returns:
the object's type

castToBoolean

public boolean castToBoolean()
                      throws PackagedScriptObjectException
Convert this object to a native java boolean 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.

Returns:
a String value
Throws:
PackagedScriptObjectException(NoSuchMemberException)
PackagedScriptObjectException

castToExactNumber

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

Returns:
a long value
Throws:
PackagedScriptObjectException(NoSuchMemberException)
PackagedScriptObjectException

castToInexactNumber

public double castToInexactNumber()
                           throws PackagedScriptObjectException
Convert this object to a native java double 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.

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)

Parameters:
val - the other value
Returns:
the result
Throws:
PackagedScriptObjectException(NoSuchMemberException)
PackagedScriptObjectException

bopCastR

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

bopInstanceOf

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

Parameters:
val - the other value
Returns:
the result
Throws:
PackagedScriptObjectException(NoSuchMemberException)
PackagedScriptObjectException

bopInstanceOfR

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

bopLogicalOr

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

Parameters:
val - the other value
Returns:
the result
Throws:
PackagedScriptObjectException(NoSuchMemberException)
PackagedScriptObjectException

bopLogicalOrR

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

bopLogicalAnd

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

Parameters:
val - the other value
Returns:
the result
Throws:
PackagedScriptObjectException(NoSuchMemberException)
PackagedScriptObjectException

bopLogicalAndR

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

bopBitwiseOr

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

Parameters:
val - the other value
Returns:
the result
Throws:
PackagedScriptObjectException(NoSuchMemberException)
PackagedScriptObjectException

bopBitwiseOrR

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

bopBitwiseXor

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

Parameters:
val - the other value
Returns:
the result
Throws:
PackagedScriptObjectException(NoSuchMemberException)
PackagedScriptObjectException

bopBitwiseXorR

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

bopBitwiseAnd

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

Parameters:
val - the other value
Returns:
the result
Throws:
PackagedScriptObjectException(NoSuchMemberException)
PackagedScriptObjectException

bopBitwiseAndR

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

bopEquals

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

Parameters:
val - the other value
Returns:
the result
Throws:
PackagedScriptObjectException(NoSuchMemberException)
PackagedScriptObjectException

bopEqualsR

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

bopNotEquals

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

Parameters:
val - the other value
Returns:
the result
Throws:
PackagedScriptObjectException(NoSuchMemberException)
PackagedScriptObjectException

bopNotEqualsR

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

bopLessThan

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

Parameters:
val - the other value
Returns:
the result
Throws:
PackagedScriptObjectException(NoSuchMemberException)
PackagedScriptObjectException

bopLessThanR

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

bopGreaterThan

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

Parameters:
val - the other value
Returns:
the result
Throws:
PackagedScriptObjectException(NoSuchMemberException)
PackagedScriptObjectException

bopGreaterThanR

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

bopLessThanOrEquals

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

Parameters:
val - the other value
Returns:
the result
Throws:
PackagedScriptObjectException(NoSuchMemberException)
PackagedScriptObjectException

bopLessThanOrEqualsR

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

bopGreaterThanOrEquals

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

Parameters:
val - the other value
Returns:
the result
Throws:
PackagedScriptObjectException(NoSuchMemberException)
PackagedScriptObjectException

bopGreaterThanOrEqualsR

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

bopLeftShift

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

Parameters:
val - the other value
Returns:
the result
Throws:
PackagedScriptObjectException(NoSuchMemberException)
PackagedScriptObjectException

bopLeftShiftR

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

bopSignedRightShift

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

Parameters:
val - the other value
Returns:
the result
Throws:
PackagedScriptObjectException(NoSuchMemberException)
PackagedScriptObjectException

bopSignedRightShiftR

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

bopUnsignedRightShift

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

Parameters:
val - the other value
Returns:
the result
Throws:
PackagedScriptObjectException(NoSuchMemberException)
PackagedScriptObjectException

bopUnsignedRightShiftR

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

bopPlus

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

Parameters:
val - the other value
Returns:
the result
Throws:
PackagedScriptObjectException(NoSuchMemberException)
PackagedScriptObjectException

bopPlusR

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

bopMinus

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

Parameters:
val - the other value
Returns:
the result
Throws:
PackagedScriptObjectException(NoSuchMemberException)
PackagedScriptObjectException

bopMinusR

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

bopMultiply

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

Parameters:
val - the other value
Returns:
the result
Throws:
PackagedScriptObjectException(NoSuchMemberException)
PackagedScriptObjectException

bopMultiplyR

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

bopDivide

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

Parameters:
val - the other value
Returns:
the result
Throws:
PackagedScriptObjectException(NoSuchMemberException)
PackagedScriptObjectException

bopDivideR

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

bopRemainder

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

Parameters:
val - the other value
Returns:
the result
Throws:
PackagedScriptObjectException(NoSuchMemberException)
PackagedScriptObjectException

bopRemainderR

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

uopIncrement

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

Returns:
the result
Throws:
PackagedScriptObjectException(NoSuchMemberException)
PackagedScriptObjectException

uopDecrement

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

Returns:
the result
Throws:
PackagedScriptObjectException(NoSuchMemberException)
PackagedScriptObjectException

uopPlus

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

Returns:
the result
Throws:
PackagedScriptObjectException(NoSuchMemberException)
PackagedScriptObjectException

uopMinus

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

Returns:
the result
Throws:
PackagedScriptObjectException(NoSuchMemberException)
PackagedScriptObjectException

uopBitwiseNot

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

Returns:
the result
Throws:
PackagedScriptObjectException(NoSuchMemberException)
PackagedScriptObjectException

uopLogicalNot

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

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.

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.

Parameters:
sf - the current stack frame
args - the arguments to the function, or null if none
Returns:
the value returned by the function
Throws:
PackagedScriptObjectException
See Also:
Function

callAsFunction

public final Value callAsFunction(Value[] args)
                           throws PackagedScriptObjectException
Throws:
PackagedScriptObjectException

callAsFunction

public final Value callAsFunction(StackFrame sf,
                                  Value[] args)
Deprecated.  


callAsConstructor

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

Parameters:
sf - the current stack frame
args - the arguments to the function, or null if none
Returns:
the newly constructed object
Throws:
PackagedScriptObjectException
See Also:
Function

callAsConstructor

public final Value callAsConstructor(Value[] args)
                              throws PackagedScriptObjectException
Throws:
PackagedScriptObjectException

callAsConstructor

public final Value callAsConstructor(StackFrame sf,
                                     Value[] args)
Deprecated.  


callAsExtends

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

Parameters:
sf - the current stack frame
scope - the object
args - the arguments to the function, or null if none
Returns:
the value returned by the function
Throws:
PackagedScriptObjectException
See Also:
Function

callAsExtends

public final Value callAsExtends(Scope scope,
                                 MemberTable args)
                          throws PackagedScriptObjectException
Throws:
PackagedScriptObjectException

callAsExtends

public final Value callAsExtends(StackFrame sf,
                                 Scope scope,
                                 Value[] args)
Deprecated.  


getMember

public final Value getMember(java.lang.String name)
                      throws PackagedScriptObjectException
Get a member of this object. This method is provided for convenience.

Parameters:
name - the name of the member
Returns:
a reference to the member
Throws:
PackagedScriptObjectException(NoSuchMemberException)
PackagedScriptObjectException
See Also:
populateMemberSet(java.util.Set, boolean)

getMember

public Value getMember(Value name)
                throws PackagedScriptObjectException
Get a member of this object.

Parameters:
name - the name of the member
Returns:
a reference to the member
Throws:
PackagedScriptObjectException(NoSuchMemberException)
PackagedScriptObjectException
See Also:
populateMemberSet(java.util.Set, boolean)

getMember

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

Parameters:
id - the id of the symbol that maps to the member
Returns:
a reference to the member
Throws:
PackagedScriptObjectException(NoSuchMemberException)
PackagedScriptObjectException
See Also:
populateMemberSet(java.util.Set, boolean)

getMember

public final Value getMember(java.lang.String name,
                             boolean exception)
                      throws PackagedScriptObjectException
This isn't really part of the public interface, but is provided for the generated wrapper classes.

Throws:
PackagedScriptObjectException

getMember

public final Value getMember(Value name,
                             boolean exception)
                      throws PackagedScriptObjectException
Throws:
PackagedScriptObjectException

getMember

public Value getMember(int id,
                       boolean exception)
                throws PackagedScriptObjectException
Throws:
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.

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:
populateTypeMemberSet(java.util.Set, boolean)

_getTypeMember

public static Value _getTypeMember(Value type,
                                   Value obj,
                                   int id)

_populateTypeMemberSet

public static void _populateTypeMemberSet(Value type,
                                          java.util.Set s,
                                          boolean d)

getTypeMember

protected final Value getTypeMember(Value obj,
                                    Value name)
Deprecated. use other getTypeMember


length

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

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.

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.

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 java.util.Set memberSet()
Returns the names of the members of this object.

Returns:
a collection view of the names of the members of this object

populateMemberSet

protected void populateMemberSet(java.util.Set s,
                                 boolean debugger)
Derived classes that implement getMember(java.lang.String) should also implement this.

Parameters:
s - the set to populate
debugger - true if being used by debugger, in which case both public and private/protected field names should be returned
See Also:
getMember(java.lang.String)

populateTypeMemberSet

protected void populateTypeMemberSet(java.util.Set s,
                                     boolean debugger)
Derived classes that implement getTypeMember(oscript.data.Value, int) should also implement this.

Parameters:
s - the set to populate
debugger - true if being used by debugger, in which case both public and private/protected field names should be returned
See Also:
getTypeMember(oscript.data.Value, int)

toString

public java.lang.String toString()
Convert this value to a string, for the benefit of java code.

Returns:
a string

noSuchMember

protected PackagedScriptObjectException noSuchMember(java.lang.String member)

readExternal

public void readExternal(java.io.ObjectInput in)
                  throws java.lang.ClassNotFoundException,
                         java.io.IOException
Derived class that implements Externalizable must call this if it overrides it, or call #_externalInit from the readExternal(java.io.ObjectInput) method. This class doesn't (yet!) implement Externalizable because that would force all subclasses to implement it too (ie. override this methods).

Throws:
java.lang.ClassNotFoundException
java.io.IOException

writeExternal

public void writeExternal(java.io.ObjectOutput out)
                   throws java.io.IOException
Derived class that implements Externalizable must call this if it overrides it, or call #setType from the readExternal(java.io.ObjectInput) method. This class doesn't (yet!) implement Externalizable because that would force all subclasses to implement it too (ie. override this methods).

Throws:
java.io.IOException