1 package LaTeX::TikZ::Set::Sequence;
8 LaTeX::TikZ::Set::Sequence - A set object grouping a sequence of objects.
16 our $VERSION = '0.02';
20 use LaTeX::TikZ::Scope;
22 use LaTeX::TikZ::Interface;
23 use LaTeX::TikZ::Functor;
26 use Any::Moose 'Util::TypeConstraints'
27 => [ qw/subtype as where find_type_constraint/ ];
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.
37 LaTeX::TikZ::Set::Mutable
40 subtype 'LaTeX::TikZ::Set::Sequence::Elements'
43 $_->does('LaTeX::TikZ::Set::Op')
44 or $_->isa('LaTeX::TikZ::Set::Sequence')
51 The L<LaTeX::TikZ::Set::Op> or L<LaTeX::TikZ::Set::Sequence> objects that from the sequence.
57 isa => 'Maybe[ArrayRef[LaTeX::TikZ::Set::Sequence::Elements]]',
59 default => sub { [ ] },
62 sub kids { @{$_[0]->_kids} }
70 my $ltsse_tc = find_type_constraint('LaTeX::TikZ::Set::Sequence::Elements');
75 $ltsse_tc->assert_valid($_) for @_;
77 push @{$set->_kids}, @_;
89 my @kids = $set->kids;
90 return [ ] unless @kids;
92 List::Util::reduce { LaTeX::TikZ::Scope::fold($a, $b) }
97 LaTeX::TikZ::Interface->register(
101 __PACKAGE__->new(kids => \@_);
105 LaTeX::TikZ::Functor->default_rule(
106 (__PACKAGE__) => sub {
107 my ($functor, $set, @args) = @_;
108 $set->new(kids => [ map $_->$functor(@args), $set->kids ])
112 __PACKAGE__->meta->make_immutable;
116 L<LaTeX::TikZ>, L<LaTeX::TikZ::Set::Op>, L<LaTeX::TikZ::Set::Mutable>.
120 Vincent Pit, C<< <perl at profvince.com> >>, L<http://www.profvince.com>.
122 You can contact me by mail or on C<irc.perl.org> (vincent).
126 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>.
127 I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.
131 You can find documentation for this module with the perldoc command.
135 =head1 COPYRIGHT & LICENSE
137 Copyright 2010 Vincent Pit, all rights reserved.
139 This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
143 1; # End of LaTeX::TikZ::Set::Sequence