-
Notifications
You must be signed in to change notification settings - Fork 0
/
Item.java
109 lines (96 loc) · 2.48 KB
/
Item.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
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
/**
* @author Wensheng Gan, HIT, China
* @see AlgoRFMP_tree
*/
public class Item {
//成员变量
String name = "-1";
double utility = 0;
double recency = 0d;
double frequency = 0;
/**
* Constructor that takes item name
*
* @param name item
*/
//构造方法
public Item(String name) {
this.name = name;
}
/**
* Constructor that takes item name and utility
*
* @param name item
* @param utility utility value of item
* @param recency recency value of item
*/
public Item(String name, double utility, double recency) {
this.name = name;
this.utility = utility;
this.recency = recency;
}
// public Item(String name, double frequency, double utility) {
// this.name = name;
// this.utility = utility;
// this.frequency = frequency;
// }
/**
* Constructor that takes item name and utility
*
* @param name item
* @param utility utility value of item
* @param recency recency value of item
* @param frequency frequency value of item
*/
public Item(String name, double utility, double recency, double frequency) {
this.name = name;
this.utility = utility;
this.recency = recency;
this.frequency = frequency;
}
/**
* method to get node utility
*/
public double getUtility() {
return utility;
}
/**
* method to get node recency value
*/
public double getRececny() {
return recency;
}
/**
* method to get node frequency value
*/
public double getFrequency() { return frequency; }
/**
* method to set node utility
*/
public void setUtility(int utility) {
this.utility = utility;
}
/**
* method to set node recency value
*/
public void setRecency(double recency) {
this.recency = recency;
}
/**
* method to set node frequency value
*/
public void setFrequency(int frequency) { this.frequency = frequency; }
/**
* method to get perticular item
*/
public String getName() {
return name;
}
/**
* override the out-perform method
*/
@Override
public String toString() {
return this.name + " utility: " + this.utility + " , frequency: " + this.frequency + " , recency: " + this.recency;
}
}