/usr/share/perl5/Plucene/Index/SegmentTermPositions.pm is in libplucene-perl 1.25-3.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 | package Plucene::Index::SegmentTermPositions;
# final class SegmentTermPositions
# extends SegmentTermDocs implements TermPositions
=head1 NAME
Plucene::Index::SegmentTermPositions - Segment term positions
=head1 SYNOPSIS
# isa Plucene::Index::SegmentTermDocs
$seg_term_pos->skipping_doc;
my $next = $seg_term_pos->next_position;
=head1 DESCRIPTION
This is the segment term positions class.
=head1 METHODS
=cut
use strict;
use warnings;
use Carp;
use base 'Plucene::Index::SegmentTermDocs';
__PACKAGE__->mk_accessors(qw(_prox_stream _prox_count));
# private InputStream proxStream;
# private int proxCount;
# private int position;
=head2 new
my $seg_term_pos = Plucene::Index::SegmentTermPositions
->new(Plucene::Index::SegmentReader $seg_reader);
=cut
# SegmentTermPositions(SegmentReader p) throws IOException {
# super(p);
# this.proxStream = (InputStream)parent.proxStream.clone();
# }
sub new {
my $self = shift->SUPER::new(@_);
$self->{_prox_stream} = $self->parent->prox_stream;
$self->{_prox_ptr} = 0;
$self->{_prox_count} = 0;
return $self;
}
# final void seek(TermInfo ti) throws IOException {
# super.seek(ti);
# if (ti != null)
# proxStream.seek(ti.proxPointer);
# else
# proxCount = 0;
# }
sub _seek {
my ($self, $ti) = @_;
$self->SUPER::_seek($ti);
if ($ti) {
$self->{_prox_ptr} = $ti->prox_pointer;
} else {
$self->{_prox_count} = 0;
}
}
=head2 close
$seg_term_pos->close;
=cut
# public final void close() throws IOException {
# super.close();
# proxStream.close();
# }
=head2 next_position
my $next = $seg_term_pos->next_position;
=cut
# public final int nextPosition() throws IOException {
# proxCount--;
# return position += proxStream.readVInt();
# }
sub next_position {
my $self = shift;
$self->{_prox_count}--;
return $self->{position} += $self->{_prox_stream}->[ $self->{_prox_ptr}++ ];
}
=head2 skipping_doc
$seg_term_pos->skipping_doc;
=cut
# protected final void skippingDoc() throws IOException {
# for (int f = freq; f > 0; f--) // skip all positions
# proxStream.readVInt();
# }
sub skipping_doc {
my $self = shift;
$self->{_prox_ptr} += $self->freq;
}
# public final boolean next() throws IOException {
# for (int f = proxCount; f > 0; f--) // skip unread positions
# proxStream.readVInt();
#
# if (super.next()) { // run super
# proxCount = freq; // note frequency
# position = 0; // reset position
# return true;
# }
# return false;
# }
sub next {
my $self = shift;
$self->{_prox_ptr} += $self->{_prox_count};
if ($self->SUPER::next()) {
$self->{_prox_count} = $self->freq;
$self->{position} = 0;
return 1;
}
return;
}
=head2 read
This should not be called
=cut
# public final int read(final int[] docs, final int[] freqs)
# throws IOException {
# throw new RuntimeException();
# }
sub read { croak "'read' should not be called" }
1;
|