-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathwebpage.cpp
More file actions
95 lines (80 loc) · 1.51 KB
/
webpage.cpp
File metadata and controls
95 lines (80 loc) · 1.51 KB
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
89
90
91
92
93
94
95
#include "webpage.h"
using namespace std;
/**
* Default constructor
*/
WebPage::WebPage(string n) : name(n) {
}
/**
* Destructor
*/
WebPage::~WebPage() {
}
/**
* Adds word to words set
*/
void WebPage::addWord(const string &word) {
words.insert(word);
}
/**
* Adds outgoing link to outgoing set
*/
void WebPage::addOutgoingLink(const string &link) {
outgoing.insert(link);
}
/**
* Adds incoming link to incoming set
*/
void WebPage::addIncomingLink(const string &link) {
incoming.insert(link);
}
/**
* Prints outgoing links
*/
void WebPage::printOutgoingLinks(ofstream &output) {
output << outgoing.size() << endl;
for (set<string>::iterator it = outgoing.begin(); it != outgoing.end(); it++) {
string link = *it;
output << link << endl;
}
}
/**
* Prints incoming links
*/
void WebPage::printIncomingLinks(ofstream &output) {
output << incoming.size() << endl;
for (set<string>::iterator it = incoming.begin(); it != incoming.end(); it++) {
string link = *it;
output << link << endl;
}
}
/**
* Returns filename of WebPage
*/
string WebPage::getName() const {
return name;
}
/**
* Returns outgoing links of WebPage
*/
set<string> WebPage::getOutgoingLinks() const {
return outgoing;
}
/**
* Returns incoming links of WebPage
*/
set<string> WebPage::getIncomingLinks() const {
return incoming;
}
/**
* Returns page rank of WebPage
*/
double WebPage::getPageRank() const {
return pageRank;
}
/**
* Sets page rank of WebPage
*/
void WebPage::setPageRank(double rank) {
pageRank = rank;
}