You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jmeter-dev@jakarta.apache.org by tu...@apache.org on 2001/07/27 23:35:44 UTC
cvs commit: jakarta-jmeter/src/org/apache/jmeter/util ListedHashTree.java
tusharbhatia 01/07/27 14:35:44
Modified: src/org/apache/jmeter/util ListedHashTree.java
Log:
Debugging methods for the ListedHashTree
Revision Changes Path
1.6 +38 -0 jakarta-jmeter/src/org/apache/jmeter/util/ListedHashTree.java
Index: ListedHashTree.java
===================================================================
RCS file: /home/cvs/jakarta-jmeter/src/org/apache/jmeter/util/ListedHashTree.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- ListedHashTree.java 2001/07/26 00:34:51 1.5
+++ ListedHashTree.java 2001/07/27 21:35:44 1.6
@@ -60,6 +60,8 @@
import java.io.*;
import java.util.*;
+import org.apache.log4j.Category;
+
/**********************************************************************
This class is used to create a tree structure of objects. Each element in the tree
is also a key to the next node down in the tree. In the ListedHashTree, the order
@@ -68,6 +70,7 @@
***********************************************************************/
public class ListedHashTree implements Serializable
{
+ private static Category log = Category.getInstance(ListedHashTree.class);
public ListedHashTree()
{
@@ -837,4 +840,39 @@
private java.util.Map data;
private List order;
+
+ /** The method debugs the entire tree all the way down (recursively)adding a tab at each level.
+ The debugging is only supported on the log4j output files.
+ @param numTabs The number of tabs (preferably make the first call with a value 0)
+ */
+ public void debugDeep(int numTabs){
+ if(!log.isDebugEnabled())
+ return;
+ if(numTabs == 0 && order.size() > 0)
+ log.debug("==============Starting the debugDeep:" + this + "===============");
+
+ StringBuffer tabBuffer = new StringBuffer(numTabs);
+ for(int i = 0; i < numTabs; i++)
+ tabBuffer.append("\t");
+ String tabs = tabBuffer.toString();
+
+ for(Iterator iter = order.iterator(); iter.hasNext();){
+ Object obj = iter.next();
+ log.debug(tabs + obj);
+ ListedHashTree tree = get(obj);
+ tree.debugDeep(numTabs + 1);
+ }
+ if(numTabs == 0 && order.size() > 0)
+ log.debug("==============Ending the debugDeep===============");
+ }
+
+ /** Debugs all the elements in the current ListedHashTree
+ */
+ public void debugShallow(){
+ if(!log.isDebugEnabled())
+ return;
+ for(Iterator iter = order.iterator(); iter.hasNext();)
+ log.debug(iter.next());
+ }
+
}
---------------------------------------------------------------------
To unsubscribe, e-mail: jmeter-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jmeter-dev-help@jakarta.apache.org