Filename | /usr/local/src/github.com/foswiki/core/lib/Foswiki/Search/Node.pm |
Statements | Executed 9 statements in 564µs |
Calls | P | F | Exclusive Time |
Inclusive Time |
Subroutine |
---|---|---|---|---|---|
1 | 1 | 1 | 24µs | 563µs | BEGIN@16 | Foswiki::Search::Node::
1 | 1 | 1 | 24µs | 31µs | BEGIN@12 | Foswiki::Search::Node::
1 | 1 | 1 | 22µs | 60µs | BEGIN@15 | Foswiki::Search::Node::
1 | 1 | 1 | 17µs | 34µs | BEGIN@13 | Foswiki::Search::Node::
0 | 0 | 0 | 0s | 0s | isEmpty | Foswiki::Search::Node::
0 | 0 | 0 | 0s | 0s | new | Foswiki::Search::Node::
0 | 0 | 0 | 0s | 0s | simplify | Foswiki::Search::Node::
0 | 0 | 0 | 0s | 0s | stringify | Foswiki::Search::Node::
0 | 0 | 0 | 0s | 0s | tokens | Foswiki::Search::Node::
Line | State ments |
Time on line |
Calls | Time in subs |
Code |
---|---|---|---|---|---|
1 | # See bottom of file for license and copyright information | ||||
2 | package Foswiki::Search::Node; | ||||
3 | |||||
4 | =begin TML | ||||
5 | |||||
6 | ---+ package Foswiki::Search | ||||
7 | |||||
8 | Refactoring mid-step that contains a set of SEARCH tokens and options. | ||||
9 | |||||
10 | =cut | ||||
11 | |||||
12 | 2 | 44µs | 2 | 38µs | # spent 31µs (24+7) within Foswiki::Search::Node::BEGIN@12 which was called:
# once (24µs+7µs) by Foswiki::Store::Interfaces::QueryAlgorithm::BEGIN@9 at line 12 # spent 31µs making 1 call to Foswiki::Search::Node::BEGIN@12
# spent 7µs making 1 call to strict::import |
13 | 2 | 51µs | 2 | 52µs | # spent 34µs (17+17) within Foswiki::Search::Node::BEGIN@13 which was called:
# once (17µs+17µs) by Foswiki::Store::Interfaces::QueryAlgorithm::BEGIN@9 at line 13 # spent 34µs making 1 call to Foswiki::Search::Node::BEGIN@13
# spent 18µs making 1 call to warnings::import |
14 | |||||
15 | 2 | 48µs | 2 | 97µs | # spent 60µs (22+38) within Foswiki::Search::Node::BEGIN@15 which was called:
# once (22µs+38µs) by Foswiki::Store::Interfaces::QueryAlgorithm::BEGIN@9 at line 15 # spent 60µs making 1 call to Foswiki::Search::Node::BEGIN@15
# spent 38µs making 1 call to Assert::import |
16 | 2 | 416µs | 2 | 1.10ms | # spent 563µs (24+539) within Foswiki::Search::Node::BEGIN@16 which was called:
# once (24µs+539µs) by Foswiki::Store::Interfaces::QueryAlgorithm::BEGIN@9 at line 16 # spent 563µs making 1 call to Foswiki::Search::Node::BEGIN@16
# spent 539µs making 1 call to Error::import |
17 | |||||
18 | # Some day this may usefully be an infix node | ||||
19 | #use Foswiki::Infix::Node (); | ||||
20 | #our @ISA = ('Foswiki::Infix::Node'); | ||||
21 | |||||
22 | =begin TML | ||||
23 | |||||
24 | ---++ ClassMethod new($search, $tokens, $options) | ||||
25 | |||||
26 | Construct a search token container. | ||||
27 | |||||
28 | =cut | ||||
29 | |||||
30 | sub new { | ||||
31 | my ( $class, $search, $tokens, $options ) = @_; | ||||
32 | my $this = bless( | ||||
33 | { | ||||
34 | tokens => $tokens, | ||||
35 | search => $search, | ||||
36 | options => $options, | ||||
37 | }, | ||||
38 | $class | ||||
39 | ); | ||||
40 | return $this; | ||||
41 | } | ||||
42 | |||||
43 | =begin TML | ||||
44 | |||||
45 | ---++ ObjectMethod tokens() -> \@tokenList | ||||
46 | |||||
47 | Return a ref to a list of tokens that are ANDed to perform the search. | ||||
48 | |||||
49 | =cut | ||||
50 | |||||
51 | sub tokens { | ||||
52 | my $this = shift; | ||||
53 | return [] unless $this->{tokens}; | ||||
54 | return $this->{tokens}; | ||||
55 | } | ||||
56 | |||||
57 | =begin TML | ||||
58 | |||||
59 | ---++ ObjectMethod isEmpty() -> boolean | ||||
60 | |||||
61 | Return true if this search is empty (has no tokens) | ||||
62 | |||||
63 | =cut | ||||
64 | |||||
65 | sub isEmpty { | ||||
66 | my $this = shift; | ||||
67 | return !( $this->{tokens} && scalar( @{ $this->{tokens} } ) > 0 ); | ||||
68 | } | ||||
69 | |||||
70 | sub stringify { | ||||
71 | my $this = shift; | ||||
72 | return | ||||
73 | join( ' ', @{ $this->{tokens} } ) . ' {' | ||||
74 | . join( ',', | ||||
75 | map { "$_=>$this->{options}->{$_}" } | ||||
76 | grep { !/^_/ } keys %{ $this->{options} } ) | ||||
77 | . '}'; | ||||
78 | } | ||||
79 | |||||
80 | =begin TML | ||||
81 | |||||
82 | ---++ ObjectMethod simplify(%opts) | ||||
83 | |||||
84 | does nothing yet | ||||
85 | |||||
86 | =cut | ||||
87 | |||||
88 | sub simplify { | ||||
89 | } | ||||
90 | |||||
91 | 1 | 4µs | 1; | ||
92 | __END__ |