blib/lib/Lingua/Ogmios/Annotations/AnaphoraRelation.pm untested

filter: Statementstmt 0.0% 0 / 49 Branchbran 0.0% 0 / 16 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 0.0% 0 / 8 Podpod 0.0% 0 / 5 totaltotal 0.0% 0 / 78 SCAR 45.0
CC
9
Cov
0%
new
42.0
anaphora
6.0
list_refid_semantic_unit
6.0
CRAP 90.0
1 package Lingua::Ogmios::Annotations::AnaphoraRelation;
2  
3 use strict;
4 use warnings;
5  
6 use Lingua::Ogmios::Annotations::Element;
7 our @ISA = qw(Lingua::Ogmios::Annotations::Element);
8  
9 # <!-- =================================================== -->
10 # <!-- ANAPHORA_RELATION_LEVEL -->
11 # <!-- =================================================== -->
12 # <!ELEMENT anaphora_relation_level
13 # (log_id?, comments*,
14 # anaphora_relation+) >
15 # <!-- anaphora_relation -->
16 # <!ELEMENT anaphora_relation
17 # (id, log_id?,
18 # anaphora_relation_type,
19 # anaphora, antecedent) >
20
21 # <!ELEMENT antecedent (list_refid_semantic_unit)+ >
22 # <!ELEMENT anaphora
23 # (refid_semantic_unit) >
24
25
26 # <!-- anaphora_relation_type -->
27 # <!ELEMENT anaphora_relation_type
28 # (#PCDATA) >
29  
30 sub new {
31 my ($class, $fields) = @_;
32  
33 if (!defined $fields->{'id'}) {
34 $fields->{'id'} = -1;
35 }
36 if (!defined $fields->{'anaphora_relation_type'}) {
37 die("anaphora_relation_type is not defined");
38 }
39 if (!defined $fields->{'anaphora'}) {
40 die("anaphora is not defined");
41 }
42 if (!defined $fields->{'antecedent'}) {
43 die("antecedent is not defined");
44 }
45 my $anaphorarelation = $class->SUPER::new({
46 'id' => $fields->{'id'},
47 # 'form' => $fields->{'form'},
48 }
49 );
50 bless ($anaphorarelation,$class);
51  
52 $anaphorarelation->anaphora_relation_type($fields->{'domain_specific_relation_type'});
53  
54 # $anaphorarelation->list_refid_semantic_unit($fields->{'list_refid_semantic_unit'});
55  
56 if (defined $fields->{'log_id'}) {
57 $anaphorarelation->setLogId($fields->{'log_id'});
58 }
59 return($anaphorarelation);
60 }
61  
62 sub anaphora {
63 my $self = shift;
64  
65 if (@_) {
66 $self->{anaphora}->{'reference'} = 'refid_semantic_unit';
67 $self->{anaphora}->{$self->{'reference'}} = shift;
68 }
69 return($self->{anaphora}->{$self->{'reference'}});
70
71 }
72  
73 sub list_refid_semantic_unit {
74 my $self = shift;
75  
76 my $ref;
77 my $elt;
78  
79 if (@_) {
80 $self->{antecedent}->{'reference'} = 'list_refid_semantic_unit';
81 $self->{antecedent}->{$self->{'reference'}} = [];
82 $ref = shift;
83 foreach $elt (@$ref) {
84 push @{$self->{antecedent}->{$self->{'reference'}}}, $elt;
85 }
86 }
87 return($self->{antecedent}->{$self->{'reference'}});
88  
89 }
90  
91 sub anaphora_relation_type {
92 my $self = shift;
93  
94 $self->{'anaphora_relation_type'} = shift if @_;
95 return($self->{'anaphora_relation_type'});
96 }
97  
98 sub XMLout {
99 my ($self, $order) = @_;
100
101 return($self->SUPER::XMLout("anaphora_relation", $order));
102 }
103  
104  
105 1;
106  
107 __END__