FileDocCategorySizeDatePackage
DataTraverser.javaAPI DocGlassfish v2 API3687Fri May 04 22:34:48 BST 2007com.sun.enterprise.diagnostics.report.html

DataTraverser

public class DataTraverser extends Object
author
mu125243

Fields Summary
private com.sun.enterprise.diagnostics.Data
dataObj
private Map
typeToData
Key of the map is one of the DataTypes. Assumption is there is one to one relationship between key and its value.
Constructors Summary
public DataTraverser(com.sun.enterprise.diagnostics.Data dataObj)
Creates a new instance of DataTraverser

        this.dataObj = dataObj;
    
Methods Summary
public java.util.IteratorgetData(java.lang.String type)
Return child data object of type supplied as a parameter

param
type data object type
return
data object

        if(typeToData == null)
            traverse();
        
        Object obj = typeToData.get(type);
        if(obj != null) {
            ArrayList list = (ArrayList)obj;
            return list.iterator();
        }
        return new ArrayList().iterator();
    
public com.sun.enterprise.diagnostics.DatagetSource()
Returns the data object which this traverser is visiting

return
Data

        return dataObj;
    
private voidtraverse()

        if(typeToData == null)
            typeToData = new HashMap(5);
        Iterator<Data> children = dataObj.getChildren();
        while(children.hasNext()) {
            Data child = children.next();
            ArrayList list = (ArrayList)typeToData.get(child.getType());
            if (list == null) {
                list = new ArrayList(5);
                typeToData.put(child.getType(), list);
            }
            list.add(child);
        }