| 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 // This code was auto-generated, is not intended to be edited, and is subject to | 5 // This code was auto-generated, is not intended to be edited, and is subject to |
| 6 // significant change. Please see the README file for more information. | 6 // significant change. Please see the README file for more information. |
| 7 | 7 |
| 8 library services.correction.change; | 8 library services.correction.change; |
| 9 | 9 |
| 10 import 'package:analysis_services/constants.dart'; | 10 import 'package:analysis_services/constants.dart'; |
| (...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 186 | 186 |
| 187 | 187 |
| 188 /** | 188 /** |
| 189 * A group of linked [Position]s in multiple files that are simultaneously | 189 * A group of linked [Position]s in multiple files that are simultaneously |
| 190 * modified - if one gets edited, all other positions in a group are edited the | 190 * modified - if one gets edited, all other positions in a group are edited the |
| 191 * same way. All linked positions in a group have the same content. | 191 * same way. All linked positions in a group have the same content. |
| 192 */ | 192 */ |
| 193 class LinkedPositionGroup implements HasToJson { | 193 class LinkedPositionGroup implements HasToJson { |
| 194 final String id; | 194 final String id; |
| 195 final List<Position> positions = <Position>[]; | 195 final List<Position> positions = <Position>[]; |
| 196 final List<String> proposals = <String>[]; |
| 196 | 197 |
| 197 LinkedPositionGroup(this.id); | 198 LinkedPositionGroup(this.id); |
| 198 | 199 |
| 199 void add(Position position) { | 200 void addPosition(Position position) { |
| 200 if (positions.isNotEmpty && position.length != positions[0].length) { | 201 if (positions.isNotEmpty && position.length != positions[0].length) { |
| 201 throw new ArgumentError( | 202 throw new ArgumentError( |
| 202 'All positions should have the same length. ' | 203 'All positions should have the same length. ' |
| 203 'Was: ${positions[0].length}. New: ${position.length}'); | 204 'Was: ${positions[0].length}. New: ${position.length}'); |
| 204 } | 205 } |
| 205 positions.add(position); | 206 positions.add(position); |
| 206 } | 207 } |
| 207 | 208 |
| 209 void addProposal(String proposal) { |
| 210 proposals.add(proposal); |
| 211 } |
| 212 |
| 208 @override | 213 @override |
| 209 Map<String, Object> toJson() { | 214 Map<String, Object> toJson() { |
| 210 return { | 215 return { |
| 211 ID: id, | 216 ID: id, |
| 212 POSITIONS: objectToJson(positions) | 217 POSITIONS: objectToJson(positions) |
| 213 }; | 218 }; |
| 214 } | 219 } |
| 215 | 220 |
| 216 @override | 221 @override |
| 217 String toString() => 'LinkedPositionGroup(id=$id, positions=$positions)'; | 222 String toString() => 'LinkedPositionGroup(id=$id, positions=$positions)'; |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 263 @override | 268 @override |
| 264 String toString() => 'Position(file=$file, offset=$offset, length=$length)'; | 269 String toString() => 'Position(file=$file, offset=$offset, length=$length)'; |
| 265 | 270 |
| 266 static Position fromJson(Map<String, Object> json) { | 271 static Position fromJson(Map<String, Object> json) { |
| 267 String file = json[FILE]; | 272 String file = json[FILE]; |
| 268 int offset = json[OFFSET]; | 273 int offset = json[OFFSET]; |
| 269 int length = json[LENGTH]; | 274 int length = json[LENGTH]; |
| 270 return new Position(file, offset, length); | 275 return new Position(file, offset, length); |
| 271 } | 276 } |
| 272 } | 277 } |
| OLD | NEW |