|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objecttcl.lang.TclList
public class TclList
This class implements the list object type in Tcl.
Method Summary | |
---|---|
static void |
append(Interp interp,
TclObject tobj,
TclObject elemObj)
Tcl_ListObjAppendElement -> TclList.append() Appends a TclObject element to a list object. |
static void |
append(Interp interp,
TclObject tobj,
TclObject[] objv,
int startIdx,
int endIdx)
TclList.append() Appends multiple TclObject elements to a list object. |
static TclObject |
copy(Interp interp,
TclObject list)
copy (TclListObjCopy) -- Makes a "pure list" copy of a list value. |
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 ArrayList |
getElementsList(Interp interp,
TclObject tobj)
Returns an ArrayList of TclObject 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 void |
insert(Interp interp,
TclObject tobj,
int index,
TclObject[] elements,
int from,
int to)
This procedure inserts the elements in elements[] into the list at the given index. |
static void |
lsetElement(Interp interp,
TclObject list,
int index,
TclObject value)
TclListObjSetElement -- Set a single element of a list to a specified value in place (LsetCmd) Side effects: Tcl_Panic if listPtr designates a shared object. |
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. |
static void |
setElement(Interp interp,
TclObject list,
int index,
TclObject value)
TclListObjSetElement -- Set a single element of a list to a specified value Side effects: Tcl_Panic if listPtr designates a shared object. |
static void |
sort(Interp interp,
TclObject tobj,
int sortMode,
int sortIndex,
boolean sortIncreasing,
boolean unique,
String command)
Sorts the list according to the sort mode and (optional) sort command. |
String |
toString()
Called to query the string representation of the Tcl object. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Method Detail |
---|
public void dispose()
dispose
in interface InternalRep
public InternalRep duplicate()
duplicate
in interface InternalRep
public String toString()
toString
in class Object
public static TclObject newInstance()
public static TclObject copy(Interp interp, TclObject list)
interp
- Used to report errors if not null.list
- List object for which an element array is to be returned.
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 void append(Interp interp, TclObject tobj, TclObject[] objv, int startIdx, int endIdx) throws TclException
interp
- current interpreter.tobj
- the TclObject to append elements to.objv
- array containing elements to append.startIdx
- index to start appending values fromendIdx
- index to stop appending values at
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 ArrayList getElementsList(Interp interp, TclObject tobj) throws TclException
Note that the actual internal ArrayList of a TclList object is returned, so be careful when changing the list.
interp
- the current interpreter.tobj
- the list to sort.
TclException
- if tobj is not a valid list.public static void setElement(Interp interp, TclObject list, int index, TclObject value) throws TclException
interp
- Tcl interpreter; used for error reporting if not nulllist
- List object in which element should be storedindex
- Index of element to storevalue
- Tcl object to store in the designated list element
TclException
public static void lsetElement(Interp interp, TclObject list, int index, TclObject value) throws TclException
interp
- Tcl interpreter; used for error reporting if not nulllist
- List object in which element should be storedindex
- Index of element to storevalue
- Tcl object to store in the designated list element
TclException
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 insert(Interp interp, TclObject tobj, int index, 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 insertion operation. <=0 means the
beginning of the list. >= TclList.getLength(tobj) means the
end of the list.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.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.public static void sort(Interp interp, TclObject tobj, int sortMode, int sortIndex, boolean sortIncreasing, boolean unique, String command) throws TclException
interp
- the current interpreter.tobj
- the list to sort.sortMode
- the sorting mode.sortIncreasing
- true if to sort the elements in increasing order.unique
- true if only the last set of duplicate elements found in the
list have to be retainedcommand
- the command to compute the order of two elements.
TclException
- if tobj is not a valid list.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |