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

COVERAGE SUMMARY FOR SOURCE FILE [LiveHeapTableModel.java]

nameclass, %method, %block, %line, %
LiveHeapTableModel.java0%   (0/1)0%   (0/7)0%   (0/195)0%   (0/30)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class LiveHeapTableModel0%   (0/1)0%   (0/7)0%   (0/195)0%   (0/30)
<static initializer> 0%   (0/1)0%   (0/8)0%   (0/1)
LiveHeapTableModel (List, long): void 0%   (0/1)0%   (0/77)0%   (0/6)
getColumnClass (int): Class 0%   (0/1)0%   (0/5)0%   (0/1)
getColumnCount (): int 0%   (0/1)0%   (0/4)0%   (0/1)
getColumnName (int): String 0%   (0/1)0%   (0/5)0%   (0/1)
getRowCount (): int 0%   (0/1)0%   (0/4)0%   (0/1)
getValueAt (int, int): Object 0%   (0/1)0%   (0/92)0%   (0/19)

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 */
14package net.sf.madmap;
15 
16import java.io.*;
17import java.util.*;
18import java.awt.*;
19import java.awt.event.*;
20import javax.swing.*;
21import javax.swing.filechooser.*;
22 
23 
24public class LiveHeapTableModel extends javax.swing.table.AbstractTableModel {
25 
26  java.util.List<HprofClassElement>     heap;
27  long        totalLiveSize;
28  
29  private String[] columnNames = {
30    "ClassName@ClassAddr",
31    "Live Size",
32    "Pct of Live Size",
33    "Count",
34    "Avg Size"
35  };
36  
37  private Class[] columnType = {
38    (java.lang.Class)((new String("")).getClass()),
39    (java.lang.Class)((new Long(0)).getClass()),
40    (java.lang.Class)((new Double(0.0)).getClass()),
41    (java.lang.Class)((new Long(0)).getClass()),
42    (java.lang.Class)((new Double(0.0)).getClass())
43  };
44    
45  public LiveHeapTableModel( java.util.List<HprofClassElement> initialSortedHeap, long liveSize ) {
46    heap = initialSortedHeap;
47    totalLiveSize = liveSize;
48  }
49 
50  public Class getColumnClass(int c) {
51    return columnType[c];
52  }
53  
54  public String getColumnName(int col) {
55      return columnNames[col];
56  }
57 
58  public int getColumnCount() { return columnType.length; }
59  public int getRowCount() { return heap.size(); }
60  
61  public Object getValueAt(int row, int col) { 
62    Iterator<HprofClassElement>   ihoc3 = heap.iterator();
63    int i = 0;
64 
65    while( ihoc3.hasNext() ) {
66      HprofClassElement hk = ihoc3.next();
67      
68      if ( i == row ) {
69        if ( col == 0 ) {
70          return new String( hk.className() + "@" + Long.toHexString(hk.addr()) );
71        } else if ( col == 1 ) {
72          return hk.getInstanceSize();
73        } else if ( col == 2 ) {
74          return new Double( (double) hk.getInstanceSize() / (double) totalLiveSize ) * 100;
75        } else if ( col == 3 ) {
76          return hk.getInstanceCount();
77        } else if ( col == 4 ) {
78          return new Double( (double) hk.getInstanceSize() / (double) hk.getInstanceCount() );
79        }
80      }
81      
82      i += 1;
83    }
84    
85    assert  true == false : "Should not reach here!" ;
86    return null;
87  }    
88};

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