public final class TclObject
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
protected static java.lang.RuntimeException |
DEALLOCATED
Raise a TclRuntimeError in the case where a
TclObject was already disposed of because the last
ref was released.
|
protected InternalRep |
internalRep |
protected int |
refCount |
protected java.lang.String |
stringRep |
Modifier | Constructor and Description |
---|---|
protected |
TclObject(int ivalue)
Creates a TclObject with the given integer value.
|
|
TclObject(InternalRep rep)
Creates a TclObject with the given InternalRep.
|
protected |
TclObject(TclString rep,
java.lang.String s)
Creates a TclObject with the given InternalRep and stringRep.
|
Modifier and Type | Method and Description |
---|---|
protected void |
disposedError() |
protected void |
disposeObject()
Dispose of the TclObject when the refCount reaches 0.
|
TclObject |
duplicate()
Tcl_DuplicateObj -> duplicate
Duplicate a TclObject, this method provides the preferred
means to deal with modification of a shared TclObject.
|
InternalRep |
getInternalRep()
Returns the handle to the current internal rep.
|
static java.lang.String |
getObjRecords()
Return a String that describes TclObject and internal
rep type allocations and conversions.
|
void |
invalidateStringRep()
Sets the string representation of the object to null.
|
boolean |
isDoubleType() |
boolean |
isIntType() |
boolean |
isShared()
Returns true if the TclObject is shared, false otherwise.
|
void |
preserve()
Tcl_IncrRefCount -> preserve
Increments the refCount to indicate the caller's intent to
preserve the value of this object.
|
void |
release()
Tcl_DecrRefCount -> release
Decrements the refCount to indicate that the caller is no longer
interested in the value of this object.
|
void |
setInternalRep(InternalRep rep)
Change the internal rep of the object.
|
TclObject |
takeExclusive()
Deprecated.
The takeExclusive method has been deprecated
in favor of the new duplicate() method. The takeExclusive
method would modify the ref count of the original object
and return an object with a ref count of 1 instead of 0.
These two behaviors lead to lots of useless duplication
of objects that could be modified directly. This method
exists only for backwards compatibility and will be
removed at some point.
|
java.lang.String |
toString()
Returns the string representation of the object.
|
protected InternalRep internalRep
protected int refCount
protected java.lang.String stringRep
protected static final java.lang.RuntimeException DEALLOCATED
public TclObject(InternalRep rep)
rep
- the initial InternalRep for this object.protected TclObject(TclString rep, java.lang.String s)
rep
- the initial InternalRep for this object.s
- the initial string rep for this object.protected TclObject(int ivalue)
ivalue
- the integer valuepublic final void preserve()
TclRuntimeError
- if the object has already been deallocated.public final void release()
TclRuntimeError
- if the object has already been deallocated.public static java.lang.String getObjRecords()
public final boolean isIntType()
public final boolean isDoubleType()
public final InternalRep getInternalRep()
public void setInternalRep(InternalRep rep)
rep
- the new internal rep.public final java.lang.String toString()
toString
in class java.lang.Object
public final void invalidateStringRep() throws TclRuntimeError
TclRuntimeError
- if object is not exclusively owned.public final boolean isShared()
public final TclObject duplicate()
public final TclObject takeExclusive() throws TclRuntimeError
TclRuntimeError
protected final void disposeObject()
TclRuntimeError
- if the object has already been deallocated.protected final void disposedError()