• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2021 Huawei Device Co., Ltd.
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * 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
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 
16 package ohos.devtools.services.memory.nativebean;
17 
18 import ohos.devtools.services.memory.nativebean.NativeFrame;
19 
20 import java.util.ArrayList;
21 import java.util.Objects;
22 
23 /**
24  * InstanceObject
25  *
26  * @since 2021/8/21
27  */
28 public class NativeInstanceObject {
29     private String addr;
30     private long size;
31     private long instanceCount;
32     private boolean isAdd;
33     private String fileName;
34     private String functionName;
35     private ArrayList<NativeFrame> nativeFrames = new ArrayList<>();
36     private boolean isDeAllocated = false;
37 
getInstanceCount()38     public int getInstanceCount() {
39         return (int) instanceCount;
40     }
41 
getNativeFrames()42     public ArrayList<NativeFrame> getNativeFrames() {
43         return nativeFrames;
44     }
45 
getFunctionName()46     public String getFunctionName() {
47         return functionName;
48     }
49 
getAllowSize()50     public long getAllowSize() {
51         return size;
52     }
53 
isDeAllocated()54     public boolean isDeAllocated() {
55         return isDeAllocated;
56     }
57 
getAddr()58     public String getAddr() {
59         return addr;
60     }
61 
setAddr(String addr)62     public void setAddr(String addr) {
63         this.addr = addr;
64     }
65 
getSize()66     public long getSize() {
67         return size;
68     }
69 
setSize(long size)70     public void setSize(long size) {
71         this.size = size;
72     }
73 
setFunctionName(String functionName)74     public void setFunctionName(String functionName) {
75         this.functionName = functionName;
76     }
77 
78     /**
79      * add Native Frames
80      *
81      * @param nativeFrame nativeFrame
82      */
addNativeFrames(NativeFrame nativeFrame)83     public void addNativeFrames(NativeFrame nativeFrame) {
84         nativeFrames.add(nativeFrame);
85     }
86 
setInstanceCount(long instanceCount)87     public void setInstanceCount(long instanceCount) {
88         this.instanceCount = instanceCount;
89     }
90 
setDeAllocated(boolean deAllocated)91     public void setDeAllocated(boolean deAllocated) {
92         isDeAllocated = deAllocated;
93     }
94 
getFileName()95     public String getFileName() {
96         return fileName;
97     }
98 
setFileName(String fileName)99     public void setFileName(String fileName) {
100         this.fileName = fileName;
101     }
102 
isAdd()103     public boolean isAdd() {
104         return isAdd;
105     }
106 
setAdd(boolean add)107     public void setAdd(boolean add) {
108         isAdd = add;
109     }
110 
111     @Override
equals(Object obj)112     public boolean equals(Object obj) {
113         return super.equals(obj);
114     }
115 
116     @Override
clone()117     protected Object clone() throws CloneNotSupportedException {
118         return super.clone();
119     }
120 
121     @Override
toString()122     public String toString() {
123         return "NativeInstanceObject{"
124             + "addr='" + addr + '\''
125             + ", size=" + size
126             + ", instanceCount=" + instanceCount
127             + ", isAdd=" + isAdd
128             + ", fileName='" + fileName + '\''
129             + ", functionName='" + functionName + '\''
130             + ", nativeFrames=" + nativeFrames
131             + ", isDeAllocated=" + isDeAllocated
132             + '}';
133     }
134 
135     @Override
hashCode()136     public int hashCode() {
137         return Objects.hash(addr, size, instanceCount, isAdd, fileName, functionName, nativeFrames, isDeAllocated);
138     }
139 }
140