OLD | NEW |
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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 part of dart.vmstats; | 5 part of dart.vmstats; |
6 | 6 |
7 class BarGraph { | 7 class BarGraph { |
8 CanvasElement _canvas; | 8 CanvasElement _canvas; |
9 GraphModel _model; | 9 GraphModel _model; |
10 List<Element> _elements; | 10 List<Element> _elements; |
(...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
211 List<int> _segments; | 211 List<int> _segments; |
212 | 212 |
213 Sample(this._segments) {} | 213 Sample(this._segments) {} |
214 | 214 |
215 int get length => _segments.length; | 215 int get length => _segments.length; |
216 int operator[](int i) => _segments[i]; | 216 int operator[](int i) => _segments[i]; |
217 | 217 |
218 Iterator<int> get iterator => _segments.iterator; | 218 Iterator<int> get iterator => _segments.iterator; |
219 | 219 |
220 int total() { | 220 int total() { |
221 return _segments.reduce(0, (int prev, int element) => prev + element); | 221 return _segments.fold(0, (int prev, int element) => prev + element); |
222 } | 222 } |
223 } | 223 } |
OLD | NEW |