FileDocCategorySizeDatePackage
CategoryPath.javaAPI DocApache log4j 1.2.154748Sat Aug 25 00:09:38 BST 2007org.apache.log4j.lf5.viewer.categoryexplorer

CategoryPath

public class CategoryPath extends Object
CategoryPath is a collection of CategoryItems which represent a path of categories.
author
Michael J. Sikorsky
author
Robert Shaw

Fields Summary
protected LinkedList
_categoryElements
Constructors Summary
public CategoryPath()


  //--------------------------------------------------------------------------
  //   Private Variables:
  //--------------------------------------------------------------------------

  //--------------------------------------------------------------------------
  //   Constructors:
  //--------------------------------------------------------------------------

    
    super();
  
public CategoryPath(String category)
Construct a CategoryPath. If the category is null, it defaults to "Debug".

    String processedCategory = category;

    if (processedCategory == null) {
      processedCategory = "Debug";
    }

    processedCategory.replace('/", '.");
    processedCategory = processedCategory.replace('\\", '.");

    StringTokenizer st = new StringTokenizer(processedCategory, ".");
    while (st.hasMoreTokens()) {
      String element = st.nextToken();
      addCategoryElement(new CategoryElement(element));
    }
  
Methods Summary
public voidaddCategoryElement(org.apache.log4j.lf5.viewer.categoryexplorer.CategoryElement categoryElement)
Adds the specified categoryElement to the end of the categoryElement set.

    _categoryElements.addLast(categoryElement);
  
public org.apache.log4j.lf5.viewer.categoryexplorer.CategoryElementcategoryElementAt(int index)
Returns the CategoryElement at the specified index.

    return ((CategoryElement) _categoryElements.get(index));
  
public booleanisEmpty()

    boolean empty = false;

    if (_categoryElements.size() == 0) {
      empty = true;
    }

    return (empty);
  
public voidremoveAllCategoryElements()
Removes all categoryElements.

    _categoryElements.clear();
  
public intsize()
returns the number of CategoryElements.

    int count = _categoryElements.size();

    return (count);
  
public java.lang.StringtoString()

    StringBuffer out = new StringBuffer(100);

    out.append("\n");
    out.append("===========================\n");
    out.append("CategoryPath:                   \n");
    out.append("---------------------------\n");

    out.append("\nCategoryPath:\n\t");

    if (this.size() > 0) {
      for (int i = 0; i < this.size(); i++) {
        out.append(this.categoryElementAt(i).toString());
        out.append("\n\t");
      }
    } else {
      out.append("<<NONE>>");
    }

    out.append("\n");
    out.append("===========================\n");

    return (out.toString());