lib/SemMed/Interface/Predicate.pm untested

filter: Statementstmt 0.0% 0 / 16 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 0.0% 0 / 8 Podpod 0.0% 0 / 6 totaltotal 0.0% 0 / 30 SCAR 6.9
CC
1
Cov
0%
new
2.0
getSource
2.0
getPredicate
2.0
CRAP 2.0
1 #!/usr/bin/perl
2 #
3 # @File Predicate.pm
4 # @Author Andriy Mulyar
5 # @Created Jun 27, 2016 1:17:38 PM
6 #
7  
8 use strict;
9 use warnings;
10 package Predicate;
11  
12 #A predicate will be treated as an edge on the graph. This object takes 4
13 # parameters
14 #Source CUI
15 #Predicate Type (ie. ISA, TREATS, CAUSES, etc)
16 #Destination CUI
17 #Edge Weight
18 #
19 sub new {
20 my $class = shift;
21 my $self = {
22 _source => shift,
23 _predicate => shift,
24 _destination => shift,
25 _weight => shift,
26  
27 };
28 bless $self, $class;
29 return $self;
30 }
31  
32 #returns source vertex
33 sub getSource{
34 return shift->{_source}
35 }
36  
37 #returns predicate name
38 sub getPredicate{
39 return shift->{_predicate};
40 }
41  
42 #returns destination vertex
43 sub getDestination{
44 return shift->{_destination}
45 }
46  
47 #returns weight associated with the edge
48 sub getWeight{
49 return shift->{_weight};
50 }
51  
52 #test print
53 sub _print{
54 my $self = shift;
55 print $self->{_source}->getPreferredName()." ". $self->{_predicate} ." ".$self->{_destination}->getPreferredName()." ".$self->{_weight}."\n";
56 #print "$self->{_source} $self->{_predicate} $self->{_destination}";
57 }
58 1;