Tea Java Runtime API
Version 3.2.4

com.pdmfc.tea.modules.util
Class SVector

java.lang.Object
  extended by com.pdmfc.tea.modules.tos.STosObj
      extended by com.pdmfc.tea.modules.util.SVector
All Implemented Interfaces:
SObjFunction

public class SVector
extends STosObj

Represents a TOS object acting like a vector. The elements are actually stored in an underlying java.util.List. This java.util.List can either be internally created or supplied from the outside.


Constructor Summary
SVector(STosClass myClass)
          Initializes the object internal state.
 
Method Summary
 java.lang.Object append(SObjFunction obj, SContext context, java.lang.Object[] args)
          The implementation for the "append" TOS method.
 java.lang.Object clear(SObjFunction obj, SContext context, java.lang.Object[] args)
          The implementation for the "clear" TOS method.
 java.lang.Object constructor(SObjFunction obj, SContext context, java.lang.Object[] args)
          The implementation for the "constructor" TOS method.
 java.lang.Object getAt(SObjFunction obj, SContext context, java.lang.Object[] args)
          The implementation for the "getAt" TOS method.
 java.lang.Object getElements(SObjFunction obj, SContext context, java.lang.Object[] args)
          The implementation for the "getElements" TOS method.
 java.util.List getInternalList()
          Fetches the java.util.List used to store the vector elements.
 java.lang.Object getSize(SObjFunction obj, SContext context, java.lang.Object[] args)
          The implementation for the "getSize" TOS method.
static java.lang.String getTosClassName()
          Retrieves the recomended name for the TOS class.
 java.lang.Object init(SObjFunction obj, SContext context, java.lang.Object[] args)
          The implementation for the "init" TOS method.
static SVector newInstance(SContext context)
          Creates a TOS TVector instance.
static SVector newInstance(SContext context, java.util.List contents)
          Creates a TOS TVector instance and supplies the java.util.List used to store the vector elements.
 java.lang.Object pop(SObjFunction obj, SContext context, java.lang.Object[] args)
          The implementation for the "pop" TOS method.
 java.lang.Object push(SObjFunction obj, SContext context, java.lang.Object[] args)
          The implementation for the "push" TOS method.
 java.lang.Object resize(SObjFunction obj, SContext context, java.lang.Object[] args)
          The implementation for the "resize" TOS method.
 java.lang.Object setAt(SObjFunction obj, SContext context, java.lang.Object[] args)
          The implementation for the "setAt" TOS method.
 java.lang.Object sort(SObjFunction obj, SContext context, java.lang.Object[] args)
          The implementation for the "sort" TOS method.
 
Methods inherited from class com.pdmfc.tea.modules.tos.STosObj
exec, getTosClass, init, part, selfObj
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SVector

public SVector(STosClass myClass)
        throws STeaException
Initializes the object internal state. The TOS class assigned to this object is supposed to generate instances of TOS objects that are SVector instances.

Parameters:
myClass - The TOS class to assign to the TOS objects.
Throws:
STeaException
Method Detail

getInternalList

public java.util.List getInternalList()
Fetches the java.util.List used to store the vector elements. This java.util.List may be modified at will. Nevertheless, concurrent use from within multiple threads must be avoided.

Returns:
The java.util.List used to store the vector elements.

constructor

public java.lang.Object constructor(SObjFunction obj,
                                    SContext context,
                                    java.lang.Object[] args)
                             throws SRuntimeException
The implementation for the "constructor" TOS method.

Parameters:
obj - Reference to the object the TOS method was invoked for.
context - The context where the method invocation is taking place.
args - The arguments the TOS method was called with.
Throws:
SRuntimeException

push

public java.lang.Object push(SObjFunction obj,
                             SContext context,
                             java.lang.Object[] args)
                      throws SRuntimeException
The implementation for the "push" TOS method.

Parameters:
obj - Reference to the object the TOS method was invoked for.
context - The context where the method invocation is taking place.
args - The arguments the TOS method was called with.
Throws:
SRuntimeException

append

public java.lang.Object append(SObjFunction obj,
                               SContext context,
                               java.lang.Object[] args)
                        throws SRuntimeException
The implementation for the "append" TOS method.

Parameters:
obj - Reference to the object the TOS method was invoked for.
context - The context where the method invocation is taking place.
args - The arguments the TOS method was called with.
Throws:
SRuntimeException

init

public java.lang.Object init(SObjFunction obj,
                             SContext context,
                             java.lang.Object[] args)
The implementation for the "init" TOS method.

Parameters:
obj - Reference to the object the TOS method was invoked for.
context - The context where the method invocation is taking place.
args - The arguments the TOS method was called with.

getSize

public java.lang.Object getSize(SObjFunction obj,
                                SContext context,
                                java.lang.Object[] args)
The implementation for the "getSize" TOS method.

Parameters:
obj - Reference to the object the TOS method was invoked for.
context - The context where the method invocation is taking place.
args - The arguments the TOS method was called with.

resize

public java.lang.Object resize(SObjFunction obj,
                               SContext context,
                               java.lang.Object[] args)
                        throws SRuntimeException
The implementation for the "resize" TOS method.

Parameters:
obj - Reference to the object the TOS method was invoked for.
context - The context where the method invocation is taking place.
args - The arguments the TOS method was called with.
Throws:
SRuntimeException

getAt

public java.lang.Object getAt(SObjFunction obj,
                              SContext context,
                              java.lang.Object[] args)
                       throws SRuntimeException
The implementation for the "getAt" TOS method.

Parameters:
obj - Reference to the object the TOS method was invoked for.
context - The context where the method invocation is taking place.
args - The arguments the TOS method was called with.
Throws:
SRuntimeException

setAt

public java.lang.Object setAt(SObjFunction obj,
                              SContext context,
                              java.lang.Object[] args)
                       throws SRuntimeException
The implementation for the "setAt" TOS method.

Parameters:
obj - Reference to the object the TOS method was invoked for.
context - The context where the method invocation is taking place.
args - The arguments the TOS method was called with.
Throws:
SRuntimeException

getElements

public java.lang.Object getElements(SObjFunction obj,
                                    SContext context,
                                    java.lang.Object[] args)
The implementation for the "getElements" TOS method.

Parameters:
obj - Reference to the object the TOS method was invoked for.
context - The context where the method invocation is taking place.
args - The arguments the TOS method was called with.

pop

public java.lang.Object pop(SObjFunction obj,
                            SContext context,
                            java.lang.Object[] args)
                     throws SRuntimeException
The implementation for the "pop" TOS method.

Parameters:
obj - Reference to the object the TOS method was invoked for.
context - The context where the method invocation is taking place.
args - The arguments the TOS method was called with.
Throws:
SRuntimeException

clear

public java.lang.Object clear(SObjFunction obj,
                              SContext context,
                              java.lang.Object[] args)
The implementation for the "clear" TOS method.

Parameters:
obj - Reference to the object the TOS method was invoked for.
context - The context where the method invocation is taking place.
args - The arguments the TOS method was called with.

sort

public java.lang.Object sort(SObjFunction obj,
                             SContext context,
                             java.lang.Object[] args)
                      throws STeaException
The implementation for the "sort" TOS method.

Parameters:
obj - Reference to the object the TOS method was invoked for.
context - The context where the method invocation is taking place.
args - The arguments the TOS method was called with.
Throws:
STeaException

getTosClassName

public static java.lang.String getTosClassName()
Retrieves the recomended name for the TOS class. This method is expected to exist when the TOS class is loaded into a Tea runtime by calling the Tea "load-class" method.

Returns:
The name for the TOS class.

newInstance

public static SVector newInstance(SContext context)
                           throws STeaException
Creates a TOS TVector instance. The context is used to retrieve the TOS class object to assign to the TVector.

The internal java.util.List where the vector elements will be stored is automatically created.

Parameters:
context - The context where the TVector instance is being created.
Returns:
A newly created and initialized SVector.
Throws:
STeaException

newInstance

public static SVector newInstance(SContext context,
                                  java.util.List contents)
                           throws STeaException
Creates a TOS TVector instance and supplies the java.util.List used to store the vector elements.

Parameters:
context - The context where the TVector instance is being created.
contents - The java.util.List that will be used to store the vector elements.
Returns:
A newly created and initialized SVector.
Throws:
STeaException

Tea Java Runtime API
Version 3.2.4

© 2009 PDM&FC, All Rights Reserved.