blib/lib/DDC/HitList.pm

filter: Statementstmt 46.6% 7 / 15 Branchbran n/a Conditioncond 0.0% 0 / 5 MC/DCmcdc 0.0% 0 / 3 Subroutinesub 40.0% 2 / 5 Podpod 33.3% 1 / 3 totaltotal 32.2% 10 / 31 CC 4 SCAR 18.7
CC
4
Cov
35%
expandFields
12.0
new
6.0
TO_JSON
2.0
CRAP 6.5
« blib/lib/DDC/PP/Object.pm ↑ Summary blib/lib/DDC/Format/Dumper.pm »
1 #-*- Mode: CPerl -*-
2  
3 ## File: DDC::HitList.pm
4 ## Author: Bryan Jurish <moocow@cpan.org>
5 ## Description:
6 ## + DDC Query utilities: query response structure
7 ##======================================================================
8  
9 package DDC::HitList;
10 26 ▶use DDC::Hit;
Subroutine BEGIN: called CC=1 SCAR=0.0
11 26 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
12  
13 ##======================================================================
14 ## Globals
15  
16 ##======================================================================
17 ## Constructors, etc.
18  
19 ## $hits = $CLASS_OR_OBJ->new(%args)
20 ## + %$hits, %args:
21 ## (
22 ## hits_ => \@hits, ##-- ARRAY-ref of DDC::Hit objects
23 ##
24 ## ##-- administrative data returned by DDC server (from ConcordDmnLib/Corpora.cpp: CDDCServerListenHost::ProcessSocketString())
25 ## istatus_ => $InternalError, ##-- int InternalError (0=success)
26 ## nstatus_ => $NetworkError, ##-- int iNetworkError (0=success)
27 ## end_ => $EndHitNo, ##-- DWORD EndHitNo
28 ## nhits_ => $HitsCount, ##-- DWORD HitsCount
29 ## ndocs_ => $DocsCount, ##-- DWORD RelevantDocsCount
30 ## dhits_ => $HitDistribution, ##-- string N1+N2+N3+...+NN=N*
31 ## ddocs_ => $DocDistribution, ##-- string N1+N2+N3+...+NN=N*
32 ## error_ => $errorMessage, ##-- error message if $hits->{istatus_}!=0 or $hits->{nstatus_}!=0 (empty: success)
33 ## )
34 0 ▶sub new {
Subroutine new: not called CC=2 SCAR=17.9
Pod documented
35 0 my $that = shift;
36 0 ▶ return bless {
Condition0%0/3
ref $that || $that
l!l&&r!l&&!r
000
MC/DC0%0/2
ref $that || $that
ref $that $that
Truth table0%0/3
A || B
A= ref $thatB= $that
ABresult
1X1
011
000
37 hits_=>[],
38 @_
39 }, ref($that)||$that;
40 }
41  
42 ## $hits = $hits->expandFields()
43 ## $hits = $hits->expandFields(\@fieldNames)
44 ## + just calls $hit->expandFields() on every hit in $hits->{hits_}
45 0 ▶sub expandFields {
Subroutine expandFields: not called CC=3 SCAR=24.8
Pod undocumented
46 0 my ($hl,$names) = @_;
47 0 ▶ $_->expandFields($names) foreach (@{$hl->{hits_}||[]});
Condition0%0/2
$hl->{'hits_'} || []
l!l
00
MC/DC0%0/1
$hl->{'hits_'} || []
$hl->{'hits_'}
Truth table0%0/2
A
A= $hl->{'hits_'}
Aresult
11
00
48 0 return $hl;
49 }
50  
51 ## $thingy = $obj->TO_JSON()
52 ## + annoying wrapper for JSON, JSON::XS
53 0 ▶sub TO_JSON {
Subroutine TO_JSON: not called CC=1 SCAR=6.9
Pod undocumented
54 0 return { %{$_[0]} };
55 }
56  
57  
58 26 1; ##-- be happy
59  
60 __END__
« blib/lib/DDC/PP/Object.pm ↑ Summary blib/lib/DDC/Format/Dumper.pm »