| 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
MC/DC0%0/2
ref $that || $that
ref $that
$that
Truth table0%0/3
A || B
A= ref $thatB= $that
| |||||||||||||||||||||
| 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_'} || []
MC/DC0%0/1
$hl->{'hits_'} || []
$hl->{'hits_'}
Truth table0%0/2
A
A= $hl->{'hits_'}
| |||||||||||||||||||||
| 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__ | ||||||||||||||||||||