All Packages Class Hierarchy This Package Previous Next Index
Class nsjava.internal.TclList
java.lang.Object
|
+----nsjava.internal.TclList
- public class TclList
- extends Object
- implements InternalRep
This class implements the list object type in Tcl.
-
append(TclObject, TclObject)
- Appends a list element to a TclObject object.
-
dispose()
- Called to free any storage for the type's internal rep.
-
duplicate()
- Returns a dupilcate of the current object.
-
getElements(TclObject)
- Returns a TclObject array of the elements in a list object.
-
getLength(TclObject)
- Queries the length of the list.
-
getStringArray(TclObject)
- Returns a String array of the elements in a list object.
-
index(TclObject, int)
- This procedure returns a pointer to the index'th object from
the list referenced by tobj.
-
newInstance()
- Creates a new instance of a TclObject with a TclList internal
rep.
-
replace(TclObject, int, int, TclObject[], int, int)
- This procedure replaces zero or more elements of the list
referenced by tobj with the objects from an TclObject array.
-
toString()
- Called to query the string representation of the Tcl object.
dispose
public void dispose()
- Called to free any storage for the type's internal rep.
- Parameters:
- obj - the TclObject that contains this internalRep.
duplicate
public InternalRep duplicate() throws TclException
- Returns a dupilcate of the current object.
- Parameters:
- obj - the TclObject that contains this internalRep.
- Throws: TclException
- thrown for usage errors
toString
public String toString() throws TclRuntimeError
- Called to query the string representation of the Tcl object. This
method is called only by TclObject.toString() when
TclObject.stringRep is null.
- Returns:
- the string representation of the Tcl object.
- Overrides:
- toString in class Object
newInstance
public static TclObject newInstance()
- Creates a new instance of a TclObject with a TclList internal
rep.
- Returns:
- the TclObject with the given list value.
append
public static final void append(TclObject tobj,
TclObject elemObj) throws TclException
- Appends a list element to a TclObject object. This method is
equivalent to Tcl_ListObjAppendElement in Tcl 8.0.
- Parameters:
- interp - current interpreter.
- tobj - the TclObject to append an element to.
- elemObj - the element to append to the object.
- Throws: TclException
- if tobj cannot be converted into a list.
getLength
public static final int getLength(TclObject tobj) throws TclException
- Queries the length of the list. If tobj is not a list object,
an attempt will be made to convert it to a list.
- Parameters:
- interp - current interpreter.
- tobj - the TclObject to use as a list.
- Returns:
- the length of the list.
- Throws: TclException
- if tobj is not a valid list.
getElements
public static TclObject[] getElements(TclObject tobj) throws TclException
- Returns a TclObject array of the elements in a list object. If
tobj is not a list object, an attempt will be made to convert
it to a list.
The objects referenced by the returned array should be treated
as readonly and their ref counts are _not_ incremented; the
caller must do that if it holds on to a reference.
- Parameters:
- interp - the current interpreter.
- tobj - the list to sort.
- Returns:
- a TclObject array of the elements in a list object.
- Throws: TclException
- if tobj is not a valid list.
getStringArray
public static String[] getStringArray(TclObject tobj) throws TclException
- Returns a String array of the elements in a list object. If
tobj is not a list object, an attempt will be made to convert
it to a list.
- Parameters:
- tobj - the list to sort.
- Returns:
- a TclObject array of the elements in a list object.
- Throws: TclException
- if tobj is not a valid list.
index
public static final TclObject index(TclObject tobj,
int index) throws TclException
- This procedure returns a pointer to the index'th object from
the list referenced by tobj. The first element has index
0. If index is negative or greater than or equal to the number
of elements in the list, a null is returned. If tobj is not a
list object, an attempt will be made to convert it to a list.
- Parameters:
- interp - current interpreter.
- tobj - the TclObject to use as a list.
- index - the index of the requested element.
- Returns:
- the the requested element.
- Throws: TclException
- if tobj is not a valid list.
replace
public static final void replace(TclObject tobj,
int index,
int count,
TclObject elements[],
int from,
int to) throws TclException
- This procedure replaces zero or more elements of the list
referenced by tobj with the objects from an TclObject array.
If tobj is not a list object, an attempt will be made to
convert it to a list.
- Parameters:
- interp - current interpreter.
- tobj - the TclObject to use as a list.
- index - the starting index of the replace operation. <=0 means
the beginning of the list. >= TclList.getLength(tobj) means
the end of the list.
- count - the number of elements to delete from the list. <=0 means
no elements should be deleted and the operation is equivalent to
an insertion operation.
- elements - the element(s) to insert.
- from - insert elements starting from elements[from] (inclusive)
- to - insert elements up to elements[to] (inclusive)
- Throws: TclException
- if tobj is not a valid list.
All Packages Class Hierarchy This Package Previous Next Index