line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package LaTeX::TikZ::Set::Sequence; |
2
|
|
|
|
|
|
|
|
3
|
10
|
|
|
10
|
|
55
|
use strict; |
|
10
|
|
|
|
|
18
|
|
|
10
|
|
|
|
|
355
|
|
4
|
10
|
|
|
10
|
|
53
|
use warnings; |
|
10
|
|
|
|
|
17
|
|
|
10
|
|
|
|
|
436
|
|
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
=head1 NAME |
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
LaTeX::TikZ::Set::Sequence - A set object grouping a sequence of objects. |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
=head1 VERSION |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
Version 0.02 |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
=cut |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
our $VERSION = '0.02'; |
17
|
|
|
|
|
|
|
|
18
|
10
|
|
|
10
|
|
56
|
use List::Util (); |
|
10
|
|
|
|
|
19
|
|
|
10
|
|
|
|
|
163
|
|
19
|
|
|
|
|
|
|
|
20
|
10
|
|
|
10
|
|
53
|
use LaTeX::TikZ::Scope; |
|
10
|
|
|
|
|
21
|
|
|
10
|
|
|
|
|
196
|
|
21
|
|
|
|
|
|
|
|
22
|
10
|
|
|
10
|
|
53
|
use LaTeX::TikZ::Interface; |
|
10
|
|
|
|
|
24
|
|
|
10
|
|
|
|
|
205
|
|
23
|
10
|
|
|
10
|
|
52
|
use LaTeX::TikZ::Functor; |
|
10
|
|
|
|
|
23
|
|
|
10
|
|
|
|
|
239
|
|
24
|
|
|
|
|
|
|
|
25
|
10
|
|
|
10
|
|
50
|
use Any::Moose; |
|
10
|
|
|
|
|
20
|
|
|
10
|
|
|
|
|
61
|
|
26
|
10
|
|
|
|
|
53
|
use Any::Moose 'Util::TypeConstraints' |
27
|
10
|
|
|
10
|
|
5058
|
=> [ qw/subtype as where find_type_constraint/ ]; |
|
10
|
|
|
|
|
23
|
|
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
=head1 RELATIONSHIPS |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
This class consumes the L<LaTeX::TikZ::Set> and L<LaTeX::TikZ::Set::Mutable> roles, and as such implements the L</draw> and L</add> methods. |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
=cut |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
with qw( |
36
|
|
|
|
|
|
|
LaTeX::TikZ::Set |
37
|
|
|
|
|
|
|
LaTeX::TikZ::Set::Mutable |
38
|
|
|
|
|
|
|
); |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
subtype 'LaTeX::TikZ::Set::Sequence::Elements' |
41
|
|
|
|
|
|
|
=> as 'Object' |
42
|
|
|
|
|
|
|
=> where { |
43
|
|
|
|
|
|
|
$_->does('LaTeX::TikZ::Set::Op') |
44
|
|
|
|
|
|
|
or $_->isa('LaTeX::TikZ::Set::Sequence') |
45
|
|
|
|
|
|
|
}; |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
=head1 ATTRIBUTES |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
=head2 C<kids> |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
The L<LaTeX::TikZ::Set::Op> or L<LaTeX::TikZ::Set::Sequence> objects that from the sequence. |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
=cut |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
has '_kids' => ( |
56
|
|
|
|
|
|
|
is => 'ro', |
57
|
|
|
|
|
|
|
isa => 'Maybe[ArrayRef[LaTeX::TikZ::Set::Sequence::Elements]]', |
58
|
|
|
|
|
|
|
init_arg => 'kids', |
59
|
|
|
|
|
|
|
default => sub { [ ] }, |
60
|
|
|
|
|
|
|
); |
61
|
|
|
|
|
|
|
|
62
|
256
|
|
|
256
|
1
|
997
|
sub kids { @{$_[0]->_kids} } |
|
256
|
|
|
|
|
1427
|
|
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
=head1 METHODS |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
=head2 C<add> |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
=cut |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
my $ltsse_tc = find_type_constraint('LaTeX::TikZ::Set::Sequence::Elements'); |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
sub add { |
73
|
2
|
|
|
2
|
1
|
849
|
my $set = shift; |
74
|
|
|
|
|
|
|
|
75
|
2
|
|
|
|
|
16
|
$ltsse_tc->assert_valid($_) for @_; |
76
|
|
|
|
|
|
|
|
77
|
2
|
|
|
|
|
92
|
push @{$set->_kids}, @_; |
|
2
|
|
|
|
|
12
|
|
78
|
|
|
|
|
|
|
|
79
|
2
|
|
|
|
|
6
|
$set; |
80
|
|
|
|
|
|
|
} |
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
=head2 C<draw> |
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
=cut |
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
sub draw { |
87
|
|
|
|
|
|
|
my $set = shift; |
88
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
List::Util::reduce { LaTeX::TikZ::Scope::fold($a, $b) } |
90
|
|
|
|
|
|
|
map $_->draw(@_), |
91
|
|
|
|
|
|
|
$set->kids; |
92
|
|
|
|
|
|
|
} |
93
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
LaTeX::TikZ::Interface->register( |
95
|
|
|
|
|
|
|
seq => sub { |
96
|
40
|
|
|
40
|
0
|
21436
|
shift; |
97
|
|
|
|
|
|
|
|
98
|
40
|
|
|
|
|
426
|
__PACKAGE__->new(kids => \@_); |
99
|
|
|
|
|
|
|
}, |
100
|
|
|
|
|
|
|
); |
101
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
LaTeX::TikZ::Functor->default_rule( |
103
|
|
|
|
|
|
|
(__PACKAGE__) => sub { |
104
|
|
|
|
|
|
|
my ($functor, $set, @args) = @_; |
105
|
|
|
|
|
|
|
$set->new(kids => [ map $_->$functor(@args), $set->kids ]) |
106
|
|
|
|
|
|
|
} |
107
|
|
|
|
|
|
|
); |
108
|
|
|
|
|
|
|
|
109
|
|
|
|
|
|
|
__PACKAGE__->meta->make_immutable; |
110
|
|
|
|
|
|
|
|
111
|
|
|
|
|
|
|
=head1 SEE ALSO |
112
|
|
|
|
|
|
|
|
113
|
|
|
|
|
|
|
L<LaTeX::TikZ>, L<LaTeX::TikZ::Set::Op>, L<LaTeX::TikZ::Set::Mutable>. |
114
|
|
|
|
|
|
|
|
115
|
|
|
|
|
|
|
=head1 AUTHOR |
116
|
|
|
|
|
|
|
|
117
|
|
|
|
|
|
|
Vincent Pit, C<< <perl at profvince.com> >>, L<http://www.profvince.com>. |
118
|
|
|
|
|
|
|
|
119
|
|
|
|
|
|
|
You can contact me by mail or on C<irc.perl.org> (vincent). |
120
|
|
|
|
|
|
|
|
121
|
|
|
|
|
|
|
=head1 BUGS |
122
|
|
|
|
|
|
|
|
123
|
|
|
|
|
|
|
Please report any bugs or feature requests to C<bug-latex-tikz at rt.cpan.org>, or through the web interface at L<http://rt.cpan.org/NoAuth/ReportBug.html?Queue=LaTeX-TikZ>. |
124
|
|
|
|
|
|
|
I will be notified, and then you'll automatically be notified of progress on your bug as I make changes. |
125
|
|
|
|
|
|
|
|
126
|
|
|
|
|
|
|
=head1 SUPPORT |
127
|
|
|
|
|
|
|
|
128
|
|
|
|
|
|
|
You can find documentation for this module with the perldoc command. |
129
|
|
|
|
|
|
|
|
130
|
|
|
|
|
|
|
perldoc LaTeX::TikZ |
131
|
|
|
|
|
|
|
|
132
|
|
|
|
|
|
|
=head1 COPYRIGHT & LICENSE |
133
|
|
|
|
|
|
|
|
134
|
|
|
|
|
|
|
Copyright 2010 Vincent Pit, all rights reserved. |
135
|
|
|
|
|
|
|
|
136
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. |
137
|
|
|
|
|
|
|
|
138
|
|
|
|
|
|
|
=cut |
139
|
|
|
|
|
|
|
|
140
|
|
|
|
|
|
|
1; # End of LaTeX::TikZ::Set::Sequence |