OLD | NEW |
1 part of dart.math; | 1 part of dart.math; |
2 abstract class _RectangleBase<T extends num> {const _RectangleBase(); | 2 abstract class _RectangleBase<T extends num> {const _RectangleBase(); |
3 T get left; | 3 T get left; |
4 T get top; | 4 T get top; |
5 T get width; | 5 T get width; |
6 T get height; | 6 T get height; |
7 T get right => ((__x7) => DDC$RT.cast(__x7, num, T, "CastGeneral", """line 33,
column 18 of dart:math/rectangle.dart: """, __x7 is T, false))(left + width); | 7 T get right => ((__x7) => DEVC$RT.cast(__x7, num, T, "CastGeneral", """line 33,
column 18 of dart:math/rectangle.dart: """, __x7 is T, false))(left + width); |
8 T get bottom => ((__x8) => DDC$RT.cast(__x8, num, T, "CastGeneral", """line 35,
column 19 of dart:math/rectangle.dart: """, __x8 is T, false))(top + height); | 8 T get bottom => ((__x8) => DEVC$RT.cast(__x8, num, T, "CastGeneral", """line 35
, column 19 of dart:math/rectangle.dart: """, __x8 is T, false))(top + height); |
9 String toString() { | 9 String toString() { |
10 return 'Rectangle ($left, $top) $width x $height'; | 10 return 'Rectangle ($left, $top) $width x $height'; |
11 } | 11 } |
12 bool operator ==(other) { | 12 bool operator ==(other) { |
13 if (other is! Rectangle) return false; | 13 if (other is! Rectangle) return false; |
14 return left == other.left && top == other.top && right == other.right && bott
om == other.bottom; | 14 return left == other.left && top == other.top && right == other.right && bott
om == other.bottom; |
15 } | 15 } |
16 int get hashCode => _JenkinsSmiHash.hash4(left.hashCode, top.hashCode, right.ha
shCode, bottom.hashCode); | 16 int get hashCode => _JenkinsSmiHash.hash4(left.hashCode, top.hashCode, right.ha
shCode, bottom.hashCode); |
17 Rectangle<T> intersection(Rectangle<T> other) { | 17 Rectangle<T> intersection(Rectangle<T> other) { |
18 var x0 = max(left, other.left); | 18 var x0 = max(left, other.left); |
19 var x1 = min(left + width, other.left + other.width); | 19 var x1 = min(left + width, other.left + other.width); |
20 if (x0 <= x1) { | 20 if (x0 <= x1) { |
21 var y0 = max(top, other.top); | 21 var y0 = max(top, other.top); |
22 var y1 = min(top + height, other.top + other.height); | 22 var y1 = min(top + height, other.top + other.height); |
23 if (y0 <= y1) { | 23 if (y0 <= y1) { |
24 return new Rectangle<T>(DDC$RT.cast(x0, num, T, "CastGeneral", """line 68,
column 33 of dart:math/rectangle.dart: """, x0 is T, false), DDC$RT.cast(y0, nu
m, T, "CastGeneral", """line 68, column 37 of dart:math/rectangle.dart: """, y0
is T, false), ((__x9) => DDC$RT.cast(__x9, num, T, "CastGeneral", """line 68, co
lumn 41 of dart:math/rectangle.dart: """, __x9 is T, false))(x1 - x0), ((__x10)
=> DDC$RT.cast(__x10, num, T, "CastGeneral", """line 68, column 50 of dart:math/
rectangle.dart: """, __x10 is T, false))(y1 - y0)); | 24 return new Rectangle<T>(DEVC$RT.cast(x0, num, T, "CastGeneral", """line 68
, column 33 of dart:math/rectangle.dart: """, x0 is T, false), DEVC$RT.cast(y0,
num, T, "CastGeneral", """line 68, column 37 of dart:math/rectangle.dart: """, y
0 is T, false), ((__x9) => DEVC$RT.cast(__x9, num, T, "CastGeneral", """line 68,
column 41 of dart:math/rectangle.dart: """, __x9 is T, false))(x1 - x0), ((__x1
0) => DEVC$RT.cast(__x10, num, T, "CastGeneral", """line 68, column 50 of dart:m
ath/rectangle.dart: """, __x10 is T, false))(y1 - y0)); |
25 } | 25 } |
26 } | 26 } |
27 return null; | 27 return null; |
28 } | 28 } |
29 bool intersects(Rectangle<num> other) { | 29 bool intersects(Rectangle<num> other) { |
30 return (left <= other.left + other.width && other.left <= left + width && top
<= other.top + other.height && other.top <= top + height); | 30 return (left <= other.left + other.width && other.left <= left + width && top
<= other.top + other.height && other.top <= top + height); |
31 } | 31 } |
32 Rectangle<T> boundingBox(Rectangle<T> other) { | 32 Rectangle<T> boundingBox(Rectangle<T> other) { |
33 var right = max(this.left + this.width, other.left + other.width); | 33 var right = max(this.left + this.width, other.left + other.width); |
34 var bottom = max(this.top + this.height, other.top + other.height); | 34 var bottom = max(this.top + this.height, other.top + other.height); |
35 var left = min(this.left, other.left); | 35 var left = min(this.left, other.left); |
36 var top = min(this.top, other.top); | 36 var top = min(this.top, other.top); |
37 return new Rectangle<T>(DDC$RT.cast(left, num, T, "CastGeneral", """line 95,
column 29 of dart:math/rectangle.dart: """, left is T, false), DDC$RT.cast(top,
num, T, "CastGeneral", """line 95, column 35 of dart:math/rectangle.dart: """, t
op is T, false), ((__x11) => DDC$RT.cast(__x11, num, T, "CastGeneral", """line 9
5, column 40 of dart:math/rectangle.dart: """, __x11 is T, false))(right - left)
, ((__x12) => DDC$RT.cast(__x12, num, T, "CastGeneral", """line 95, column 54 of
dart:math/rectangle.dart: """, __x12 is T, false))(bottom - top)); | 37 return new Rectangle<T>(DEVC$RT.cast(left, num, T, "CastGeneral", """line 95,
column 29 of dart:math/rectangle.dart: """, left is T, false), DEVC$RT.cast(top
, num, T, "CastGeneral", """line 95, column 35 of dart:math/rectangle.dart: """,
top is T, false), ((__x11) => DEVC$RT.cast(__x11, num, T, "CastGeneral", """lin
e 95, column 40 of dart:math/rectangle.dart: """, __x11 is T, false))(right - le
ft), ((__x12) => DEVC$RT.cast(__x12, num, T, "CastGeneral", """line 95, column 5
4 of dart:math/rectangle.dart: """, __x12 is T, false))(bottom - top)); |
38 } | 38 } |
39 bool containsRectangle(Rectangle<num> another) { | 39 bool containsRectangle(Rectangle<num> another) { |
40 return left <= another.left && left + width >= another.left + another.width &&
top <= another.top && top + height >= another.top + another.height; | 40 return left <= another.left && left + width >= another.left + another.width &&
top <= another.top && top + height >= another.top + another.height; |
41 } | 41 } |
42 bool containsPoint(Point<num> another) { | 42 bool containsPoint(Point<num> another) { |
43 return another.x >= left && another.x <= left + width && another.y >= top && a
nother.y <= top + height; | 43 return another.x >= left && another.x <= left + width && another.y >= top && a
nother.y <= top + height; |
44 } | 44 } |
45 Point<T> get topLeft => new Point<T>(this.left, this.top); | 45 Point<T> get topLeft => new Point<T>(this.left, this.top); |
46 Point<T> get topRight => new Point<T>(((__x13) => DDC$RT.cast(__x13, num, T, "C
astGeneral", """line 119, column 41 of dart:math/rectangle.dart: """, __x13 is T
, false))(this.left + this.width), this.top); | 46 Point<T> get topRight => new Point<T>(((__x13) => DEVC$RT.cast(__x13, num, T, "
CastGeneral", """line 119, column 41 of dart:math/rectangle.dart: """, __x13 is
T, false))(this.left + this.width), this.top); |
47 Point<T> get bottomRight => new Point<T>(((__x14) => DDC$RT.cast(__x14, num, T,
"CastGeneral", """line 120, column 44 of dart:math/rectangle.dart: """, __x14 i
s T, false))(this.left + this.width), ((__x15) => DDC$RT.cast(__x15, num, T, "Ca
stGeneral", """line 121, column 7 of dart:math/rectangle.dart: """, __x15 is T,
false))(this.top + this.height)); | 47 Point<T> get bottomRight => new Point<T>(((__x14) => DEVC$RT.cast(__x14, num, T
, "CastGeneral", """line 120, column 44 of dart:math/rectangle.dart: """, __x14
is T, false))(this.left + this.width), ((__x15) => DEVC$RT.cast(__x15, num, T, "
CastGeneral", """line 121, column 7 of dart:math/rectangle.dart: """, __x15 is T
, false))(this.top + this.height)); |
48 Point<T> get bottomLeft => new Point<T>(this.left, ((__x16) => DDC$RT.cast(__x1
6, num, T, "CastGeneral", """line 123, column 7 of dart:math/rectangle.dart: """
, __x16 is T, false))(this.top + this.height)); | 48 Point<T> get bottomLeft => new Point<T>(this.left, ((__x16) => DEVC$RT.cast(__x
16, num, T, "CastGeneral", """line 123, column 7 of dart:math/rectangle.dart: ""
", __x16 is T, false))(this.top + this.height)); |
49 } | 49 } |
50 class Rectangle<T extends num> extends _RectangleBase<T> {final T left; | 50 class Rectangle<T extends num> extends _RectangleBase<T> {final T left; |
51 final T top; | 51 final T top; |
52 final T width; | 52 final T width; |
53 final T height; | 53 final T height; |
54 const Rectangle(this.left, this.top, T width, T height) : this.width = (width <
0) ? -width * 0 : width, this.height = (height < 0) ? -height * 0 : height; | 54 const Rectangle(this.left, this.top, T width, T height) : this.width = (width <
0) ? -width * 0 : width, this.height = (height < 0) ? -height * 0 : height; |
55 factory Rectangle.fromPoints(Point<T> a, Point<T> b) { | 55 factory Rectangle.fromPoints(Point<T> a, Point<T> b) { |
56 T left = ((__x17) => DDC$RT.cast(__x17, num, T, "CastGeneral", """line 167, colu
mn 14 of dart:math/rectangle.dart: """, __x17 is T, false))(min(a.x, b.x)); | 56 T left = ((__x17) => DEVC$RT.cast(__x17, num, T, "CastGeneral", """line 167, col
umn 14 of dart:math/rectangle.dart: """, __x17 is T, false))(min(a.x, b.x)); |
57 T width = ((__x18) => DDC$RT.cast(__x18, num, T, "CastGeneral", """line 168, co
lumn 15 of dart:math/rectangle.dart: """, __x18 is T, false))(max(a.x, b.x) - le
ft); | 57 T width = ((__x18) => DEVC$RT.cast(__x18, num, T, "CastGeneral", """line 168, c
olumn 15 of dart:math/rectangle.dart: """, __x18 is T, false))(max(a.x, b.x) - l
eft); |
58 T top = ((__x19) => DDC$RT.cast(__x19, num, T, "CastGeneral", """line 169, colu
mn 13 of dart:math/rectangle.dart: """, __x19 is T, false))(min(a.y, b.y)); | 58 T top = ((__x19) => DEVC$RT.cast(__x19, num, T, "CastGeneral", """line 169, col
umn 13 of dart:math/rectangle.dart: """, __x19 is T, false))(min(a.y, b.y)); |
59 T height = ((__x20) => DDC$RT.cast(__x20, num, T, "CastGeneral", """line 170, c
olumn 16 of dart:math/rectangle.dart: """, __x20 is T, false))(max(a.y, b.y) - t
op); | 59 T height = ((__x20) => DEVC$RT.cast(__x20, num, T, "CastGeneral", """line 170,
column 16 of dart:math/rectangle.dart: """, __x20 is T, false))(max(a.y, b.y) -
top); |
60 return new Rectangle<T>(left, top, width, height); | 60 return new Rectangle<T>(left, top, width, height); |
61 } | 61 } |
62 } | 62 } |
63 class MutableRectangle<T extends num> extends _RectangleBase<T> implements Rect
angle<T> {T left; | 63 class MutableRectangle<T extends num> extends _RectangleBase<T> implements Rect
angle<T> {T left; |
64 T top; | 64 T top; |
65 T _width; | 65 T _width; |
66 T _height; | 66 T _height; |
67 MutableRectangle(this.left, this.top, T width, T height) : this._width = ((__x2
1) => DDC$RT.cast(__x21, dynamic, T, "CastGeneral", """line 212, column 23 of da
rt:math/rectangle.dart: """, __x21 is T, false))((width < 0) ? _clampToZero(widt
h) : width), this._height = ((__x22) => DDC$RT.cast(__x22, dynamic, T, "CastGene
ral", """line 213, column 24 of dart:math/rectangle.dart: """, __x22 is T, false
))((height < 0) ? _clampToZero(height) : height); | 67 MutableRectangle(this.left, this.top, T width, T height) : this._width = ((__x2
1) => DEVC$RT.cast(__x21, dynamic, T, "CastGeneral", """line 212, column 23 of d
art:math/rectangle.dart: """, __x21 is T, false))((width < 0) ? _clampToZero(wid
th) : width), this._height = ((__x22) => DEVC$RT.cast(__x22, dynamic, T, "CastGe
neral", """line 213, column 24 of dart:math/rectangle.dart: """, __x22 is T, fal
se))((height < 0) ? _clampToZero(height) : height); |
68 factory MutableRectangle.fromPoints(Point<T> a, Point<T> b) { | 68 factory MutableRectangle.fromPoints(Point<T> a, Point<T> b) { |
69 T left = ((__x23) => DDC$RT.cast(__x23, num, T, "CastGeneral", """line 228, colu
mn 14 of dart:math/rectangle.dart: """, __x23 is T, false))(min(a.x, b.x)); | 69 T left = ((__x23) => DEVC$RT.cast(__x23, num, T, "CastGeneral", """line 228, col
umn 14 of dart:math/rectangle.dart: """, __x23 is T, false))(min(a.x, b.x)); |
70 T width = ((__x24) => DDC$RT.cast(__x24, num, T, "CastGeneral", """line 229, co
lumn 15 of dart:math/rectangle.dart: """, __x24 is T, false))(max(a.x, b.x) - le
ft); | 70 T width = ((__x24) => DEVC$RT.cast(__x24, num, T, "CastGeneral", """line 229, c
olumn 15 of dart:math/rectangle.dart: """, __x24 is T, false))(max(a.x, b.x) - l
eft); |
71 T top = ((__x25) => DDC$RT.cast(__x25, num, T, "CastGeneral", """line 230, colu
mn 13 of dart:math/rectangle.dart: """, __x25 is T, false))(min(a.y, b.y)); | 71 T top = ((__x25) => DEVC$RT.cast(__x25, num, T, "CastGeneral", """line 230, col
umn 13 of dart:math/rectangle.dart: """, __x25 is T, false))(min(a.y, b.y)); |
72 T height = ((__x26) => DDC$RT.cast(__x26, num, T, "CastGeneral", """line 231, c
olumn 16 of dart:math/rectangle.dart: """, __x26 is T, false))(max(a.y, b.y) - t
op); | 72 T height = ((__x26) => DEVC$RT.cast(__x26, num, T, "CastGeneral", """line 231,
column 16 of dart:math/rectangle.dart: """, __x26 is T, false))(max(a.y, b.y) -
top); |
73 return new MutableRectangle<T>(left, top, width, height); | 73 return new MutableRectangle<T>(left, top, width, height); |
74 } | 74 } |
75 T get width => _width; | 75 T get width => _width; |
76 void set width(T width) { | 76 void set width(T width) { |
77 if (width < 0) width = ((__x27) => DDC$RT.cast(__x27, num, T, "CastGeneral", """
line 247, column 28 of dart:math/rectangle.dart: """, __x27 is T, false))(_clamp
ToZero(width)); | 77 if (width < 0) width = ((__x27) => DEVC$RT.cast(__x27, num, T, "CastGeneral", ""
"line 247, column 28 of dart:math/rectangle.dart: """, __x27 is T, false))(_clam
pToZero(width)); |
78 _width = width; | 78 _width = width; |
79 } | 79 } |
80 T get height => _height; | 80 T get height => _height; |
81 void set height(T height) { | 81 void set height(T height) { |
82 if (height < 0) height = ((__x28) => DDC$RT.cast(__x28, num, T, "CastGeneral", "
""line 263, column 30 of dart:math/rectangle.dart: """, __x28 is T, false))(_cla
mpToZero(height)); | 82 if (height < 0) height = ((__x28) => DEVC$RT.cast(__x28, num, T, "CastGeneral",
"""line 263, column 30 of dart:math/rectangle.dart: """, __x28 is T, false))(_cl
ampToZero(height)); |
83 _height = height; | 83 _height = height; |
84 } | 84 } |
85 } | 85 } |
86 num _clampToZero(num value) { | 86 num _clampToZero(num value) { |
87 assert (value < 0); return -value * 0; | 87 assert (value < 0); return -value * 0; |
88 } | 88 } |
OLD | NEW |