-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathOccurrence.java
More file actions
40 lines (35 loc) · 846 Bytes
/
Occurrence.java
File metadata and controls
40 lines (35 loc) · 846 Bytes
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
package lse;
/**
* This class encapsulates an occurrences of a keyword in a document. It stores the
* document name, and the frequency of occurrence in that document. Occurrences are
* associated with keywords in an index hash table.
*
* @author RU-NB-CS112
*
*/
public class Occurrence {
/**
* Document in which a keyword occurs.
*/
String document;
/**
* The frequency (number of times) the keyword occurs in the above document.
*/
int frequency;
/**
* Initializes this occurrence with the given document,frequency pair.
*
* @param doc Document name
* @param freq Frequency
*/
public Occurrence(String doc, int freq) {
document = doc;
frequency = freq;
}
/* (non-Javadoc)
* @see java.lang.Object#toString()
*/
public String toString() {
return "(" + document + "," + frequency + ")";
}
}