File Coverage

blib/lib/OBO/Util/RelationshipTypeSet.pm
Criterion Covered Total %
statement 21 21 100.0
branch 5 6 83.3
condition n/a
subroutine 5 5 100.0
pod 2 2 100.0
total 33 34 97.0


line stmt bran cond sub pod time code
1             # $Id: RelationshipTypeSet.pm 2014-02-02 erick.antezana $
2             #
3             # Module : RelationshipTypeSet.pm
4             # Purpose : RelationshipType 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::RelationshipTypeSet;
11              
12             our @ISA = qw(OBO::Util::ObjectSet);
13 8     8   5435 use OBO::Util::ObjectSet;
  8         10  
  8         206  
14              
15 8     8   34 use strict;
  8         7  
  8         206  
16 8     8   36 use warnings;
  8         11  
  8         1084  
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 3 my ($self, $id) = @_;
29 2 100       9 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 1 my $self = shift;
43 2         2 my $result = 0;
44 2 50       5 if (@_) {
45 2         3 my $relationship_type_id = shift;
46            
47 2         1 foreach my $ele (sort values %{$self->{MAP}}){
  2         17  
48 12 100       20 if ($ele->name() eq $relationship_type_id) {
49 1         1 $result = 1;
50 1         2 last;
51             }
52             }
53             }
54 2         6 return $result;
55             }
56              
57             1;
58              
59             __END__