Tea Java Runtime API
Version 3.1.0

com.pdmfc.tea.runtime
Class STypes

java.lang.Object
  |
  +--com.pdmfc.tea.runtime.STypes

public class STypes
extends java.lang.Object

Utility methods for handling Java objects corresponding to Tea basic types.


Method Summary
static SObjBlock getBlock(java.lang.Object[] args, int index)
          Tries to convert argument index into a SObjBlock.
static java.lang.Boolean getBoolean(java.lang.Object[] args, int index)
          This is an utility method, to be used by derived classes.
static java.lang.Double getFloat(java.lang.Object[] args, int index)
          This is an utility method, to be used by derived classes.
static SObjFunction getFunction(SContext context, java.lang.Object[] args, int index)
          This is an utility method, to be used by derived classes.
static java.lang.Integer getInt(java.lang.Object[] args, int index)
          This is an utility method, to be used by derived classes.
static java.lang.Number getNumber(java.lang.Object[] args, int index)
          This is an utility method, to be used by derived classes.
static SObjPair getPair(java.lang.Object[] args, int index)
          Tries to convert argument index into a SObjPair.
static java.lang.String getString(java.lang.Object[] args, int index)
          This is an utility method, to be used by derived classes.
static SObjSymbol getSymbol(java.lang.Object[] args, int index)
          This is an utility method, to be used by derived classes.
static java.lang.String getTypeName(java.lang.Class aClass)
          Retrives a description for the type given as argument.
static java.lang.String getTypeName(java.lang.Object obj)
          Retrives a description for the type of the object given as argument.
static java.lang.Object getVarWithEffort(SContext context, SObjSymbol name)
          Invokes a Tea function stored in the "TEA_NOFUNC_CALLBACK" and then tries to retrieve the variable referenced by the symbol name.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getTypeName

public static java.lang.String getTypeName(java.lang.Object obj)
Retrives a description for the type of the object given as argument. This description should not be used as an identifier for the object type. It is only meant to be used in text messages.
Parameters:
obj - The object for wich a type description is sought.
Returns:
A string with a description for the type of the object received as argument.

getTypeName

public static java.lang.String getTypeName(java.lang.Class aClass)
Retrives a description for the type given as argument. This description should not be used as an identifier for the type. It is only meant to be used in text messages.
Parameters:
aClass - The type for wich a description is sought.
Returns:
A string with a description for the type received as argument.

getBlock

public static SObjBlock getBlock(java.lang.Object[] args,
                                 int index)
                          throws STeaException
Tries to convert argument index into a SObjBlock. If that argument is not a block, an exception is thrown.
Parameters:
args - Array of Object, supposed to be the arguments received by a call to the command.
index - The index of the argument to convert.
Throws:
STeaException - Thrown if args[index] is not a SObjBlock.

getPair

public static SObjPair getPair(java.lang.Object[] args,
                               int index)
                        throws STeaException
Tries to convert argument index into a SObjPair. If that argument is not a pair, an exception is thrown.
Parameters:
args - Array of Object, supposed to be the arguments received by a call to the command.
index - The index of the argument to convert.
Throws:
STeaException - Thrown if args[index] is not a SObjPair.

getSymbol

public static SObjSymbol getSymbol(java.lang.Object[] args,
                                   int index)
                            throws STypeException
This is an utility method, to be used by derived classes. It tries to convert argument index into a SObjSymbol. If that argument is not a pair, an exception is thrown.
Parameters:
args - Array of Object, supposed to be the arguments received by a call to the command.
index - The index of the argument to convert.
Throws:
com.pdmfc.tea.STypeException - Thrown if args[index] is not a SObjSymbol.

getNumber

public static java.lang.Number getNumber(java.lang.Object[] args,
                                         int index)
                                  throws STeaException
This is an utility method, to be used by derived classes. It tries to convert argument index into a SObjNumeric. If that argument is not an int, an exception is thrown.
Parameters:
args - Array of Object, supposed to be the arguments received by a call to the command.
index - The index of the argument to convert.
Throws:
STeaException - Thrown if args[index] is not a SObjNumeric.

getInt

public static java.lang.Integer getInt(java.lang.Object[] args,
                                       int index)
                                throws STypeException
This is an utility method, to be used by derived classes. It tries to convert argument index into a SObjInt. If that argument is not an int, an exception is thrown.
Parameters:
args - Array of Object, supposed to be the arguments received by a call to the command.
index - The index of the argument to convert.
Throws:
com.pdmfc.tea.STypeException - Thrown if args[index] is not an SObjInt.

getFloat

public static java.lang.Double getFloat(java.lang.Object[] args,
                                        int index)
                                 throws STypeException
This is an utility method, to be used by derived classes. It tries to convert argument index into a SObjFloat. If that argument is not a float, an exception is thrown.
Parameters:
args - Array of Object, supposed to be the arguments received by a call to the command.
index - The index of the argument to convert.
Throws:
com.pdmfc.tea.STypeException - Thrown if args[index] is not a SObjFloat.

getBoolean

public static java.lang.Boolean getBoolean(java.lang.Object[] args,
                                           int index)
                                    throws STypeException
This is an utility method, to be used by derived classes. It tries to convert argument index into a SObjBool. If that argument is not a boolean, an exception is thrown.
Parameters:
args - Array of Object, supposed to be the arguments received by a call to the command.
index - The index of the argument to convert.
Throws:
com.pdmfc.tea.STypeException - Thrown if args[index] is not a java.lang.Boolean.

getString

public static java.lang.String getString(java.lang.Object[] args,
                                         int index)
                                  throws STypeException
This is an utility method, to be used by derived classes. It tries to convert argument index into a SObjString. If that argument is not an int, an exception is thrown.
Parameters:
args - Array of Object, supposed to be the arguments received by a call to the command.
index - The index of the argument to convert.
Throws:
com.pdmfc.tea.STypeException - Thrown if args[index] is not an SObjString.

getFunction

public static SObjFunction getFunction(SContext context,
                                       java.lang.Object[] args,
                                       int index)
                                throws STeaException
This is an utility method, to be used by derived classes. It tries to convert argument index into a SObjFunction. If args[index] is a SObjFunction then everything is fine. If args[index] is a SObjSymbol then a variable with the some name is searched in context. If it does not exists or if it does not contain a SObjFunction an exception is thrown.
Parameters:
args - Array of Object, supposed to be the arguments received by a call to the command.
index - The index of the argument to convert.
Throws:
STeaException - Thrown if args[index] is neither a SObjFunction nor a SObjSymbol

getVarWithEffort

public static java.lang.Object getVarWithEffort(SContext context,
                                                SObjSymbol name)
                                         throws STeaException
Invokes a Tea function stored in the "TEA_NOFUNC_CALLBACK" and then tries to retrieve the variable referenced by the symbol name.
Parameters:
context - The context where the variable will be searched for.
name - The symbol referencing the variable we are looking for.
Returns:
The object stored in the variable.
Throws:
SNoSuchVarException - Throw if the variable does not exit before and after the Tea function is run.

Tea Java Runtime API
Version 3.1.0

© 2002 PDM&FC, All Rights Reserved.