| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
# $Id: InstanceSet.pm 2014-06-06 erick.antezana $ |
|
2
|
|
|
|
|
|
|
# |
|
3
|
|
|
|
|
|
|
# Module : InstanceSet.pm |
|
4
|
|
|
|
|
|
|
# Purpose : Instance 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::InstanceSet; |
|
11
|
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
our @ISA = qw(OBO::Util::ObjectSet); |
|
13
|
13
|
|
|
13
|
|
6846
|
use OBO::Util::ObjectSet; |
|
|
13
|
|
|
|
|
24
|
|
|
|
13
|
|
|
|
|
314
|
|
|
14
|
|
|
|
|
|
|
|
|
15
|
13
|
|
|
13
|
|
49
|
use strict; |
|
|
13
|
|
|
|
|
16
|
|
|
|
13
|
|
|
|
|
299
|
|
|
16
|
13
|
|
|
13
|
|
52
|
use warnings; |
|
|
13
|
|
|
|
|
99
|
|
|
|
13
|
|
|
|
|
1547
|
|
|
17
|
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
=head2 contains_id |
|
19
|
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
Usage - $set->contains_id($element_id) |
|
21
|
|
|
|
|
|
|
Returns - true if this set contains an element with the given ID |
|
22
|
|
|
|
|
|
|
Args - the ID to be checked |
|
23
|
|
|
|
|
|
|
Function - checks if this set constains an element with the given ID |
|
24
|
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
=cut |
|
26
|
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
sub contains_id { |
|
28
|
2
|
|
|
2
|
1
|
4
|
my ($self, $id) = @_; |
|
29
|
2
|
100
|
|
|
|
10
|
return ($self->{MAP}->{$id})?1:0; |
|
30
|
|
|
|
|
|
|
} |
|
31
|
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
=head2 contains_name |
|
33
|
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
Usage - $set->contains_name($element_name) |
|
35
|
|
|
|
|
|
|
Returns - true if this set contains an element with the given name |
|
36
|
|
|
|
|
|
|
Args - the name to be checked |
|
37
|
|
|
|
|
|
|
Function - checks if this set constains an element with the given name |
|
38
|
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
=cut |
|
40
|
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
sub contains_name { |
|
42
|
2
|
|
|
2
|
1
|
4
|
my $self = shift; |
|
43
|
2
|
|
|
|
|
3
|
my $result = 0; |
|
44
|
2
|
50
|
|
|
|
5
|
if (@_) { |
|
45
|
2
|
|
|
|
|
4
|
my $term_id = shift; |
|
46
|
|
|
|
|
|
|
|
|
47
|
2
|
|
|
|
|
1
|
foreach my $ele (sort values %{$self->{MAP}}){ |
|
|
2
|
|
|
|
|
18
|
|
|
48
|
12
|
100
|
|
|
|
19
|
if ($ele->name() eq $term_id) { |
|
49
|
1
|
|
|
|
|
2
|
$result = 1; |
|
50
|
1
|
|
|
|
|
1
|
last; |
|
51
|
|
|
|
|
|
|
} |
|
52
|
|
|
|
|
|
|
} |
|
53
|
|
|
|
|
|
|
} |
|
54
|
2
|
|
|
|
|
9
|
return $result; |
|
55
|
|
|
|
|
|
|
} |
|
56
|
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
1; |
|
58
|
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
__END__ |