<HTML><HEAD><TITLE>TclJava Library Procedures - TclList manual page</TITLE></HEAD><BODY>
<DL>
<DD><A HREF="TclList.htm#M2" NAME="L194">CLASS</A>
<DL><DD>tcl.lang.TclList -- This class is used to create, modify and read from Tcl list
objects.</DL>
<DD><A HREF="TclList.htm#M3" NAME="L195">IMPLEMENTS</A>
<DL><DD>tcl.lang.InternalRep
</DL>
<DD><A HREF="TclList.htm#M4" NAME="L196">METHODS</A>
<DL><DD>static TclObject <B>newInstance</B>()</DL>
<DL><DD>static void <B>append</B>(Interp <I>interp</I>, TclObject <I>tobj</I>, TclObject <I>elem</I>) throws TclException</DL>
<DL><DD>static int <B>getLength</B>(Interp <I>interp</I>, TclObject <I>tobj</I>) throws TclException</DL>
<DL><DD>static TclObject[ ] <B>getElements</B>(Interp <I>interp</I>, TclObject <I>tobj</I>) throws TclException</DL>
<DL><DD>static TclObject <B>index</B>(Interp <I>interp</I>, TclObject <I>tobj</I>, int <I>index</I>) throws TclException</DL>
<DL><DD>static void <B>replace</B>(Interp <I>interp</I>, TclObject <I>tobj</I>, int <I>index</I>, int <I>count</I>, TclObject <I>elts[]</I>, int <I>from</I>, int <I>to</I>)</DL>
<DD><A HREF="TclList.htm#M5" NAME="L197">ARGUMENTS</A>
<DL>
</DL>
<DD><A HREF="TclList.htm#M6" NAME="L198">DESCRIPTION</A>
<DL>
<DD><A HREF="TclList.htm#M7" NAME="L199"><B>newInstance</B></A>
<DD><A HREF="TclList.htm#M8" NAME="L200"><B>append</B></A>
<DD><A HREF="TclList.htm#M9" NAME="L201"><B>getLength</B></A>
<DD><A HREF="TclList.htm#M10" NAME="L202"><B>getElements</B></A>
<DD><A HREF="TclList.htm#M11" NAME="L203"><B>index</B></A>
<DD><A HREF="TclList.htm#M12" NAME="L204"><B>replace</B></A>
</DL>
<DD><A HREF="TclList.htm#M13" NAME="L205">EQUIVALENT C FUNCTIONS</A>
<DD><A HREF="TclList.htm#M14" NAME="L206">SEE ALSO</A>
</DL><HR>
<H3><A NAME="M2">CLASS</A></H3>
tcl.lang.TclList -- This class is used to create, modify and read from Tcl list
objects.
<H3><A NAME="M3">IMPLEMENTS</A></H3>
tcl.lang.InternalRep

<H3><A NAME="M4">METHODS</A></H3>
<P>static TclObject <B>newInstance</B>()
<P>static void <B>append</B>(Interp <I>interp</I>, TclObject <I>tobj</I>, TclObject <I>elem</I>) throws TclException
<P>static int <B>getLength</B>(Interp <I>interp</I>, TclObject <I>tobj</I>) throws TclException
<P>static TclObject[ ] <B>getElements</B>(Interp <I>interp</I>, TclObject <I>tobj</I>) throws TclException
<P>static TclObject <B>index</B>(Interp <I>interp</I>, TclObject <I>tobj</I>, int <I>index</I>) throws TclException
<P>static void <B>replace</B>(Interp <I>interp</I>, TclObject <I>tobj</I>, int <I>index</I>, int <I>count</I>, TclObject <I>elts[]</I>, int <I>from</I>, int <I>to</I>)
<H3><A NAME="M5">ARGUMENTS</A></H3>
<DL>
<P><DT>Interp <B>interp</B><DD>
If an error occurs while converting an object to be a list object,
an error message is left in the interpreter's result object
unless <I>interp</I> is null.
<P><DT>TclObject <B>tobj</B><DD>
Points to the list object to be manipulated.
If <I>tobj</I> does not already point to a list object,
an attempt will be made to convert it to one.
<P><DT>TclObject <B>elem</B><DD>
Points to a list object containing elements to be appended onto <I>tobj</I>.
<P><DT>TclObject <B>elts[]</B><DD>
An array of TclObjects to reaplace those in the list object <I>tobj</I>.
<P><DT>int <B>index</B><DD>
The index of the element of <I>tobj</I> in question.
<P><DT>int <B>count</B><DD>
The number of elements of the <I>tobj</I> to replace.
<P><DT>int <B>from</B><DD>
The index of the first replacement element in <I>elts</I>.
<P><DT>int <B>to</B><DD>
The index of the last replacement element in <I>elts</I>.
<P></DL>
<H3><A NAME="M6">DESCRIPTION</A></H3>
The TclList class is used to create, modify and read from Tcl list
objects. All of the methods defined below attempt to change the
internal representation of <I>tobj</I> parameters to TclList. If such a
conversion fails (e.g., the string value of <I>tobj</I> is not a proper Tcl
list), a TclException is thrown, and an appropriate error message
is left in <I>interp</I>'s result if <I>interp</I> is not null.
<P>
Tcl list objects have an internal representation that supports
the efficient indexing and appending.
The procedures described in this man page are used to
create, modify, index, and append to Tcl list objects from Java code.
In all cases where <I>tobj</I> is an argument, if <I>tobj</I> is not a
TclList, then an attempt is made to convert it to a TclList.  If
the attempt fails, a TclException is thrown.
<P>
<DL>
<P><DT><A NAME="M7"><B>newInstance</B></A><DD>
The <B>newInstance</B> method creates and returns a new empty TclList.
<P><DT><A NAME="M8"><B>append</B></A><DD>
The <B>append</B> method adds one object, <I>elem</I>, to the end of the list
object referenced by <I>tobj</I>.  After appending the element,
<B>append</B> increments the element's reference count since <I>tobj</I>
now also refers to it.
<P><DT><A NAME="M9"><B>getLength</B></A><DD>
The <B>getLength</B> method returns the number of elements in <I>tobj</I>.
<P><DT><A NAME="M10"><B>getElements</B></A><DD>
The <B>getElements</B> method converts the TclList <I>tobj</I> to an array of
TclObjects.  The objects referenced by the returned array should be
treated as readonly, and their ref counts are not incremented.
<P><DT><A NAME="M11"><B>index</B></A><DD>
The <B>index</B> method returns a pointer to the <I>index</I>th element of
<I>tobj</I>.  If <I>index</I> is negative or greater than or equal to
the number of elements in the list, null is returned.
<P><DT><A NAME="M12"><B>replace</B></A><DD>
The <B>replace</B> mehtod replaces zero or more elements of the list referenced by
<I>tobj</I> with the objects in <I>elts</I> ranging from <I>from</I> to
<I>to</I>.

<P></DL>
<H3><A NAME="M13">EQUIVALENT C FUNCTIONS</A></H3>
<A href="../cFunctions.html">Tcl_NewListObj</A>, <A href="../cFunctions.html">Tcl_ListObjAppendList</A>, <A href="../cFunctions.html">Tcl_ListObjLength</A>, <A href="../cFunctions.html">Tcl_ListObjGetElements</A>, <A href="../cFunctions.html">Tcl_ListObjIndex</A>, <A href="../cFunctions.html">Tcl_ListObjReplace</A>
<H3><A NAME="M14">SEE ALSO</A></H3>
<B><A HREF="../TclJavaLib/InternalRep.htm">InternalRep</A></B>, <B><A HREF="../TclJavaLib/TclObject.htm">TclObject</A></B>, <B><A HREF="../TclJavaLib/TclIndex.htm">TclIndex</A></B>, <B><A HREF="../TclJavaLib/TclDouble.htm">TclDouble</A></B>, <B><A HREF="../TclJavaLib/TclString.htm">TclString</A></B>, <B><A HREF="../TclJavaLib/TclInteger.htm">TclInteger</A></B>, <B><A HREF="../TclJavaLib/TclBoolean.htm">TclBoolean</A></B>, <B><A HREF="../TclJavaLib/ReflectObject.htm">ReflectObject</A></B>
<HR><PRE>
<A HREF="../license.html">Copyright</A> &#169; 1996-1998 Sun Microsystems, Inc.
<A HREF="../license.html">Copyright</A> &#169; 1995-1997 Roger E. Critchlow Jr.</PRE>
</BODY></HTML>
