• 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.views.layout.chartview.memory.nativehook;
17 
18 import ohos.devtools.services.memory.nativebean.HookDataBean;
19 
20 import javax.swing.tree.DefaultMutableTreeNode;
21 import javax.swing.tree.TreeNode;
22 
23 /**
24  * NativeHookDataFilter
25  *
26  * @since 2021/10/25
27  */
28 public class NativeHookDataFilter {
29     boolean aBoolean = true;
30 
31     /**
32      * passTreeNode
33      *
34      * @param treeNode treeNode
35      * @return boolean
36      */
passTreeNode(TreeNode treeNode)37     public boolean passTreeNode(TreeNode treeNode) {
38         if (aBoolean) {
39             return true;
40         }
41         if (treeNode instanceof DefaultMutableTreeNode) {
42             DefaultMutableTreeNode nextElement = (DefaultMutableTreeNode) treeNode;
43             if (nextElement.getUserObject() instanceof HookDataBean) {
44                 HookDataBean bean = (HookDataBean) nextElement.getUserObject();
45                 return bean.getContainType() < 3;
46             }
47         }
48         return true;
49     }
50 
51     /**
52      * setFilter
53      *
54      * @param aBoolean aBoolean
55      * @param str str
56      */
setFilter(boolean aBoolean)57     public void setFilter(boolean aBoolean) {
58         this.aBoolean = aBoolean;
59     }
60 
61 }
62