|
IDebug © 1997-2001 Joseph Kiniry © 2000-2001 KindSoftware © 1997-1999 Caltech All Rights Reserved |
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Object | +--idebug.Context
Context is the data structure that holds the information that is relevent to debugging on a per-thread and a per- threadgroup basis.
Each thread within a program is either in a debugging state or it is not. To signal that it is in the debugging state, that thread should do the following (perhaps in an initDebug() method):
Context
debugContext = new Context(); All of the following method calls
are applied to this object, unless otherwise noted. turnOn(); to turn debugging on for this
thread. addCategory() methods. addClass() methods can be used
to specify specific methods of interest. Note that you'll likely want
to prefix the series of "class additions" with a
removeClass(Thread.currentThread(), "*"); to flush the
context of the class narrowing/widening. setLevel() methods. Now your thread has a valid debugging context, encapsulated in
its Context object. This object is then passed to the Debug class
via the addContext() method so that the debugging
runtime system knows the threads context.
Debug,
DebugConstants, Serialized Form| Constructor Summary | |
Context(DebugConstants c,
DebugOutput d)
The standard constructor. |
|
| Method Summary | |
boolean |
addCategory(java.lang.String category,
int level)
Adds a category to the database of legal debugging categories for the owner thread. |
void |
addClass(java.lang.Class classRef)
Adds a class to this Context's database of classes that have debugging enabled. |
void |
addClass(java.lang.String className)
Adds a class to this Context's database of classes that have debugging enabled. |
java.lang.Object |
clone()
Used to clone a Context for another thread. |
boolean |
containsCategory(java.lang.String category)
|
boolean |
containsClass(java.lang.Class classRef)
|
boolean |
containsClass(java.lang.String className)
|
int |
getCategoryLevel(java.lang.String category)
|
int |
getLevel()
|
DebugOutput |
getOutputInterface()
|
java.lang.Thread |
getThread()
|
boolean |
isOn()
|
java.util.Enumeration |
listCategories()
|
java.util.Enumeration |
listClasses()
Returns an enumeration that is the list of classes that have debugging enabled in this Context. |
boolean |
removeCategory(java.lang.String category)
Removes a category from the database of legal debugging categories for the owner thread. |
void |
removeClass(java.lang.Class classRef)
Removes a class from this Context's database of classes that have debugging enabled. |
void |
removeClass(java.lang.String className)
Removes a class from this Context's database of classes that have debugging enabled. |
void |
setLevel(int l)
Set a new debugging level for the owning thread. |
void |
turnOff()
Turns off debugging facilities for the owner thread. |
void |
turnOn()
Turns on debugging facilities for the owner thread. |
boolean |
validLevel(int l)
|
| Methods inherited from class java.lang.Object |
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
public Context(DebugConstants c,
DebugOutput d)
The standard constructor. The thread that is constructing the context is the "owning thread". All calls to this context will be recognized only in the context of the original constructing thread.
The constructor initializes all the static data-structures used by
the Context class. Note that the initCategories() method
is automatically called as necessary to initialize the default
categories database of the Context class.
c - an implementation of the DebugConstants that
defines the semantics of this debug context.d - an implementation of DebugOutput that defines
the semantics of debugging output.| Method Detail |
public java.lang.Object clone()
Used to clone a Context for another thread. Should be called only by the thread that is going to use/modify the context.
clone in class java.lang.Objectpublic java.lang.Thread getThread()
public void turnOn()
Turns on debugging facilities for the owner thread. Note that if
you do not turnOff() debugging for this thread before it
becomes in active in the system, it will not be garbage collected,
since it is referenced by the Context object.
public void turnOff()
Turns off debugging facilities for the owner thread. Note that if
you do not turnOff debugging for this thread before it
becomes in active in the system, it will not be garbage collected,
since it is referenced by the Context object.
public boolean isOn()
public boolean addCategory(java.lang.String category,
int level)
Adds a category to the database of legal debugging categories for the owner thread. Once a category exists in the database, its debugging level cannot be changed without removing and re-adding the category to the database.
category - the category to add to the global set of categories.level - the debugging level associated with the passed category.public boolean removeCategory(java.lang.String category)
Removes a category from the database of legal debugging categories for the owner thread.
category - the category to remove.public boolean containsCategory(java.lang.String category)
category - is the category to lookup.public int getCategoryLevel(java.lang.String category)
category - is the category to lookup.public java.util.Enumeration listCategories()
Hashtable.elements()public boolean containsClass(java.lang.String className)
className - the name of the class to check.public boolean containsClass(java.lang.Class classRef)
classRef - the class to check.public void addClass(java.lang.Class classRef)
Adds a class to this Context's database of classes that have debugging enabled.
classRef - the class to add to the global table of classes
that have debugging enabled.public void addClass(java.lang.String className)
Adds a class to this Context's database of classes that have debugging enabled. Note that a class of "*" means that all classes will now have debugging enabled for the owning thread. There is no way to "undo" such a command short of manually adding the individual classes back to the database. (Or, equivalently, removing the complement.)
className - the name of the class to add.public void removeClass(java.lang.Class classRef)
Removes a class from this Context's database of classes that have debugging enabled.
classRef - the class to remove from this Context's table of
classes that have debugging enabled.public void removeClass(java.lang.String className)
Removes a class from this Context's database of classes that have debugging enabled. Note that a class of "*" means that all classes will be removed and debugging disabled. There is no way to "undo" such a command.
className - the class to remove from this Context's table of
classes that have debugging enabled.public java.util.Enumeration listClasses()
Returns an enumeration that is the list of classes that have debugging enabled in this Context.
Hashtable.elements()public void setLevel(int l)
Set a new debugging level for the owning thread.
l - the new debugging level.public int getLevel()
public DebugOutput getOutputInterface()
DebugOutput for the owning thread.public boolean validLevel(int l)
l - the level to check.
|
IDebug © 1997-2001 Joseph Kiniry © 2000-2001 KindSoftware © 1997-1999 Caltech All Rights Reserved |
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||