-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathPaper.cpp
65 lines (51 loc) · 1.23 KB
/
Paper.cpp
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
#include"node.h"
extern KeywordManager km;
Paper::Paper(int id) :id(id) {
}
void Paper::addAuthor(Author* au) {
v_authors.push_back(au);
}
void Paper::addKeyword(int kid) {
v_kws.push_back(kid);
}
/*
* set year of this paper,
* set year of this paper's authors
*/
void Paper::setyear(int year1) {
year = year1;
}
void Paper::setVenue(int vid2) {
vid = vid2;
}
void Paper::setKeywordSize() {
kwdsize = v_kws.size();
}
void Paper::arraylize() {
authorsize = v_authors.size();
authors = (Author**)malloc(sizeof(Author*)*authorsize);
vector<Author*>::iterator vite = v_authors.begin();
for (int i = 0; i<authorsize; i++, vite++) {
authors[i] = *vite;
}
vector<Author*>().swap(v_authors);
kwd_fos_size = v_kws.size();
kws = (int*)malloc(sizeof(int)*kwd_fos_size);
vector<int>::iterator iite = v_kws.begin();
for (int i = 0; i<kwd_fos_size; i++, iite++) {
kws[i] = *iite;
}
vector<int>().swap(v_kws);
}
void Paper::updateAuthor(Author* au1) {
for (int i = 0; i<authorsize; i++) {
if (authors[i]->nid == au1->nid) {
authors[i] = au1;//¸ü¸Ä
}
}
return;
}
void Paper::addCitation(int c) {
// cout<<"add citation\t"<<id<<"\t"<<c<<endl;
citations.insert(c);
}