File Coverage

blib/lib/Math/DifferenceSet/Planar/Schema/Result/DifferenceSet.pm
Criterion Covered Total %
statement 16 16 100.0
branch 2 2 100.0
condition n/a
subroutine 4 4 100.0
pod 1 1 100.0
total 23 23 100.0


line stmt bran cond sub pod time code
1             package Math::DifferenceSet::Planar::Schema::Result::DifferenceSet;
2              
3             =head1 NAME
4              
5             Math::DifferenceSet::Planar::Schema::Result::DifferenceSet -
6             planar difference set database backend result class definition.
7              
8             =cut
9              
10 7     7   17505 use strict;
  7         19  
  7         363  
11 7     7   47 use warnings;
  7         18  
  7         401  
12              
13 7     7   44 use base 'DBIx::Class::Core';
  7         16  
  7         3364  
14              
15             =head1 VERSION
16              
17             This documentation refers to version 1.003 of
18             Math::DifferenceSet::Planar::Schema::Result::DifferenceSet.
19              
20             =cut
21              
22             our $VERSION = '1.003';
23              
24             =head1 TABLE: C
25              
26             =cut
27              
28             __PACKAGE__->table("difference_set");
29              
30             =head1 ACCESSORS
31              
32             =head2 order
33              
34             data_type: 'integer'
35             is_nullable: 0
36              
37             =head2 base
38              
39             data_type: 'integer'
40             is_nullable: 0
41              
42             =head2 ref_std
43              
44             data_type: 'integer'
45             is_nullable: 0
46              
47             =head2 ref_lex
48              
49             data_type: 'integer'
50             is_nullable: 0
51              
52             =head2 ref_gap
53              
54             data_type: 'integer'
55             is_nullable: 0
56              
57             =head2 delta_main
58              
59             data_type: 'blob'
60             is_nullable: 0
61              
62             =cut
63              
64             __PACKAGE__->add_columns(
65             "order_",
66             { accessor => "order", data_type => "integer", is_nullable => 0 },
67             "base",
68             { data_type => "integer", is_nullable => 0 },
69             "ref_std",
70             { data_type => "integer", is_nullable => 0 },
71             "ref_lex",
72             { data_type => "integer", is_nullable => 0 },
73             "ref_gap",
74             { data_type => "integer", is_nullable => 0 },
75             "delta_main",
76             { data_type => "blob", is_nullable => 0 },
77             );
78              
79             =head2 main_elements
80              
81             I is a wrapper for I generating an array of
82             elements values from the deltas raw data. It returns an array reference
83             if deltas are defined, otherwise undef.
84              
85             Unpacking delta_main raw data into element values is part of the resultset
86             API, as different implementations may employ different packing mechanisms.
87              
88             =cut
89              
90             sub main_elements {
91 81     81 1 12172 my ($this) = @_;
92 81         2235 my $delta_main = $this->delta_main;
93 81 100       3957 return undef if !defined $delta_main;
94 80         187 my $sum = 0;
95 80         379 my @elements = map { $sum += $_ } unpack 'w*', $delta_main;
  210         550  
96 80         266 return \@elements;
97             }
98              
99             =head1 PRIMARY KEY
100              
101             =over 4
102              
103             =item * L
104              
105             =back
106              
107             =cut
108              
109             __PACKAGE__->set_primary_key("order_");
110              
111             1;
112              
113             =head1 SEE ALSO
114              
115             =over 4
116              
117             =item *
118              
119             L - schema class.
120              
121             =item *
122              
123             L - higher level data interface.
124              
125             =back
126              
127             =head1 AUTHOR
128              
129             Martin Becker, Ebecker-cpan-mp I cozap.comE
130              
131             =head1 COPYRIGHT AND LICENSE
132              
133             Copyright (c) 2019-2025 by Martin Becker, Blaubeuren.
134              
135             This library is free software; you can distribute it and/or modify it
136             under the terms of the Artistic License 2.0 (see the LICENSE file).
137              
138             The license grants freedom for related software development but does
139             not cover incorporating code or documentation into AI training material.
140             Please contact the copyright holder if you want to use the library whole
141             or in part for other purposes than stated in the license.
142              
143             =head1 DISCLAIMER OF WARRANTY
144              
145             This library is distributed in the hope that it will be useful, but
146             without any warranty; without even the implied warranty of merchantability
147             or fitness for a particular purpose.
148              
149             =cut