|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objecttcl.lang.TclDict
public class TclDict
This class implements the dict object type in Tcl.
Nested Class Summary | |
---|---|
static interface |
TclDict.Visitor
An interface to traverse (visit) each key-value pair in a Tcl dictionary object. |
Method Summary | |
---|---|
static void |
appendToKey(Interp interp,
TclObject dict,
TclObject key,
TclObject[] objv,
int start,
int end)
Appends the given strings to the given key in the given dictionary object. |
void |
dispose()
Called to free any storage for the type's internal rep. |
InternalRep |
duplicate()
Returns a duplicate of the current object. |
static Object |
foreach(Interp interp,
Object accum,
TclObject dict,
TclDict.Visitor body)
An internal iterator methods for traversing the elements of a Tcl dictionary object. |
static TclObject |
get(Interp interp,
TclObject dict,
TclObject key)
Tcl_DictObjGet. |
static TclObject |
newInstance()
Creates a new instance of a TclObject with a TclDict internal rep. |
static void |
put(Interp interp,
TclObject dict,
TclObject key,
TclObject value)
Tcl_DictObjPut. |
static void |
putKeyList(Interp interp,
TclObject dict,
TclObject[] keys,
int start,
int length,
TclObject value)
Tcl_DictObjPutKeyList. |
static void |
remove(Interp interp,
TclObject dict,
TclObject key)
Tcl_DictObjRemove. |
static void |
removeKeyList(Interp interp,
TclObject dict,
TclObject[] keys,
int start,
int length)
Tcl_DictObjRemoveKeyList. |
static int |
size(Interp interp,
TclObject dict)
Tcl_DictObjSize. |
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 final TclObject get(Interp interp, TclObject dict, TclObject key) throws TclException
TclException
public static final void put(Interp interp, TclObject dict, TclObject key, TclObject value) throws TclException
TclException
public static final void remove(Interp interp, TclObject dict, TclObject key) throws TclException
TclException
public static final int size(Interp interp, TclObject dict) throws TclException
TclException
public static final Object foreach(Interp interp, Object accum, TclObject dict, TclDict.Visitor body) throws TclException
accum
argument can be
used to thread some arbitrary state through the traversal, and in this
way forms a fold operation over the dictionary, familiar from
functional programming languages. The Visitor object can throw a
TclException
to terminate the loop early either with an
error (which will propagate) or with a TCL.BREAK
exception
which will cause termination of the loop with the current accumulator
value. This method will take care of cleaning up resources associated
with the loop in the event of any exception — which is the reason
this is structured as an internal iterator rather than a more usual (in
Java) external iterator.
Equivalent in functionality to the
Tcl_DictObjFirst/Next/Done
C functions.
interp
- A Tcl interpreter for reporting errors.accum
- Arbitrary state to thread through the traversal.dict
- The Tcl dictionary object.body
- The Visitor object to invoke for each key-value pair.
TclException
- if the visitor object throws one.public static final void putKeyList(Interp interp, TclObject dict, TclObject[] keys, int start, int length, TclObject value) throws TclException
TclException
public static final void removeKeyList(Interp interp, TclObject dict, TclObject[] keys, int start, int length) throws TclException
TclException
public static final void appendToKey(Interp interp, TclObject dict, TclObject key, TclObject[] objv, int start, int end) throws TclException
TclException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |