wicket.util.profile
Class ArrayShellProfileNode

java.lang.Object
  extended bywicket.util.profile.AbstractProfileNode
      extended bywicket.util.profile.AbstractShellProfileNode
          extended bywicket.util.profile.ArrayShellProfileNode
All Implemented Interfaces:
java.lang.Comparable, IObjectProfileNode

final class ArrayShellProfileNode
extends AbstractShellProfileNode

A shell pseudo-node implementation for an array class.

Author:
(C) Vlad Roubtsov , 2003

Nested Class Summary
 
Nested classes inherited from class wicket.util.profile.IObjectProfileNode
IObjectProfileNode.INodeFilter, IObjectProfileNode.INodeVisitor
 
Field Summary
(package private) static IObjectProfileNode[] EMPTY_OBJECTPROFILENODE_ARRAY
           
(package private)  int m_size
           
 
Constructor Summary
(package private) ArrayShellProfileNode(IObjectProfileNode parent, java.lang.Class type, int length)
           
 
Method Summary
 IObjectProfileNode[] children()
          Returns all children of this node.
 int compareTo(java.lang.Object obj)
           
 java.lang.String dump()
          Dumps this node into a flat-text format used by the ObjectProfileVisitors#newDefaultNodePrinter default node visitor.
 java.lang.String name()
          Returns a human-readable name for this node, usually derived from the class field or array index that was used to reach the objectassociated with this node.
 java.lang.Object object()
          Returns the object associated with this node.
 IObjectProfileNode parent()
          Returns the assigned ownership parent for this node.
 IObjectProfileNode[] path()
          Returns the full path from the profile tree root to this node, in that direction.
 int pathlength()
          A convenience method for retrieving this node's tree path length.
 int refcount()
          Returns the reference count for the associated AbstractShellProfileNode.object().
 IObjectProfileNode root()
          A convenience method for retrieving the root node from any node in a profile tree.
 IObjectProfileNode shell()
          Returns the shell pseudo-node for this node.
 int size()
          Returns the full size (in bytes) assigned to this node in its profile tree.
 java.lang.String toString()
           
 boolean traverse(IObjectProfileNode.INodeFilter filter, IObjectProfileNode.INodeVisitor visitor)
          A generic hook for traversing profile trees using filtersand visitors.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

EMPTY_OBJECTPROFILENODE_ARRAY

static final IObjectProfileNode[] EMPTY_OBJECTPROFILENODE_ARRAY

m_size

int m_size
Constructor Detail

ArrayShellProfileNode

ArrayShellProfileNode(IObjectProfileNode parent,
                      java.lang.Class type,
                      int length)
Method Detail

name

public java.lang.String name()
Description copied from interface: IObjectProfileNode
Returns a human-readable name for this node, usually derived from the class field or array index that was used to reach the objectassociated with this node.

Returns:
node name [never null]
See Also:
IObjectProfileNode.name()

object

public final java.lang.Object object()
Description copied from interface: IObjectProfileNode
Returns the object associated with this node. This is never null except for shell pseudo-nodes.

Returns:
object instance [null only for shell nodes]
See Also:
IObjectProfileNode.object()

shell

public final IObjectProfileNode shell()
Description copied from interface: IObjectProfileNode
Returns the shell pseudo-node for this node. This represents all instance data fields that are "inlined" in the class definition represented by this node (including all superclasses all the way to java.lang.Object). This includes primitive data fields, object references representing non-primitive fields, and (for arrays) the array length field and storage required for the array slots.

Another way to describe this is that node.shell().size() is the minimum size an instance of node.object().getClass() can be (when all non-primitive instance fields are set to 'null').

The returned reference is also guaranteed to be present somewhere in the array returned by IObjectProfileNode.children(). This data is kept in a separate node instance to simplify tree visiting and node filtering.

Returns:
shell pseudo-node [null only for shell nodes]
See Also:
IObjectProfileNode.shell()

children

public final IObjectProfileNode[] children()
Description copied from interface: IObjectProfileNode
Returns all children of this node. These are non-null references found in this object's class fields (or array slots if the object is of an array type). The result is sorted in decreasing sizeorder.

Note: the returned array also contains the shellpseudo-node.

Returns:
array of children nodes, sorted by size [never null, may be empty]
See Also:
IObjectProfileNode.children()

refcount

public final int refcount()
Description copied from interface: IObjectProfileNode
Returns the reference count for the associated IObjectProfileNode.object(). This is exactly the number of unique references to this object in the object graph submitted to ObjectProfiler.profile(java.lang.Object).

Returns:
reference count [always positive]
See Also:
IObjectProfileNode.refcount()

traverse

public final boolean traverse(IObjectProfileNode.INodeFilter filter,
                              IObjectProfileNode.INodeVisitor visitor)
Description copied from interface: IObjectProfileNode
A generic hook for traversing profile trees using filtersand visitors. See IObjectProfileNode.INodeFilter and IObjectProfileNode.INodeVisitor for more details

Parameters:
filter - [null is equivalent to no filtering]
visitor - [may not be null]
Returns:
'true' iff either 'filter' was null or it returned 'true' for this node
See Also:
IObjectProfileNode.traverse(wicket.util.profile.IObjectProfileNode.INodeFilter, wicket.util.profile.IObjectProfileNode.INodeVisitor)

size

public final int size()
Description copied from interface: IObjectProfileNode
Returns the full size (in bytes) assigned to this node in its profile tree. This is the sum of sizes of the node class's shelland its non-primitive non-null instance fields, computed as a closure over the spanning tree produced by ObjectProfiler.profile(java.lang.Object).

Specified by:
size in interface IObjectProfileNode
Returns:
total node size [always positive]
See Also:
IObjectProfileNode.size()

parent

public final IObjectProfileNode parent()
Description copied from interface: IObjectProfileNode
Returns the assigned ownership parent for this node. This is null for the root node.

Specified by:
parent in interface IObjectProfileNode
Returns:
parent node [null only for the root node]
See Also:
IObjectProfileNode.parent()

path

public final IObjectProfileNode[] path()
Description copied from interface: IObjectProfileNode
Returns the full path from the profile tree root to this node, in that direction. The result includes the root node as well as the current node.

Invariant: node.root() == node.path()[0] Invariant: node.path()[node.path().length - 1] == node Invariant: node.path().length == node.pathlength()

Specified by:
path in interface IObjectProfileNode
Returns:
node tree path [never null/empty]
See Also:
IObjectProfileNode.path()

root

public final IObjectProfileNode root()
Description copied from interface: IObjectProfileNode
A convenience method for retrieving the root node from any node in a profile tree.

Invariant: node.root() == node iff 'node' is the root of its profile tree Invariant: node.root() == node.path()[0]

Specified by:
root in interface IObjectProfileNode
Returns:
the root node for the profile tree that the current node is a part of [never null]
See Also:
IObjectProfileNode.root()

pathlength

public final int pathlength()
Description copied from interface: IObjectProfileNode
A convenience method for retrieving this node's tree path length.

Specified by:
pathlength in interface IObjectProfileNode
Returns:
path length [always positive]
See Also:
IObjectProfileNode.pathlength()

dump

public final java.lang.String dump()
Description copied from interface: IObjectProfileNode
Dumps this node into a flat-text format used by the ObjectProfileVisitors#newDefaultNodePrinter default node visitor.

Specified by:
dump in interface IObjectProfileNode
Returns:
indented dump string [could be very large]
See Also:
IObjectProfileNode.dump()

compareTo

public final int compareTo(java.lang.Object obj)
Specified by:
compareTo in interface java.lang.Comparable
See Also:
Comparable.compareTo(java.lang.Object)

toString

public java.lang.String toString()
See Also:
Object.toString()


Copyright © 2004-2006 Wicket developers. All Rights Reserved.