Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(293)

Side by Side Diff: utils/pub/yaml/deep_equals.dart

Issue 11267018: Make getKeys, getValues getters (keys, values). (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Update status files with co19 issue number. Created 8 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « utils/pub/yaml/composer.dart ('k') | utils/pub/yaml/model.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 #library("deep_equals"); 5 #library("deep_equals");
6 6
7 /** 7 /**
8 * Returns whether two objects are structurally equivalent. This considers NaN 8 * Returns whether two objects are structurally equivalent. This considers NaN
9 * values to be equivalent. It also handles self-referential structures. 9 * values to be equivalent. It also handles self-referential structures.
10 */ 10 */
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
51 if (!deepEquals(list1[i], list2[i], parents1, parents2)) return false; 51 if (!deepEquals(list1[i], list2[i], parents1, parents2)) return false;
52 } 52 }
53 53
54 return true; 54 return true;
55 } 55 }
56 56
57 /** Returns whether [map1] and [map2] are structurally equal. */ 57 /** Returns whether [map1] and [map2] are structurally equal. */
58 bool _mapEquals(Map map1, Map map2, List parents1, List parents2) { 58 bool _mapEquals(Map map1, Map map2, List parents1, List parents2) {
59 if (map1.length != map2.length) return false; 59 if (map1.length != map2.length) return false;
60 60
61 for (var key in map1.getKeys()) { 61 for (var key in map1.keys) {
62 if (!map2.containsKey(key)) return false; 62 if (!map2.containsKey(key)) return false;
63 if (!deepEquals(map1[key], map2[key], parents1, parents2)) return false; 63 if (!deepEquals(map1[key], map2[key], parents1, parents2)) return false;
64 } 64 }
65 65
66 return true; 66 return true;
67 } 67 }
68 68
69 /** 69 /**
70 * Returns whether two doubles are equivalent. This differs from `d1 == d2` in 70 * Returns whether two doubles are equivalent. This differs from `d1 == d2` in
71 * that it considers NaN to be equal to itself. 71 * that it considers NaN to be equal to itself.
72 */ 72 */
73 bool _doubleEquals(double d1, double d2) { 73 bool _doubleEquals(double d1, double d2) {
74 if (d1.isNaN && d2.isNaN) return true; 74 if (d1.isNaN && d2.isNaN) return true;
75 return d1 == d2; 75 return d1 == d2;
76 } 76 }
OLDNEW
« no previous file with comments | « utils/pub/yaml/composer.dart ('k') | utils/pub/yaml/model.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698