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-2015 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
|
|
11197
|
use OBO::Util::ObjectSet; |
|
19
|
|
|
|
|
43
|
|
|
19
|
|
|
|
|
471
|
|
14
|
|
|
|
|
|
|
|
15
|
19
|
|
|
19
|
|
95
|
use strict; |
|
19
|
|
|
|
|
35
|
|
|
19
|
|
|
|
|
383
|
|
16
|
19
|
|
|
19
|
|
99
|
use warnings; |
|
19
|
|
|
|
|
27
|
|
|
19
|
|
|
|
|
3812
|
|
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
|
124
|
my $self = shift; |
30
|
76
|
|
|
|
|
110
|
my $result = 0; # I guess they'are NOT identical |
31
|
|
|
|
|
|
|
|
32
|
76
|
50
|
|
|
|
205
|
if (@_) { |
33
|
76
|
|
|
|
|
108
|
my $other_set = shift; |
34
|
76
|
|
|
|
|
156
|
my %count = (); |
35
|
|
|
|
|
|
|
|
36
|
76
|
|
|
|
|
108
|
my @this = sort values %{$self->{MAP}}; |
|
76
|
|
|
|
|
473
|
|
37
|
76
|
|
|
|
|
300
|
my @that = $other_set->get_set(); |
38
|
|
|
|
|
|
|
|
39
|
76
|
100
|
|
|
|
267
|
if ($#this == $#that) { |
40
|
75
|
100
|
|
|
|
169
|
if ($#this != -1) { |
41
|
57
|
|
|
|
|
131
|
foreach (@this, @that) { |
42
|
288
|
|
|
|
|
857
|
$count{$_->name().$_->description().$_->modifier()}++; |
43
|
|
|
|
|
|
|
} |
44
|
57
|
|
|
|
|
234
|
foreach my $count (sort values %count) { |
45
|
144
|
50
|
|
|
|
329
|
if ($count != 2) { |
46
|
0
|
|
|
|
|
0
|
$result = 0; |
47
|
0
|
|
|
|
|
0
|
last; |
48
|
|
|
|
|
|
|
} else { |
49
|
144
|
|
|
|
|
382
|
$result = 1; |
50
|
|
|
|
|
|
|
} |
51
|
|
|
|
|
|
|
} |
52
|
|
|
|
|
|
|
} else { |
53
|
18
|
|
|
|
|
51
|
$result = 1; # they are equal: empty arrays |
54
|
|
|
|
|
|
|
} |
55
|
|
|
|
|
|
|
} |
56
|
|
|
|
|
|
|
} |
57
|
76
|
|
|
|
|
345
|
return $result; |
58
|
|
|
|
|
|
|
} |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
1; |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
__END__ |