-
Notifications
You must be signed in to change notification settings - Fork 0
/
Terms.java
88 lines (79 loc) · 1.91 KB
/
Terms.java
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
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package Indexing;
/**
*
* @author rl07bebb
*/
import Analyzing.Document;
import java.io.Serializable;
/**
* This class is responsible for creating the data that holds the terms and
* their related information
*/
public class Terms implements Serializable{
private Document doc;
private final String TERM;
private int frequency;
private int firstOccurence;
/**
* This Constructor Creates the terms with the first instance of the term in
* a documents and its location.
*
* @param s
* @param d
* @param l
*/
public Terms(String s, Document d, int l) {
firstOccurence = l;
TERM = s;
doc = d;
frequency = 1;
}
/**
* This method is responsible for incrementing the method and checking if the
* document is new one.
*
* @param d the document the term is found in
* @param l the word location that the word is found in
*
*/
public void incrementFreq() {
frequency++;
}
/**
* This method is responsible for getting the Term's name as a String.
*
* @return
*/
public String getTerm() {
return TERM;
}
/**
* This method is responsible for getting the Term's Freq as a number.
*
* @return
*/
public int getFreq() {
return frequency;
}
/**
* This method is responsible for getting the Term's First Occurence as a number.
*
* @return
*/
public int getFOccurence() {
return firstOccurence;
}
/**
* This method is responsible for getting the Term's doc as a String.
*
* @return
*/
public String getDocID() {
return doc.getDocID();
}
}