1 /* |
1 /* |
2 * Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). |
2 * Copyright (c) 2008-2010 Nokia Corporation and/or its subsidiary(-ies). |
3 * All rights reserved. |
3 * All rights reserved. |
4 * This component and the accompanying materials are made available |
4 * This component and the accompanying materials are made available |
5 * under the terms of "Eclipse Public License v1.0" |
5 * under the terms of "Eclipse Public License v1.0" |
6 * which accompanies this distribution, and is available |
6 * which accompanies this distribution, and is available |
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
19 |
19 |
20 import java.util.AbstractList; |
20 import java.util.AbstractList; |
21 import java.util.ArrayList; |
21 import java.util.ArrayList; |
22 |
22 |
23 /** |
23 /** |
24 * Contains information of one memory leak item Information is parsed from |
24 * Contains information of one memory leak item. Information is parsed from |
25 * atool.exe generated XML file so we can assume that all the information is |
25 * atool.exe generated XML file so we can assume that all the information is |
26 * valid and no other checking is needed. |
26 * valid and no other checking is needed. |
27 * |
27 * |
28 * @author kihe |
28 * @author kihe |
29 * |
29 * |
30 */ |
30 */ |
31 public class AnalysisItem extends BaseItem { |
31 public class AnalysisItem extends BaseItem { |
|
32 |
|
33 /** Call stack addresses. */ |
|
34 private final AbstractList<CallstackItem> callstackItems; |
32 |
35 |
33 /** Size of leak. */ |
36 /** Size of leak. */ |
34 private int leakSize = 0; |
37 private int leakSize = 0; |
35 |
38 |
36 /** Call stack addresses. */ |
39 /** Memory leak time. */ |
37 private final AbstractList<CallstackItem> callstackItems; |
40 private String memoryLeakTime; |
38 |
41 |
39 /** |
42 /** |
40 * Constructor. |
43 * Constructor. |
41 */ |
44 */ |
42 public AnalysisItem() { |
45 public AnalysisItem() { |
44 callstackItems = new ArrayList<CallstackItem>(); |
47 callstackItems = new ArrayList<CallstackItem>(); |
45 } |
48 } |
46 |
49 |
47 /** |
50 /** |
48 * Adds new Callstack item. |
51 * Adds new Callstack item. |
49 * |
52 * |
50 * @param item |
53 * @param item |
51 * Callstack item |
54 * Callstack item |
52 */ |
55 */ |
53 public final void addCallstackItem(final CallstackItem item) { |
56 public final void addCallstackItem(final CallstackItem item) { |
54 this.callstackItems.add(item); |
57 this.callstackItems.add(item); |
55 } |
58 } |
56 |
59 |
57 /** |
60 /** |
58 * Check contains current item valid callstack item. |
61 * Check if any stored callstack items has is pinpointed to file and line |
59 * |
62 * number. |
60 * @return True one callstack info contains Function name and leak line |
63 * |
|
64 * @return True if any callstack item contains file name and leak line |
61 * number, otherwise False |
65 * number, otherwise False |
62 */ |
66 */ |
63 public final boolean containValidCallstack() { |
67 public final boolean containValidCallstack() { |
64 // thru stored callstack items |
68 // thru stored callstack items |
65 final java.util.Iterator<CallstackItem> iterCallstack = callstackItems |
69 final java.util.Iterator<CallstackItem> iterCallstack = callstackItems |
76 return false; |
80 return false; |
77 } |
81 } |
78 |
82 |
79 /** |
83 /** |
80 * Gets stored callstack items. |
84 * Gets stored callstack items. |
81 * |
85 * |
82 * @return Callstack items |
86 * @return Callstack items |
83 */ |
87 */ |
84 public final AbstractList<CallstackItem> getCallstackItems() { |
88 public final AbstractList<CallstackItem> getCallstackItems() { |
85 return this.callstackItems; |
89 return this.callstackItems; |
86 } |
90 } |
87 |
91 |
88 /** |
92 /** |
89 * Gets size of memory leak. |
93 * Gets size of memory leak. |
90 * |
94 * |
91 * @return Memory leak size |
95 * @return Memory leak size |
92 */ |
96 */ |
93 public final int getLeakSize() { |
97 public final int getLeakSize() { |
94 return this.leakSize; |
98 return this.leakSize; |
95 } |
99 } |
96 |
100 |
|
101 /** |
|
102 * Gets memory leak time. |
|
103 * |
|
104 * @return Memory leak time |
|
105 */ |
|
106 public final String getMemoryLeakTime() { |
|
107 if (memoryLeakTime == null) { |
|
108 return ""; |
|
109 } |
|
110 return this.memoryLeakTime; |
|
111 } |
97 |
112 |
98 /** |
113 /** |
99 * Sets size for the memory leak. |
114 * Sets size for the memory leak. |
100 * |
115 * |
101 * @param newSize |
116 * @param newSize |
102 * Memory leak size |
117 * Memory leak size |
103 */ |
118 */ |
104 public final void setLeakSize(final int newSize) { |
119 public final void setLeakSize(final int newSize) { |
105 this.leakSize = newSize; |
120 this.leakSize = newSize; |
106 } |
121 } |
|
122 |
|
123 /** |
|
124 * Sets memory leak time. |
|
125 * |
|
126 * @param newMemoryLeakTime |
|
127 * Memory leak time |
|
128 */ |
|
129 public final void setMemoryLeakTime(final String newMemoryLeakTime) { |
|
130 this.memoryLeakTime = newMemoryLeakTime; |
|
131 |
|
132 } |
107 } |
133 } |