po: Update German man pages translation
[dpkg.git] / scripts / Dpkg / Deps / Union.pm
blob3da8ce090d3731bb8673e011481049e975acc2b8
1 # Copyright © 1998 Richard Braakman
2 # Copyright © 1999 Darren Benham
3 # Copyright © 2000 Sean 'Shaleh' Perry
4 # Copyright © 2004 Frank Lichtenheld
5 # Copyright © 2006 Russ Allbery
6 # Copyright © 2007-2009 Raphaël Hertzog <hertzog@debian.org>
7 # Copyright © 2008-2009, 2012-2014 Guillem Jover <guillem@debian.org>
9 # This program is free software; you may redistribute it and/or modify
10 # it under the terms of the GNU General Public License as published by
11 # the Free Software Foundation; either version 2 of the License, or
12 # (at your option) any later version.
14 # This is distributed in the hope that it will be useful,
15 # but WITHOUT ANY WARRANTY; without even the implied warranty of
16 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 # GNU General Public License for more details.
19 # You should have received a copy of the GNU General Public License
20 # along with this program. If not, see <https://www.gnu.org/licenses/>.
22 =encoding utf8
24 =head1 NAME
26 Dpkg::Deps::Union - list of unrelated dependencies
28 =head1 DESCRIPTION
30 This class represents a list of relationships.
31 It inherits from L<Dpkg::Deps::Multiple>.
33 =cut
35 package Dpkg::Deps::Union 1.00;
37 use strict;
38 use warnings;
40 use parent qw(Dpkg::Deps::Multiple);
42 =head1 METHODS
44 =over 4
46 =item $dep->output([$fh])
48 The output() method uses ", " to join the list of relationships.
50 =cut
52 sub output {
53 my ($self, $fh) = @_;
55 my $res = join(', ', map {
56 $_->output()
57 } grep {
58 not $_->is_empty()
59 } $self->get_deps());
61 if (defined $fh) {
62 print { $fh } $res;
64 return $res;
67 =item $dep->implies($other_dep)
69 =item $dep->get_evaluation($other_dep)
71 These methods are not meaningful for this object and always return undef.
73 =cut
75 sub implies {
76 # Implication test is not useful on Union.
77 return;
80 sub get_evaluation {
81 # Evaluation is not useful on Union.
82 return;
85 =item $dep->simplify_deps($facts)
87 The simplification is done to generate an union of all the relationships.
88 It uses $simple_dep->merge_union($other_dep) to get its job done.
90 =cut
92 sub simplify_deps {
93 my ($self, $facts) = @_;
94 my @new;
96 WHILELOOP:
97 while (@{$self->{list}}) {
98 my $odep = shift @{$self->{list}};
99 foreach my $dep (@new) {
100 next WHILELOOP if $dep->merge_union($odep);
102 push @new, $odep;
104 $self->{list} = [ @new ];
107 =back
109 =head1 CHANGES
111 =head2 Version 1.00 (dpkg 1.15.6)
113 Mark the module as public.
115 =cut