1 /*
2  * Copyright (C) 2016 The Android Open Source Project
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 package com.android.ahat.heapdump;
18 
19 /**
20  * An interface for instances/sites/heaps/etc in a heap dump that can be
21  * related to corresponding instances/sites/heaps/etc in a second heap dump
22  * when the two heap dumps have been diffed.
23  */
24 public interface Diffable<T> {
25   /**
26    * Returns the object in the other heap dump that corresponds to this object.
27    * When two heap dumps are diffed, diffable objects from the first heap dump
28    * will be matched to "baseline" objects from the second heap dump, and
29    * diffable objects from the second heap dump will be matched to "baseline"
30    * objects from the first heap dump.
31    *
32    * @return the matched object from the other heap dump
33    */
getBaseline()34   T getBaseline();
35 
36   /**
37    * Returns true if this is a placeholder object.
38    * A placeholder object is used to indicate there is some object in the
39    * baseline heap dump that is not in this heap dump. In that case, we create
40    * a dummy place holder object in this heap dump as an indicator of the
41    * object removed from the baseline heap dump.
42    *
43    * @return true if the object is a placeholder
44    */
isPlaceHolder()45   boolean isPlaceHolder();
46 }
47 
48