Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(157)

Side by Side Diff: editor/util/debuggertest/pets.dart

Issue 10829459: Deprecate Math object in corelib in favor of dart:math library. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Address review comments. Created 8 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « corelib/src/math.dart ('k') | lib/compiler/implementation/lib/core.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 1
2 #library("pets"); 2 #library("pets");
3 3
4 #import('dart:math');
5
4 final num MAX_CATS = 10; 6 final num MAX_CATS = 10;
5 7
6 final SPARKY = const Cat("Sparky"); 8 final SPARKY = const Cat("Sparky");
7 9
8 interface Animal { 10 interface Animal {
9 bool livesWith(Animal other); 11 bool livesWith(Animal other);
10 void performAction(); 12 void performAction();
11 } 13 }
12 14
13 class Cat implements Animal { 15 class Cat implements Animal {
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
45 47
46 String name; 48 String name;
47 49
48 bool collar; 50 bool collar;
49 51
50 int fleaCount; 52 int fleaCount;
51 53
52 Date bornOn; 54 Date bornOn;
53 55
54 Dog(this.name) { 56 Dog(this.name) {
55 fleaCount = (Math.random() * 10.0).round().toInt(); 57 var rand = new Random();
58 fleaCount = rand.nextInt(10);
56 bornOn = new Date.now(); 59 bornOn = new Date.now();
57 } 60 }
58 61
59 Dog.withFleas(this.name, this.fleaCount) { 62 Dog.withFleas(this.name, this.fleaCount) {
60 bornOn = new Date.now(); 63 bornOn = new Date.now();
61 } 64 }
62 65
63 bool livesWith(Animal other) => true; 66 bool livesWith(Animal other) => true;
64 67
65 void performAction() { 68 void performAction() {
(...skipping 25 matching lines...) Expand all
91 } 94 }
92 95
93 return map; 96 return map;
94 } 97 }
95 98
96 void testInfinity() { 99 void testInfinity() {
97 var infTest = 1 / 0; 100 var infTest = 1 / 0;
98 101
99 print(infTest); // Infinity 102 print(infTest); // Infinity
100 } 103 }
OLDNEW
« no previous file with comments | « corelib/src/math.dart ('k') | lib/compiler/implementation/lib/core.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698