tcl.lang
Class TclBoolean

java.lang.Object
  extended by tcl.lang.TclBoolean
All Implemented Interfaces:
InternalRep

public class TclBoolean
extends Object
implements InternalRep

This class implements the boolean object type in Tcl.


Method Summary
 void dispose()
          Implement this no-op for the InternalRep interface.
 InternalRep duplicate()
          Returns a dupilcate of the current object.
static boolean get(Interp interp, TclObject tobj)
          Returns the value of the object as an boolean.
static TclObject newInstance(boolean b)
          Creates a new instance of a TclObject with a TclBoolean internal representation.
 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

duplicate

public InternalRep duplicate()
Returns a dupilcate of the current object.

Specified by:
duplicate in interface InternalRep

dispose

public void dispose()
Implement this no-op for the InternalRep interface.

Specified by:
dispose in interface InternalRep

toString

public String toString()
Called to query the string representation of the Tcl object. This method is called only by TclObject.toString() when TclObject.stringRep is null.

Overrides:
toString in class Object
Returns:
the string representation of the Tcl object.

newInstance

public static TclObject newInstance(boolean b)
Creates a new instance of a TclObject with a TclBoolean internal representation.

Parameters:
b - initial value of the boolean object.
Returns:
the TclObject with the given boolean value.

get

public static boolean get(Interp interp,
                          TclObject tobj)
                   throws TclException
Returns the value of the object as an boolean. An object with a TclBoolean internal rep has a boolean value. An object with a TclInteger internal rep and has the int value "0" or "1" is also a valid boolean value.

Parameters:
interp - current interpreter.
tobj - the TclObject to use as an boolean.
Returns:
the boolean value of the object.
Throws:
TclException - if the object cannot be converted into a boolean.


Copyright © 2015. All rights reserved.