File Coverage

blib/lib/Lingua/Ogmios/Annotations/DomainSpecificRelation.pm
Criterion Covered Total %
statement 9 45 20.0
branch 0 16 0.0
condition n/a
subroutine 3 8 37.5
pod 0 5 0.0
total 12 74 16.2


line stmt bran cond sub pod time code
1             package Lingua::Ogmios::Annotations::DomainSpecificRelation;
2              
3 16     16   65 use strict;
  16         22  
  16         484  
4 16     16   72 use warnings;
  16         16  
  16         350  
5              
6 16     16   60 use Lingua::Ogmios::Annotations::Element;
  16         16  
  16         5893  
7             our @ISA = qw(Lingua::Ogmios::Annotations::Element);
8              
9             #
10             #
11             #
12            
13             #
14             #
15             # (id, log_id?,
16             # domain_specific_relation_type,
17             # list_refid_semantic_unit) >
18            
19             #
20             #
21              
22             #
23             #
24              
25            
26             sub new {
27 0     0 0   my ($class, $fields) = @_;
28              
29 0 0         if (!defined $fields->{'id'}) {
30 0           $fields->{'id'} = -1;
31             }
32 0 0         if (!defined $fields->{'domain_specific_relation_type'}) {
33 0           die("domain_specific_relation_type is not defined");
34             }
35 0 0         if (!defined $fields->{'list_refid_semantic_unit'}) {
36 0           die("list_refid_semantic_unit is not defined");
37             }
38 0           my $domainspecificrelation = $class->SUPER::new({
39             'id' => $fields->{'id'},
40             # 'form' => $fields->{'form'},
41             }
42             );
43 0           bless ($domainspecificrelation,$class);
44              
45 0           $domainspecificrelation->list_refid_semantic_unit($fields->{'list_refid_semantic_unit'});
46 0           $domainspecificrelation->domain_specific_relation_type($fields->{'domain_specific_relation_type'});
47              
48 0 0         if (defined $fields->{'log_id'}) {
49 0           $domainspecificrelation->setLogId($fields->{'log_id'});
50             }
51 0           return($domainspecificrelation);
52             }
53              
54             sub list_refid_semantic_unit {
55 0     0 0   my $self = shift;
56              
57 0           my $ref;
58             my $elt;
59              
60 0 0         if (@_) {
61 0           $self->{'reference'} = 'list_refid_semantic_unit';
62 0           $self->{$self->{'reference'}} = [];
63 0           $ref = shift;
64 0 0         if (ref($ref) eq "ARRAY") {
65 0           foreach $elt (@$ref) {
66             # warn $elt->getForm . "\n";
67 0           push @{$self->{$self->{'reference'}}}, $elt;
  0            
68             }
69             } else {
70 0 0         if (ref($ref) eq "HASH") {
71 0           foreach $elt (keys %$ref) {
72             # warn $elt->getForm . "\n";
73 0           push @{$self->{$self->{'reference'}}}, { $elt => $ref->{$elt}};
  0            
74             }
75             }
76             }
77             }
78 0           return($self->{$self->{'reference'}});
79              
80             # $self->{'list_refid_semantic_unit'} = shift if @_;
81             # return($self->{'list_refid_semantic_unit'});
82             }
83              
84             sub domain_specific_relation_type {
85 0     0 0   my $self = shift;
86              
87 0 0         $self->{'domain_specific_relation_type'} = shift if @_;
88 0           return($self->{'domain_specific_relation_type'});
89             }
90              
91             sub XMLout {
92 0     0 0   my ($self, $order) = @_;
93            
94 0           return($self->SUPER::XMLout("domain_specific_relation", $order));
95             }
96              
97             sub reference {
98 0     0 0   my ($self) = @_;
99              
100 0           return($self->list_refid_semantic_unit);
101             }
102              
103             1;
104              
105             __END__