public class TclList extends java.lang.Object implements InternalRep
Modifier and Type | Method and Description |
---|---|
static void |
append(Interp interp,
TclObject tobj,
TclObject elemObj)
Tcl_ListObjAppendElement -> TclList.append()
Appends a TclObject element to a list object.
|
void |
dispose()
Called to free any storage for the type's internal rep.
|
InternalRep |
duplicate()
DupListInternalRep -> duplicate
Returns a dupilcate of the current object.
|
static TclObject[] |
getElements(Interp interp,
TclObject tobj)
Returns a TclObject array of the elements in a list object.
|
static int |
getLength(Interp interp,
TclObject tobj)
Queries the length of the list.
|
static TclObject |
index(Interp interp,
TclObject tobj,
int index)
This procedure returns a pointer to the index'th object from
the list referenced by tobj.
|
static TclObject |
newInstance()
Creates a new instance of a TclObject with a TclList internal
rep.
|
static void |
replace(Interp interp,
TclObject tobj,
int index,
int count,
TclObject[] elements,
int from,
int to)
This procedure replaces zero or more elements of the list
referenced by tobj with the objects from an TclObject array.
|
java.lang.String |
toString()
Called to query the string representation of the Tcl object.
|
public void dispose()
dispose
in interface InternalRep
public InternalRep duplicate()
duplicate
in interface InternalRep
public java.lang.String toString()
toString
in class java.lang.Object
public static TclObject newInstance()
public static final void append(Interp interp, TclObject tobj, TclObject elemObj) throws TclException
interp
- current interpreter.tobj
- the TclObject to append an element to.elemObj
- the element to append to the object.TclException
- if tobj cannot be converted into a list.public static final int getLength(Interp interp, TclObject tobj) throws TclException
interp
- current interpreter.tobj
- the TclObject to use as a list.TclException
- if tobj is not a valid list.public static TclObject[] getElements(Interp interp, TclObject tobj) throws TclException
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.
interp
- the current interpreter.tobj
- the list to sort.TclException
- if tobj is not a valid list.public static final TclObject index(Interp interp, TclObject tobj, int index) throws TclException
interp
- current interpreter.tobj
- the TclObject to use as a list.index
- the index of the requested element.TclException
- if tobj is not a valid list.public static final void replace(Interp interp, TclObject tobj, int index, int count, TclObject[] elements, int from, int to) throws TclException
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)TclException
- if tobj is not a valid list.