This repository has been archived by the owner on May 6, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 42
/
WikiDocInfo.java
76 lines (60 loc) · 1.79 KB
/
WikiDocInfo.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
package ivory.lsh.data;
import java.io.DataInput;
import java.io.DataOutput;
import java.io.IOException;
import org.apache.hadoop.io.Text;
import org.apache.hadoop.io.Writable;
import edu.umd.cloud9.io.array.ArrayListWritable;
import edu.umd.cloud9.io.map.HMapSFW;
public class WikiDocInfo implements Writable {
int langID;
ArrayListWritable<HMapSFW> vectors;
ArrayListWritable<Text> sentences;
public WikiDocInfo() {
super();
}
public WikiDocInfo(int i1, ArrayListWritable<Text> t, ArrayListWritable<HMapSFW> v){//, ArrayListOfIntsWritable l) {
langID = i1;
vectors = v;
sentences = t;
}
public void readFields(DataInput in) {
vectors = new ArrayListWritable<HMapSFW>();
sentences = new ArrayListWritable<Text>();
try {
langID = in.readInt();
} catch (IOException e1) {
e1.printStackTrace();
throw new RuntimeException("Could not read integer in WikiDocInfoSentence");
}
try {
vectors.readFields(in);
sentences.readFields(in);
} catch (IOException e) {
throw new RuntimeException("Could not read vectors/sentlengths in WikiDocInfoSentence");
}
}
public void write(DataOutput out) throws IOException {
out.writeInt(langID);
vectors.write(out);
sentences.write(out);
}
public boolean equals(Object other){
WikiDocInfo p = (WikiDocInfo) other;
return (p.getLangID()==getLangID() && (p.getVectors()).equals(this.getVectors()) && (p.getSentences()).equals(this.getSentences()));
}
public ArrayListWritable<HMapSFW> getVectors() {
return vectors;
}
public ArrayListWritable<Text> getSentences() {
return sentences;
}
public int getLangID() {
return langID;
}
public void set(int n1, ArrayListWritable<HMapSFW> vectors, ArrayListWritable<Text> sentences) {
this.langID = n1;
this.vectors = vectors;
this.sentences = sentences;
}
}