| OLD | NEW |
| 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, 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 protocol2; | 5 library protocol2; |
| 6 | 6 |
| 7 import 'dart:convert'; | 7 import 'dart:convert'; |
| 8 | 8 |
| 9 import 'protocol.dart'; | 9 import 'protocol.dart'; |
| 10 | 10 |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 44 return false; | 44 return false; |
| 45 } | 45 } |
| 46 } | 46 } |
| 47 return true; | 47 return true; |
| 48 } | 48 } |
| 49 | 49 |
| 50 /** | 50 /** |
| 51 * Translate the input [map], applying [keyCallback] to all its keys, and | 51 * Translate the input [map], applying [keyCallback] to all its keys, and |
| 52 * [valueCallback] to all its values. | 52 * [valueCallback] to all its values. |
| 53 */ | 53 */ |
| 54 _mapMap(Map map, {dynamic keyCallback(key), dynamic valueCallback(value)}) { | 54 mapMap(Map map, {dynamic keyCallback(key), dynamic valueCallback(value)}) { |
| 55 Map result = {}; | 55 Map result = {}; |
| 56 map.forEach((key, value) { | 56 map.forEach((key, value) { |
| 57 if (keyCallback != null) { | 57 if (keyCallback != null) { |
| 58 key = keyCallback(key); | 58 key = keyCallback(key); |
| 59 } | 59 } |
| 60 if (valueCallback != null) { | 60 if (valueCallback != null) { |
| 61 value = valueCallback(value); | 61 value = valueCallback(value); |
| 62 } | 62 } |
| 63 result[key] = value; | 63 result[key] = value; |
| 64 }); | 64 }); |
| (...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 260 hash = 0x1fffffff & (hash + ((0x03ffffff & hash) << 3)); | 260 hash = 0x1fffffff & (hash + ((0x03ffffff & hash) << 3)); |
| 261 hash = hash ^ (hash >> 11); | 261 hash = hash ^ (hash >> 11); |
| 262 return 0x1fffffff & (hash + ((0x00003fff & hash) << 15)); | 262 return 0x1fffffff & (hash + ((0x00003fff & hash) << 15)); |
| 263 } | 263 } |
| 264 | 264 |
| 265 static int hash2(a, b) => finish(combine(combine(0, a), b)); | 265 static int hash2(a, b) => finish(combine(combine(0, a), b)); |
| 266 | 266 |
| 267 static int hash4(a, b, c, d) => | 267 static int hash4(a, b, c, d) => |
| 268 finish(combine(combine(combine(combine(0, a), b), c), d)); | 268 finish(combine(combine(combine(combine(0, a), b), c), d)); |
| 269 } | 269 } |
| OLD | NEW |