| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package Geometry::Primitive::Dimension; |
|
2
|
1
|
|
|
1
|
|
33844
|
use Moose; |
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
use Moose::Util::TypeConstraints; |
|
4
|
|
|
|
|
|
|
use MooseX::Storage; |
|
5
|
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
with qw(Geometry::Primitive::Equal MooseX::Clone MooseX::Storage::Deferred); |
|
7
|
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
use overload ('""' => 'to_string'); |
|
9
|
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
has 'height' => ( |
|
11
|
|
|
|
|
|
|
is => 'rw', |
|
12
|
|
|
|
|
|
|
isa => 'Num', |
|
13
|
|
|
|
|
|
|
default => 0, |
|
14
|
|
|
|
|
|
|
); |
|
15
|
|
|
|
|
|
|
has 'width' => ( |
|
16
|
|
|
|
|
|
|
is => 'rw', |
|
17
|
|
|
|
|
|
|
isa => 'Num', |
|
18
|
|
|
|
|
|
|
default => 0 |
|
19
|
|
|
|
|
|
|
); |
|
20
|
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
coerce 'Geometry::Primitive::Dimension' |
|
22
|
|
|
|
|
|
|
=> from 'ArrayRef' |
|
23
|
|
|
|
|
|
|
=> via { Geometry::Primitive::Dimension->new(width => $_->[0], height => $_->[1]) }; |
|
24
|
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
sub equal_to { |
|
26
|
|
|
|
|
|
|
my ($self, $other) = @_; |
|
27
|
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
return (($self->width == $other->width) && $self->height == $other->height); |
|
29
|
|
|
|
|
|
|
} |
|
30
|
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
sub to_string { |
|
32
|
|
|
|
|
|
|
my ($self) = @_; |
|
33
|
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
return $self->width.'x'.$self->height; |
|
35
|
|
|
|
|
|
|
} |
|
36
|
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
__PACKAGE__->meta->make_immutable; |
|
38
|
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
no Moose; |
|
40
|
|
|
|
|
|
|
1; |
|
41
|
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
=head1 NAME |
|
43
|
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
Geometry::Primitive::Dimension - A width and height |
|
45
|
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
=head1 DESCRIPTION |
|
47
|
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
Geometry::Primitive::Dimension encapsulates a height and width. |
|
49
|
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
=head1 SYNOPSIS |
|
51
|
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
use Geometry::Primitive::Dimension; |
|
53
|
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
my $point = Geometry::Primitive::Dimeions->new(width => 100, height => 100); |
|
55
|
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
=head1 ATTRIBUTES |
|
57
|
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
=head2 height |
|
59
|
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
Set/Get the height value. |
|
61
|
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
=head2 width |
|
63
|
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
Set/Get the width value. |
|
65
|
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
=head1 METHODS |
|
67
|
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
=head2 new |
|
69
|
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
Creates a new Geometry::Primitive::Point. |
|
71
|
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
=head2 equal_to |
|
73
|
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
Compares this dimesion to another. |
|
75
|
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
=head2 to_string |
|
77
|
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
Return this dimesion as a string $widthx$height |
|
79
|
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
=head1 AUTHOR |
|
81
|
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
Cory Watson <gphat@cpan.org> |
|
83
|
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
=head1 COPYRIGHT & LICENSE |
|
85
|
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
You can redistribute and/or modify this code under the same terms as Perl |
|
87
|
|
|
|
|
|
|
itself. |