line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
# $Id: DbxrefSet.pm 2014-06-06 erick.antezana $ |
2
|
|
|
|
|
|
|
# |
3
|
|
|
|
|
|
|
# Module : DbxrefSet.pm |
4
|
|
|
|
|
|
|
# Purpose : Reference structure set. |
5
|
|
|
|
|
|
|
# License : Copyright (c) 2006-2014 by Erick Antezana. All rights reserved. |
6
|
|
|
|
|
|
|
# This program is free software; you can redistribute it and/or |
7
|
|
|
|
|
|
|
# modify it under the same terms as Perl itself. |
8
|
|
|
|
|
|
|
# Contact : Erick Antezana |
9
|
|
|
|
|
|
|
# |
10
|
|
|
|
|
|
|
package OBO::Util::DbxrefSet; |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
our @ISA = qw(OBO::Util::ObjectSet); |
13
|
19
|
|
|
19
|
|
8628
|
use OBO::Util::ObjectSet; |
|
19
|
|
|
|
|
25
|
|
|
19
|
|
|
|
|
461
|
|
14
|
|
|
|
|
|
|
|
15
|
19
|
|
|
19
|
|
135
|
use strict; |
|
19
|
|
|
|
|
22
|
|
|
19
|
|
|
|
|
505
|
|
16
|
19
|
|
|
19
|
|
76
|
use warnings; |
|
19
|
|
|
|
|
22
|
|
|
19
|
|
|
|
|
3033
|
|
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
# TODO Values in dbxref lists should be ordered alphabetically on the dbxref name. |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
=head2 equals |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
Usage - $set->equals($another_dbxref_set) |
23
|
|
|
|
|
|
|
Returns - either 1 (true) or 0 (false) |
24
|
|
|
|
|
|
|
Args - the set (OBO::Util::DbxrefSet) to compare with |
25
|
|
|
|
|
|
|
Function - tells whether this set is equal to the given one |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
=cut |
28
|
|
|
|
|
|
|
sub equals { |
29
|
76
|
|
|
76
|
1
|
70
|
my $self = shift; |
30
|
76
|
|
|
|
|
71
|
my $result = 0; # I guess they'are NOT identical |
31
|
|
|
|
|
|
|
|
32
|
76
|
50
|
|
|
|
130
|
if (@_) { |
33
|
76
|
|
|
|
|
67
|
my $other_set = shift; |
34
|
76
|
|
|
|
|
96
|
my %count = (); |
35
|
|
|
|
|
|
|
|
36
|
76
|
|
|
|
|
78
|
my @this = sort values %{$self->{MAP}}; |
|
76
|
|
|
|
|
312
|
|
37
|
76
|
|
|
|
|
189
|
my @that = $other_set->get_set(); |
38
|
|
|
|
|
|
|
|
39
|
76
|
100
|
|
|
|
174
|
if ($#this == $#that) { |
40
|
75
|
100
|
|
|
|
105
|
if ($#this != -1) { |
41
|
57
|
|
|
|
|
79
|
foreach (@this, @that) { |
42
|
288
|
|
|
|
|
438
|
$count{$_->name().$_->description().$_->modifier()}++; |
43
|
|
|
|
|
|
|
} |
44
|
57
|
|
|
|
|
164
|
foreach my $count (sort values %count) { |
45
|
144
|
50
|
|
|
|
169
|
if ($count != 2) { |
46
|
0
|
|
|
|
|
0
|
$result = 0; |
47
|
0
|
|
|
|
|
0
|
last; |
48
|
|
|
|
|
|
|
} else { |
49
|
144
|
|
|
|
|
229
|
$result = 1; |
50
|
|
|
|
|
|
|
} |
51
|
|
|
|
|
|
|
} |
52
|
|
|
|
|
|
|
} else { |
53
|
18
|
|
|
|
|
31
|
$result = 1; # they are equal: empty arrays |
54
|
|
|
|
|
|
|
} |
55
|
|
|
|
|
|
|
} |
56
|
|
|
|
|
|
|
} |
57
|
76
|
|
|
|
|
220
|
return $result; |
58
|
|
|
|
|
|
|
} |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
1; |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
__END__ |