OLD | NEW |
1 // Data model for complex tests. | 1 // Data model for complex tests. |
2 | 2 |
3 class Person { | 3 class Person { |
4 String name; | 4 String name; |
5 int age; | 5 int age; |
6 List<Search> searches; | 6 List<Search> searches; |
7 | 7 |
8 Person(this.name, this.age, this.searches); | 8 Person(this.name, this.age, this.searches); |
9 } | 9 } |
10 | 10 |
(...skipping 15 matching lines...) Expand all Loading... |
26 static int grandTotal(List<Metric> metrics) { | 26 static int grandTotal(List<Metric> metrics) { |
27 int total = 0; | 27 int total = 0; |
28 for (final metric in metrics) { | 28 for (final metric in metrics) { |
29 total += metric.quantity; | 29 total += metric.quantity; |
30 } | 30 } |
31 | 31 |
32 return total; | 32 return total; |
33 } | 33 } |
34 } | 34 } |
35 | 35 |
36 List<Person> get dataModel() { | 36 List<Person> get dataModel { |
37 List<Person> persons = []; | 37 List<Person> persons = []; |
38 | 38 |
39 List<Search> searches = []; | 39 List<Search> searches = []; |
40 List<Metric> metrics = []; | 40 List<Metric> metrics = []; |
41 | 41 |
42 // Snooki data | 42 // Snooki data |
43 metrics = []; | 43 metrics = []; |
44 metrics.add(new Metric("USA", 200300312)); | 44 metrics.add(new Metric("USA", 200300312)); |
45 searches.add(new Search("intellect", 6, Metric.grandTotal(metrics), metrics)); | 45 searches.add(new Search("intellect", 6, Metric.grandTotal(metrics), metrics)); |
46 | 46 |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
113 metrics.add(new Metric("EU", 50)); | 113 metrics.add(new Metric("EU", 50)); |
114 metrics.add(new Metric("Canada", 0)); | 114 metrics.add(new Metric("Canada", 0)); |
115 metrics.add(new Metric("Mexico", 7801)); | 115 metrics.add(new Metric("Mexico", 7801)); |
116 searches.add(new Search("tasty", 1, Metric.grandTotal(metrics), metrics)); | 116 searches.add(new Search("tasty", 1, Metric.grandTotal(metrics), metrics)); |
117 | 117 |
118 persons.add(new Person("Uggie (Artist dog)", 10, searches)); | 118 persons.add(new Person("Uggie (Artist dog)", 10, searches)); |
119 | 119 |
120 return persons; | 120 return persons; |
121 } | 121 } |
122 | 122 |
OLD | NEW |