| OLD | NEW |
| (Empty) |
| 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 | |
| 3 // BSD-style license that can be found in the LICENSE file. | |
| 4 | |
| 5 part of search_engine; | |
| 6 | |
| 7 | |
| 8 /** | |
| 9 * A [SearchEngine] provides the ability to search for a given string. | |
| 10 */ | |
| 11 abstract class SearchEngine { | |
| 12 /** | |
| 13 * Get the name of the search engine. | |
| 14 */ | |
| 15 String get name; | |
| 16 | |
| 17 /** | |
| 18 * Perform a search for [input]. The returned [Stream] will complete | |
| 19 * when there are no more results. | |
| 20 */ | |
| 21 Stream<SearchResult> search(String input); | |
| 22 } | |
| 23 | |
| 24 | |
| 25 /** | |
| 26 * A [SearchResult] entry, returned by [SearchEngine.search]. | |
| 27 */ | |
| 28 class SearchResult { | |
| 29 /** | |
| 30 * The title of the result. | |
| 31 */ | |
| 32 final String title; | |
| 33 | |
| 34 /** | |
| 35 * The link of the result. | |
| 36 */ | |
| 37 final String link; | |
| 38 | |
| 39 /** | |
| 40 * Create a new [SearchResult] from a title and a link. | |
| 41 */ | |
| 42 SearchResult(this.title, this.link); | |
| 43 } | |
| OLD | NEW |