1
/*------------------------------------------------------------------------------
2
* Copyright (C) 2003-2006 Ben van Klinken and the CLucene Team
4
* Distributable under the terms of either the Apache License (Version 2.0) or
5
* the GNU Lesser General Public License, as specified in the COPYING file.
6
------------------------------------------------------------------------------*/
7
#include "CLucene/StdHeader.h"
16
//Post - Instance has been created
24
TermInfo::~TermInfo(){
27
//Post - Instance has been destroyed
30
TermInfo::TermInfo(const int32_t df, const int64_t fp, const int64_t pp){
32
//Pre - df >= 0, fp >= 0 pp >= 0
33
//Post - An instance has been created with FreqPointer = fp, proxPointer=pp and docFreq= df
35
CND_PRECONDITION(df >= 0, "df contains negative number");
36
CND_PRECONDITION(fp >= 0, "fp contains negative number");
37
CND_PRECONDITION(pp >= 0, "pp contains negative number");
45
TermInfo::TermInfo(const TermInfo* ti) {
47
// Initialises this instance by copying the values of another TermInfo ti
48
//Pre - ti is a reference to another TermInfo
50
// ti->freqPointer >= 0
51
// ti->proxPointer >= 0
52
//Post - Values of ti have been copied to the values of this Instance.
54
CND_PRECONDITION(ti->docFreq >= 0, "ti->docFreq contains negative number");
55
CND_PRECONDITION(ti->freqPointer >= 0, "ti->freqPointer contains negative number");
56
CND_PRECONDITION(ti->proxPointer >= 0, "ti->proxPointer contains negative number");
58
docFreq = ti->docFreq;
59
freqPointer = ti->freqPointer;
60
proxPointer = ti->proxPointer;
61
skipOffset = ti->skipOffset;
64
void TermInfo::set(const int32_t df, const int64_t fp, const int64_t pp, int32_t so) {
65
//Func - Sets a new document frequency, a new freqPointer and a new proxPointer
66
//Pre - df >= 0, fp >= 0 pp >= 0
67
//Post - The new document frequency, a new freqPointer and a new proxPointer
70
CND_PRECONDITION(df >= 0, "df contains negative number");
71
CND_PRECONDITION(fp >= 0, "fp contains negative number");
72
CND_PRECONDITION(pp >= 0, "pp contains negative number");
80
void TermInfo::set(const TermInfo* ti) {
81
//Func - Sets a new document frequency, a new freqPointer and a new proxPointer
82
// by copying these values from another instance of TermInfo
83
//Pre - ti is a reference to another TermInfo
85
// ti->freqPointer >= 0
86
// ti->proxPointer >= 0
87
//Post - Values of ti have been copied to the values of this Instance.
89
CND_PRECONDITION(ti->docFreq >= 0, "ti->docFreq contains negative number");
90
CND_PRECONDITION(ti->freqPointer >= 0, "ti->freqPointer contains negative number");
91
CND_PRECONDITION(ti->proxPointer >= 0, "ti->proxPointer contains negative number");
93
docFreq = ti->docFreq;
94
freqPointer = ti->freqPointer;
95
proxPointer = ti->proxPointer;
96
skipOffset = ti->skipOffset;