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.agentbean; 17 18 import java.util.Objects; 19 20 /** 21 * Agent Heap Bean 22 * 23 * @since 2021/5/19 16:39 24 */ 25 public class AgentHeapBean { 26 private Integer agentNodeId; 27 private Integer agentClazzId; 28 private Integer agentHeapId; 29 private Long sessionId; 30 private String agentClazzName; 31 private Integer agentAllocationsCount; 32 private Integer agentDeAllocationsCount; 33 private Integer agentTotalInstanceCount; 34 private Long agentTotalshallowSize; 35 getAgentNodeId()36 public Integer getAgentNodeId() { 37 return agentNodeId; 38 } 39 setAgentNodeId(Integer agentNodeId)40 public void setAgentNodeId(Integer agentNodeId) { 41 this.agentNodeId = agentNodeId; 42 } 43 getAgentClazzId()44 public Integer getAgentClazzId() { 45 return agentClazzId; 46 } 47 setAgentClazzId(Integer agentClazzId)48 public void setAgentClazzId(Integer agentClazzId) { 49 this.agentClazzId = agentClazzId; 50 } 51 getAgentHeapId()52 public Integer getAgentHeapId() { 53 return agentHeapId; 54 } 55 setAgentHeapId(Integer agentHeapId)56 public void setAgentHeapId(Integer agentHeapId) { 57 this.agentHeapId = agentHeapId; 58 } 59 getSessionId()60 public Long getSessionId() { 61 return sessionId; 62 } 63 setSessionId(Long sessionId)64 public void setSessionId(Long sessionId) { 65 this.sessionId = sessionId; 66 } 67 getAgentClazzName()68 public String getAgentClazzName() { 69 return agentClazzName; 70 } 71 setAgentClazzName(String agentClazzName)72 public void setAgentClazzName(String agentClazzName) { 73 this.agentClazzName = agentClazzName; 74 } 75 getAgentAllocationsCount()76 public Integer getAgentAllocationsCount() { 77 return agentAllocationsCount; 78 } 79 setAgentAllocationsCount(Integer agentAllocationsCount)80 public void setAgentAllocationsCount(Integer agentAllocationsCount) { 81 this.agentAllocationsCount = agentAllocationsCount; 82 } 83 getAgentDeAllocationsCount()84 public Integer getAgentDeAllocationsCount() { 85 return agentDeAllocationsCount; 86 } 87 setAgentDeAllocationsCount(Integer agentDeAllocationsCount)88 public void setAgentDeAllocationsCount(Integer agentDeAllocationsCount) { 89 this.agentDeAllocationsCount = agentDeAllocationsCount; 90 } 91 getAgentTotalInstanceCount()92 public Integer getAgentTotalInstanceCount() { 93 return agentTotalInstanceCount; 94 } 95 setAgentTotalInstanceCount(Integer agentTotalInstanceCount)96 public void setAgentTotalInstanceCount(Integer agentTotalInstanceCount) { 97 this.agentTotalInstanceCount = agentTotalInstanceCount; 98 } 99 getAgentTotalshallowSize()100 public Long getAgentTotalshallowSize() { 101 return agentTotalshallowSize; 102 } 103 setAgentTotalshallowSize(Long agentTotalshallowSize)104 public void setAgentTotalshallowSize(Long agentTotalshallowSize) { 105 this.agentTotalshallowSize = agentTotalshallowSize; 106 } 107 108 @Override equals(Object object)109 public boolean equals(Object object) { 110 if (this == object) { 111 return true; 112 } 113 if (object == null || getClass() != object.getClass()) { 114 return false; 115 } 116 117 AgentHeapBean agentHeapBean = null; 118 if (object instanceof AgentHeapBean) { 119 agentHeapBean = (AgentHeapBean) object; 120 } 121 return Objects.equals(agentNodeId, agentHeapBean.agentNodeId) && Objects 122 .equals(agentClazzId, agentHeapBean.agentClazzId) && Objects.equals(agentHeapId, agentHeapBean.agentHeapId) 123 && Objects.equals(sessionId, agentHeapBean.sessionId) && Objects 124 .equals(agentClazzName, agentHeapBean.agentClazzName) && Objects 125 .equals(agentAllocationsCount, agentHeapBean.agentAllocationsCount) && Objects 126 .equals(agentDeAllocationsCount, agentHeapBean.agentDeAllocationsCount) && Objects 127 .equals(agentTotalInstanceCount, agentHeapBean.agentTotalInstanceCount) && Objects 128 .equals(agentTotalshallowSize, agentHeapBean.agentTotalshallowSize); 129 } 130 131 @Override hashCode()132 public int hashCode() { 133 return Objects 134 .hash(agentNodeId, agentClazzId, agentHeapId, sessionId, agentClazzName, agentAllocationsCount, 135 agentDeAllocationsCount, agentTotalInstanceCount, agentTotalshallowSize); 136 } 137 138 @Override toString()139 public String toString() { 140 return agentClazzName; 141 } 142 } 143