summaryrefslogtreecommitdiff
path: root/tools/ahat/src/heapdump/Diff.java
diff options
context:
space:
mode:
author Treehugger Robot <treehugger-gerrit@google.com> 2017-06-23 11:13:25 +0000
committer Gerrit Code Review <noreply-gerritcodereview@google.com> 2017-06-23 11:13:27 +0000
commit47686f62332c9cfa015c47a1b2acdd60e74e6ea3 (patch)
tree1381be0cee6e43e0540d4bad6bfc3ce899206256 /tools/ahat/src/heapdump/Diff.java
parent2cf565901845e4bafc663c24071c91d13c692858 (diff)
parentd6918e3c8faf5e445950402f7ea56233dd800948 (diff)
Merge "ahat: Improve field diffing."
Diffstat (limited to 'tools/ahat/src/heapdump/Diff.java')
-rw-r--r--tools/ahat/src/heapdump/Diff.java44
1 files changed, 0 insertions, 44 deletions
diff --git a/tools/ahat/src/heapdump/Diff.java b/tools/ahat/src/heapdump/Diff.java
index 943e6e63f5..489f709b04 100644
--- a/tools/ahat/src/heapdump/Diff.java
+++ b/tools/ahat/src/heapdump/Diff.java
@@ -336,48 +336,4 @@ public class Diff {
placeholder.getBaseline().getSite().getBaseline().addPlaceHolderInstance(placeholder);
}
}
-
- /**
- * Diff two lists of field values.
- * PlaceHolder objects are added to the given lists as needed to ensure
- * every FieldValue in A ends up with a corresponding FieldValue in B.
- */
- public static void fields(List<FieldValue> a, List<FieldValue> b) {
- // Fields with the same name and type are considered matching fields.
- // For simplicity, we assume the matching fields are in the same order in
- // both A and B, though some fields may be added or removed in either
- // list. If our assumption is wrong, in the worst case the quality of the
- // field diff is poor.
-
- for (int i = 0; i < a.size(); i++) {
- FieldValue afield = a.get(i);
- afield.setBaseline(null);
-
- // Find the matching field in B, if any.
- for (int j = i; j < b.size(); j++) {
- FieldValue bfield = b.get(j);
- if (afield.getName().equals(bfield.getName())
- && afield.getType().equals(bfield.getType())) {
- // We found the matching field in B.
- // Assume fields i, ..., j-1 in B have no match in A.
- for ( ; i < j; i++) {
- a.add(i, FieldValue.newPlaceHolderFieldValue(b.get(i)));
- }
-
- afield.setBaseline(bfield);
- bfield.setBaseline(afield);
- break;
- }
- }
-
- if (afield.getBaseline() == null) {
- b.add(i, FieldValue.newPlaceHolderFieldValue(afield));
- }
- }
-
- // All remaining fields in B are unmatched by any in A.
- for (int i = a.size(); i < b.size(); i++) {
- a.add(i, FieldValue.newPlaceHolderFieldValue(b.get(i)));
- }
- }
}