| OLD | NEW |
| 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2011, 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 swarmlib; | 5 part of swarmlib; |
| 6 | 6 |
| 7 /** The top-level collection of all sections for a user. */ | 7 /** The top-level collection of all sections for a user. */ |
| 8 // TODO(jimhug): This is known as UserData in the server model. | 8 // TODO(jimhug): This is known as UserData in the server model. |
| 9 class Sections extends Collection<Section> { | 9 class Sections extends Collection<Section> { |
| 10 final List<Section> _sections; | 10 final List<Section> _sections; |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 83 if (name == _sections[i].title) { | 83 if (name == _sections[i].title) { |
| 84 return i; | 84 return i; |
| 85 } | 85 } |
| 86 } | 86 } |
| 87 return -1; | 87 return -1; |
| 88 } | 88 } |
| 89 | 89 |
| 90 List<Section> get sections => _sections; | 90 List<Section> get sections => _sections; |
| 91 | 91 |
| 92 // Collection<Section> methods: | 92 // Collection<Section> methods: |
| 93 bool every(bool f(Section element)) => Collections.every(this, f); | 93 bool every(bool f(Section element)) => IterableMixinWorkaround.every(this, f); |
| 94 bool any(bool f(Section element)) => Collections.any(this, f); | 94 bool any(bool f(Section element)) => IterableMixinWorkaround.any(this, f); |
| 95 void forEach(void f(Section element)) { Collections.forEach(this, f); } | 95 void forEach(void f(Section element)) { IterableMixinWorkaround.forEach(this,
f); } |
| 96 | 96 |
| 97 // TODO(jmesserly): this should be a property | 97 // TODO(jmesserly): this should be a property |
| 98 bool get isEmpty => length == 0; | 98 bool get isEmpty => length == 0; |
| 99 } | 99 } |
| 100 | 100 |
| 101 | 101 |
| 102 /** A collection of data sources representing a page in the UI. */ | 102 /** A collection of data sources representing a page in the UI. */ |
| 103 class Section { | 103 class Section { |
| 104 final String id; | 104 final String id; |
| 105 final String title; | 105 final String title; |
| (...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 235 final hasThumbnail = decoder.readBool(); | 235 final hasThumbnail = decoder.readBool(); |
| 236 final author = decoder.readString(); | 236 final author = decoder.readString(); |
| 237 final dateInSeconds = decoder.readInt(); | 237 final dateInSeconds = decoder.readInt(); |
| 238 final snippet = decoder.readString(); | 238 final snippet = decoder.readString(); |
| 239 final date = | 239 final date = |
| 240 new Date.fromMillisecondsSinceEpoch(dateInSeconds*1000, isUtc: true); | 240 new Date.fromMillisecondsSinceEpoch(dateInSeconds*1000, isUtc: true); |
| 241 return new Article(source, id, date, title, author, srcUrl, hasThumbnail, | 241 return new Article(source, id, date, title, author, srcUrl, hasThumbnail, |
| 242 snippet); | 242 snippet); |
| 243 } | 243 } |
| 244 } | 244 } |
| OLD | NEW |