EMMA Coverage Report (generated Sat Jun 02 16:47:50 EDT 2012)
[all classes][net.sf.madmap]

COVERAGE SUMMARY FOR SOURCE FILE [HprofArrayObject.java]

nameclass, %method, %block, %line, %
HprofArrayObject.java100% (1/1)100% (4/4)92%  (136/148)94%  (17/18)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class HprofArrayObject100% (1/1)100% (4/4)92%  (136/148)94%  (17/18)
<static initializer> 100% (1/1)75%  (6/8)75%  (0.8/1)
HprofArrayObject (long, String, int, long, long, HprofClassElement, ArrayList... 100% (1/1)79%  (38/48)90%  (7.2/8)
size (): long 100% (1/1)100% (4/4)100% (1/1)
toString (): String 100% (1/1)100% (88/88)100% (8/8)

1/*
2 * Copyright 2008 Eric Caspole
3 * 
4 * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this
5 * file except in compliance with the License. You may obtain a copy of the License at
6 * 
7 * http://www.apache.org/licenses/LICENSE-2.0
8 * 
9 * Unless required by applicable law or agreed to in writing, software distributed under
10 * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
11 * KIND, either express or implied. See the License for the specific language governing
12 * permissions and limitations under the License.
13 */
14 
15package net.sf.madmap;
16 
17import java.io.*;
18import java.util.*;
19 
20/**
21 * HprofArrayObject is the representation of a java array in the heap of the hprof
22 * target process.
23 * 
24 * @author ecaspole
25 *   
26 */
27public class HprofArrayObject extends HprofHeapAllocation {
28  int        _size;
29  int         _nelems;
30  //long[]      _elems          = null;
31  
32  public long size()    { return _size; }
33  
34  public HprofArrayObject( long addr, String type, int trace, 
35            long size, long nelems, HprofClassElement cls_addr, ArrayList elems ) {
36    super( addr, trace, cls_addr );
37 
38    // int is enough to store array size?
39    _nelems         = (int) nelems;
40    _size           = (int) size;
41    set_children( longArrayListtoLongArray( elems ) );
42    if ( children() != null ) {
43      assert ( elems.size() == children().length ) : "array elems are messed up" ;
44      
45  /*
46      System.out.println( "### obj addr       = " + Long.toHexString( addr ));
47      System.out.println( "### _type_of_elems = " + _type_of_elems );
48      System.out.println( "### elems.size()   = " + elems.size() );
49      System.out.println( "### _elems.length  = " + _elems.length );
50      System.out.println( "### _nelems  = " + _nelems );
51      System.out.println( "### elems    = " + elems );
52  */    
53      // nelems includes the total size of the array including elements which are null,
54      // which are not listed in the file
55      assert ( children().length <= _nelems ) : "array elems are messed up" ;
56    }
57  }
58 
59  //public String   typeOfElems()   { 
60  //  return class_addr().className(); 
61  //}
62 
63  // The class name should come out of the table, it should be added when the plain class
64  // for this type of array was added
65  //public String   className() {
66        //return class_addr().className();
67  //}
68 
69  public String toString() {
70    StringBuffer p = new StringBuffer();
71    
72    p.append( new String("ARR " + Long.toHexString(addr()) + "(sz=" + size() + 
73        ", trace=" + getStackTrace() + ", nelems=" + _nelems + " elem type=" + class_addr().className() + ")" ));
74 
75    if ( children() != null ) {
76      for (int i = 0; i < children().length; i++ ) {
77        Long id   = (Long) children()[ i ];
78                  p.append("\n");        
79        p.append( new String("  [" + i + "]\t" + Long.toHexString( id )));
80      }
81    }
82    return p.toString();
83  }
84}

[all classes][net.sf.madmap]
EMMA 2.0.5312 (C) Vladimir Roubtsov